directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [6/6] git commit: o Added a toString() metjod
Date Wed, 29 Oct 2014 16:10:30 GMT
o Added a toString() metjod


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/08ea401b
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/08ea401b
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/08ea401b

Branch: refs/heads/master
Commit: 08ea401b3ca8549c5a2442f484c51fbb4a4540c7
Parents: 2ae4129
Author: Emmanuel L├ęcharny <elecharny@symas.com>
Authored: Wed Oct 29 15:50:19 2014 +0100
Committer: Emmanuel L├ęcharny <elecharny@symas.com>
Committed: Wed Oct 29 17:09:42 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/ldap/suffix/Suffix.java       |  45 +++++-
 .../directory/fortress/core/rbac/PermObj.java   |   8 +-
 .../directory/fortress/core/rbac/PwPolicy.java  | 125 +++++++++++++---
 .../fortress/core/rbac/Relationship.java        |  57 ++++++--
 .../directory/fortress/core/rbac/RolePerm.java  |  26 +++-
 .../fortress/core/rbac/RoleRelationship.java    |  25 +++-
 .../directory/fortress/core/rbac/Session.java   | 146 +++++++++++++++----
 .../directory/fortress/core/rbac/UserRole.java  |  27 ++--
 .../directory/fortress/core/rbac/Warning.java   |  46 +++++-
 9 files changed, 410 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/ldap/suffix/Suffix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/suffix/Suffix.java b/src/main/java/org/apache/directory/fortress/core/ldap/suffix/Suffix.java
index 08876da..025ec86 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/suffix/Suffix.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/suffix/Suffix.java
@@ -20,11 +20,21 @@
 package org.apache.directory.fortress.core.ldap.suffix;
 
 
+/**
+ * A class storing the suffix information
+ */
 public class Suffix
 {
+    /** Top level domain component */
     private String dc;
+    
+    /** top level domain component specifier */
     private String dc2;
+    
+    /** Second level domain component name */
     private String name;
+    
+    /** The suffix description */
     private String description;
 
 
@@ -35,12 +45,13 @@ public class Suffix
      * @param name        second level domain component name maps to attribute in 'dcObject'
object class.
      * @param description maps to 'o' attribute in 'dcObject' object class.
      */
-    public Suffix(String dc, String name, String description)
+    public Suffix( String dc, String name, String description )
     {
         this.dc = dc;
         this.name = name;
         this.description = description;
     }
+    
 
     /**
      * Default constructor used by {@link org.apache.directory.fortress.core.ant.FortressAntTask}
@@ -48,6 +59,7 @@ public class Suffix
     public Suffix()
     {
     }
+    
 
     /**
      * Get the second level qualifier on the domain component.  This attribute is required.
@@ -58,16 +70,18 @@ public class Suffix
     {
         return name;
     }
+    
 
     /**
      * Set the second level qualifier on the domain component.  This attribute is required.
      *
      * @param name maps to 'dcObject' object class.
      */
-    public void setName(String name)
+    public void setName( String name )
     {
         this.name = name;
     }
+    
 
     /**
      * Get the description for the domain component.  This value is not required or constrained
@@ -79,6 +93,7 @@ public class Suffix
     {
         return description;
     }
+    
 
     /**
      * Set the description for the domain component.  This value is not required or constrained
@@ -86,10 +101,11 @@ public class Suffix
      *
      * @param description maps to 'o' attribute on 'dcObject'.
      */
-    public void setDescription(String description)
+    public void setDescription( String description )
     {
         this.description = description;
     }
+    
 
     /**
      * Get top level domain component specifier, i.e. dc=com.  This attribute is required.
@@ -100,16 +116,18 @@ public class Suffix
     {
         return dc;
     }
+    
 
     /**
      * Set top level domain component specifier, i.e. dc=com.  This attribute is required.
      *
      * @param dc maps to 'dc' in 'dcObject' object class.
      */
-    public void setDc(String dc)
+    public void setDc( String dc )
     {
         this.dc = dc;
     }
+    
 
     /**
      * Get top level domain component specifier, i.e. dc=com for a three part dc structure.
 This attribute is optional.
@@ -120,6 +138,7 @@ public class Suffix
     {
         return dc2;
     }
+    
 
     /**
      * Get top level domain component specifier, i.e. dc=com for three part dc structure.
 This attribute is optional.
@@ -130,5 +149,23 @@ public class Suffix
     {
         this.dc2 = dc2;
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "Suffix object: \n" );
+
+        sb.append( "    dc :" ).append( dc ).append( '\n' );
+        sb.append( "    dc2 :" ).append( dc2 ).append( '\n' );
+        sb.append( "    name :" ).append( name ).append( '\n' );
+        sb.append( "    description :" ).append( description ).append( '\n' );
+
+        return sb.toString();
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/PermObj.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/PermObj.java b/src/main/java/org/apache/directory/fortress/core/rbac/PermObj.java
index af60b80..b26565f 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/PermObj.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/PermObj.java
@@ -20,6 +20,7 @@
 package org.apache.directory.fortress.core.rbac;
 
 
+import java.io.Serializable;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
@@ -135,9 +136,10 @@ import javax.xml.bind.annotation.XmlType;
         "props",
         "admin"
 })
-public class PermObj extends FortEntity
-    implements java.io.Serializable
+public class PermObj extends FortEntity implements Serializable
 {
+    private static final long serialVersionUID = 1L;
+    
     private boolean admin;
     private String internalId;
     private String objName;
@@ -373,7 +375,7 @@ public class PermObj extends FortEntity
     {
         if ( props != null )
         {
-            for ( Enumeration e = props.propertyNames(); e.hasMoreElements(); )
+            for ( Enumeration<?> e = props.propertyNames(); e.hasMoreElements(); )
             {
                 // This LDAP attr is stored as a name-value pair separated by a ':'.
                 String key = ( String ) e.nextElement();

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/PwPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/PwPolicy.java b/src/main/java/org/apache/directory/fortress/core/rbac/PwPolicy.java
index 759661d..055dc29 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/PwPolicy.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/PwPolicy.java
@@ -20,6 +20,8 @@
 package org.apache.directory.fortress.core.rbac;
 
 
+import java.io.Serializable;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -129,9 +131,10 @@ import javax.xml.bind.annotation.XmlType;
     "allowUserChange",
     "safeModify"
 })
-public class PwPolicy extends FortEntity
-    implements java.io.Serializable
+public class PwPolicy extends FortEntity implements Serializable
 {
+    private static final long serialVersionUID = 1L;
+
     /**
      * Maps to name attribute of pwdPolicy object class.
      */
@@ -330,6 +333,7 @@ public class PwPolicy extends FortEntity
     public PwPolicy()
     {
     }
+    
 
     /**
      * Create instance given a policy name.
@@ -347,8 +351,9 @@ public class PwPolicy extends FortEntity
      */
     public String getName()
     {
-        return this.name;
+        return name;
     }
+    
 
     /**
      * Set the required attribute policy name on this entity.
@@ -358,6 +363,7 @@ public class PwPolicy extends FortEntity
     {
         this.name = name;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds that must elapse between
@@ -368,8 +374,9 @@ public class PwPolicy extends FortEntity
      */
     public Integer getMinAge()
     {
-        return this.minAge;
+        return minAge;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds that must elapse between
@@ -382,6 +389,7 @@ public class PwPolicy extends FortEntity
     {
         this.minAge = minAge;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds after which a modified
@@ -394,8 +402,9 @@ public class PwPolicy extends FortEntity
      */
     public Long getMaxAge()
     {
-        return this.maxAge;
+        return maxAge;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds after which a modified
@@ -410,6 +419,7 @@ public class PwPolicy extends FortEntity
     {
         this.maxAge = maxAge;
     }
+    
 
     /**
      * This optional attribute specifies the maximum number of used passwords stored
@@ -422,8 +432,9 @@ public class PwPolicy extends FortEntity
      */
     public Short getInHistory()
     {
-        return this.inHistory;
+        return inHistory;
     }
+    
 
     /**
      * This optional attribute specifies the maximum number of used passwords stored
@@ -438,6 +449,7 @@ public class PwPolicy extends FortEntity
     {
         this.inHistory = inHistory;
     }
+    
 
     /**
      * This optional attribute is not currently supported by Fortress.
@@ -454,8 +466,9 @@ public class PwPolicy extends FortEntity
      */
     public Short getCheckQuality()
     {
-        return this.checkQuality;
+        return checkQuality;
     }
+    
 
     /**
      * This optional attribute is not currently supported by Fortress.
@@ -474,6 +487,7 @@ public class PwPolicy extends FortEntity
     {
         this.checkQuality = checkQuality;
     }
+    
 
     /**
      * When quality checking is enabled, this optional attribute holds the minimum
@@ -488,8 +502,9 @@ public class PwPolicy extends FortEntity
      */
     public Short getMinLength()
     {
-        return this.minLength;
+        return minLength;
     }
+    
 
     /**
      * When quality checking is enabled, this optional attribute holds the minimum
@@ -506,6 +521,7 @@ public class PwPolicy extends FortEntity
     {
         this.minLength = minLength;
     }
+    
 
     /**
      * This optional attribute specifies the maximum number of seconds before a
@@ -519,8 +535,9 @@ public class PwPolicy extends FortEntity
      */
     public Long getExpireWarning()
     {
-        return this.expireWarning;
+        return expireWarning;
     }
+    
 
     /**
      * This optional attribute specifies the maximum number of seconds before a
@@ -536,6 +553,7 @@ public class PwPolicy extends FortEntity
     {
         this.expireWarning = expireWarning;
     }
+    
 
     /**
      * This optional attribute specifies the number of times an expired password can
@@ -546,8 +564,9 @@ public class PwPolicy extends FortEntity
      */
     public Short getGraceLoginLimit()
     {
-        return this.graceLoginLimit;
+        return graceLoginLimit;
     }
+    
 
     /**
      * This optional attribute specifies the number of times an expired password can
@@ -560,6 +579,7 @@ public class PwPolicy extends FortEntity
     {
         this.graceLoginLimit = graceLoginLimit;
     }
+    
 
     /**
      * This optional attribute indicates, when its value is "TRUE", that the password
@@ -574,8 +594,9 @@ public class PwPolicy extends FortEntity
      */
     public Boolean getLockout()
     {
-        return this.lockout;
+        return lockout;
     }
+    
 
     /**
      * This optional attribute indicates, when its value is "TRUE", that the password
@@ -592,6 +613,7 @@ public class PwPolicy extends FortEntity
     {
         this.lockout = lockout;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds that the password cannot
@@ -604,8 +626,9 @@ public class PwPolicy extends FortEntity
      */
     public Integer getLockoutDuration()
     {
-        return this.lockoutDuration;
+        return lockoutDuration;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds that the password cannot
@@ -620,6 +643,7 @@ public class PwPolicy extends FortEntity
     {
         this.lockoutDuration = lockoutDuration;
     }
+    
 
     /**
      * This optional attribute specifies the number of consecutive failed bind
@@ -631,8 +655,9 @@ public class PwPolicy extends FortEntity
      */
     public Short getMaxFailure()
     {
-        return this.maxFailure;
+        return maxFailure;
     }
+    
 
     /**
      * This optional attribute specifies the number of consecutive failed bind
@@ -646,6 +671,7 @@ public class PwPolicy extends FortEntity
     {
         this.maxFailure = maxFailure;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds after which the password
@@ -658,8 +684,9 @@ public class PwPolicy extends FortEntity
      */
     public Short getFailureCountInterval()
     {
-        return this.failureCountInterval;
+        return failureCountInterval;
     }
+    
 
     /**
      * This optional attribute holds the number of seconds after which the password
@@ -674,6 +701,7 @@ public class PwPolicy extends FortEntity
     {
         this.failureCountInterval = failureCountInterval;
     }
+    
 
     /**
      * This optional attribute specifies with a value of "TRUE" that users must
@@ -689,8 +717,9 @@ public class PwPolicy extends FortEntity
      */
     public Boolean getMustChange()
     {
-        return this.mustChange;
+        return mustChange;
     }
+    
 
     /**
      * This optional attribute specifies with a value of "TRUE" that users must
@@ -708,6 +737,7 @@ public class PwPolicy extends FortEntity
     {
         this.mustChange = mustChange;
     }
+    
 
     /**
      * This optional attribute indicates whether users can change their own
@@ -720,8 +750,9 @@ public class PwPolicy extends FortEntity
      */
     public Boolean getAllowUserChange()
     {
-        return this.allowUserChange;
+        return allowUserChange;
     }
+    
 
     /**
      * This optional attribute indicates whether users can change their own
@@ -736,6 +767,7 @@ public class PwPolicy extends FortEntity
     {
         this.allowUserChange = allowUserChange;
     }
+    
 
     /**
      * This optional attribute specifies whether or not the existing password must be
@@ -746,8 +778,9 @@ public class PwPolicy extends FortEntity
      */
     public Boolean getSafeModify()
     {
-        return this.safeModify;
+        return safeModify;
     }
+    
 
     /**
      * This optional attribute specifies whether or not the existing password must be
@@ -760,6 +793,7 @@ public class PwPolicy extends FortEntity
     {
         this.safeModify = safeModify;
     }
+    
 
     /**
      * Matches the name from two PwPolicy entities.
@@ -769,11 +803,58 @@ public class PwPolicy extends FortEntity
      */
     public boolean equals(Object thatObj)
     {
-        if (this == thatObj) return true;
-        if (this.getName() == null) return false;
-        if (!(thatObj instanceof PwPolicy)) return false;
+        if ( this == thatObj )
+        {
+            return true;
+        }
+        
+        if ( this.getName() == null )
+        {
+            return false;
+        }
+        
+        if ( !( thatObj instanceof PwPolicy ) )
+        {
+            return false;
+        }
+        
         PwPolicy thatPolicy = (PwPolicy) thatObj;
-        if (thatPolicy.getName() == null) return false;
-        return thatPolicy.getName().equalsIgnoreCase(this.getName());
+        
+        if ( thatPolicy.getName() == null )
+        {
+            return false;
+        }
+        
+        return thatPolicy.getName().equalsIgnoreCase( this.getName() );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "PwPolicy object: \n" );
+
+        sb.append( "    attribute :" ).append( attribute ).append( '\n' );
+        sb.append( "    maxAge :" ).append( maxAge ).append( '\n' );
+        sb.append( "    minAge :" ).append( minAge ).append( '\n' );
+        sb.append( "    allowUserChange :" ).append( allowUserChange ).append( '\n' );
+        sb.append( "    checkQuality :" ).append( checkQuality ).append( '\n' );
+        sb.append( "    expireWarning :" ).append( expireWarning ).append( '\n' );
+        sb.append( "    failureCountInterval :" ).append( failureCountInterval ).append(
'\n' );
+        sb.append( "    graceLoginLimit :" ).append( graceLoginLimit ).append( '\n' );
+        sb.append( "    inHistory :" ).append( inHistory ).append( '\n' );
+        sb.append( "    lockout :" ).append( lockout ).append( '\n' );
+        sb.append( "    lockoutDuration :" ).append( lockoutDuration ).append( '\n' );
+        sb.append( "    maxFailure :" ).append( maxFailure ).append( '\n' );
+        sb.append( "    minLength :" ).append( minLength ).append( '\n' );
+        sb.append( "    mustChange :" ).append( mustChange ).append( '\n' );
+        sb.append( "    name :" ).append( name ).append( '\n' );
+        sb.append( "    safeModify :" ).append( safeModify ).append( '\n' );
+
+        return sb.toString();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/Relationship.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Relationship.java b/src/main/java/org/apache/directory/fortress/core/rbac/Relationship.java
index 4849458..cb6cdc7 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Relationship.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/Relationship.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.core.rbac;
 
+import java.io.Serializable;
 import java.lang.String;
 
 /**
@@ -28,10 +29,14 @@ import java.lang.String;
  *
  * @author Shawn McKinney
  */
-public class Relationship
-    implements java.io.Serializable
+public class Relationship implements Serializable
 {
+    private static final long serialVersionUID = 1L;
+    
+    /** The child */
     private String child;
+    
+    /** The parent */
     private String parent;
 
     /**
@@ -41,17 +46,20 @@ public class Relationship
     public Relationship()
     {
     }
+    
+    
     /**
      * Construct a new relationship given a child and parent name.
      *
      * @param child  contains the name of child.
      * @param parent contains the name of parent.
      */
-    public Relationship(String child, String parent)
+    public Relationship( String child, String parent )
     {
         this.child = child;
         this.parent = parent;
     }
+    
 
     /**
      * Return the child name.
@@ -62,16 +70,18 @@ public class Relationship
     {
         return child;
     }
+    
 
     /**
      * Set the child name.
      *
      * @param child contains the name of child.
      */
-    public void setChild(String child)
+    public void setChild( String child )
     {
         this.child = child;
     }
+    
 
     /**
      * Return the parent name.
@@ -82,16 +92,18 @@ public class Relationship
     {
         return parent;
     }
+    
 
     /**
      * Set the parent name.
      *
      * @param parent contains the name of parent.
      */
-    public void setParent(String parent)
+    public void setParent( String parent )
     {
         this.parent = parent;
     }
+    
 
     /**
      * Compute the hashcode on the parent and child values.  This is used for list processing.
@@ -102,6 +114,7 @@ public class Relationship
     {
         return child.hashCode() + parent.hashCode();
     }
+    
 
     /**
      * Matches the parent and child values from two Relationship entities.
@@ -109,25 +122,47 @@ public class Relationship
      * @param thatObj contains a Relationship entity.
      * @return boolean indicating both objects contain matching parent and child names.
      */
-    public boolean equals(Object thatObj)
+    public boolean equals (Object thatObj )
     {
-        if (this == thatObj)
+        if ( this == thatObj )
         {
             return true;
         }
-        if (this.getChild() == null || this.getParent() == null)
+        
+        if ( ( this.getChild() == null ) || ( this.getParent() == null ) )
         {
             return false;
         }
-        if (!(thatObj instanceof Relationship))
+        
+        if ( !( thatObj instanceof Relationship ) )
         {
             return false;
         }
+        
         Relationship thatKey = (Relationship) thatObj;
-        if (thatKey.getChild() == null || thatKey.getParent() == null)
+        
+        if ( ( thatKey.getChild() == null ) || ( thatKey.getParent() == null ) )
         {
             return false;
         }
-        return ((thatKey.getChild().equalsIgnoreCase(this.getChild()) && thatKey.getParent().equalsIgnoreCase(this.getParent())));
+        
+        return ( thatKey.getChild().equalsIgnoreCase( this.getChild() ) 
+                 && thatKey.getParent().equalsIgnoreCase( this.getParent() ) );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "Relationship object: \n" );
+
+        sb.append( "    parent :" ).append( parent ).append( '\n' );
+        sb.append( "    child :" ).append( child ).append( '\n' );
+
+        return sb.toString();
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/RolePerm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/RolePerm.java b/src/main/java/org/apache/directory/fortress/core/rbac/RolePerm.java
index ecb7de3..28f8f15 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/RolePerm.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/RolePerm.java
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.fortress.core.rbac;
 
+import java.io.Serializable;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -35,9 +37,10 @@ import javax.xml.bind.annotation.XmlType;
     "role",
     "perm"
 })
-public class RolePerm extends FortEntity
-    implements java.io.Serializable
+public class RolePerm extends FortEntity implements Serializable
 {
+    private static final long serialVersionUID = 1L;
+    
     private Role role;
     private Permission perm;
 
@@ -46,18 +49,37 @@ public class RolePerm extends FortEntity
         return role;
     }
 
+    
     public void setRole(Role role)
     {
         this.role = role;
     }
+    
 
     public Permission getPerm()
     {
         return perm;
     }
 
+    
     public void setPerm(Permission perm)
     {
         this.perm = perm;
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "RolePerm object: \n" );
+
+        sb.append( "    role :" ).append( role ).append( '\n' );
+        sb.append( "    perm :" ).append( perm ).append( '\n' );
+
+        return sb.toString();
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/RoleRelationship.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/RoleRelationship.java b/src/main/java/org/apache/directory/fortress/core/rbac/RoleRelationship.java
index 626beb2..d5b0b5e 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/RoleRelationship.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/RoleRelationship.java
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.fortress.core.rbac;
 
+import java.io.Serializable;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -35,9 +37,9 @@ import javax.xml.bind.annotation.XmlType;
     "child",
     "parent"
 })
-public class RoleRelationship extends FortEntity
-    implements java.io.Serializable
+public class RoleRelationship extends FortEntity implements Serializable
 {
+    private static final long serialVersionUID = 1L;
     private Role parent;
     private Role child;
 
@@ -46,18 +48,37 @@ public class RoleRelationship extends FortEntity
         return parent;
     }
 
+    
     public void setParent(Role parent)
     {
         this.parent = parent;
     }
 
+    
     public Role getChild()
     {
         return child;
     }
 
+    
     public void setChild(Role child)
     {
         this.child = child;
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "RoleRelationship object: \n" );
+
+        sb.append( "    parent :" ).append( parent ).append( '\n' );
+        sb.append( "    child :" ).append( child ).append( '\n' );
+
+        return sb.toString();
+    }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/Session.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Session.java b/src/main/java/org/apache/directory/fortress/core/rbac/Session.java
index 3e95094..1bca586 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Session.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/Session.java
@@ -24,6 +24,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
@@ -160,8 +162,9 @@ import java.util.UUID;
     "warnings"
 /*    "warningId"*/
 })
-public class Session  extends FortEntity implements PwMessage, java.io.Serializable
+public class Session  extends FortEntity implements PwMessage, Serializable
 {
+    private static final long serialVersionUID = 1L;
     private User user;
     private String sessionId;
     private long lastAccess;
@@ -184,6 +187,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         return isAuthenticated;
     }
+    
 
     private void init()
     {
@@ -191,13 +195,14 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
         UUID uuid = UUID.randomUUID();
         this.sessionId = uuid.toString();
     }
+    
 
     /**
      * Copy values from incoming Session object.
      *
      * @param inSession contains Session values.
      */
-    public void copy(Session inSession)
+    public void copy( Session inSession )
     {
         this.user = inSession.getUser();
         // don't copy session id:
@@ -212,6 +217,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
         this.message = inSession.getMsg();
         this.warnings = inSession.getWarnings();
     }
+    
 
     /**
      * Default constructor for Fortress Session.
@@ -220,30 +226,33 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         init();
         // this class will not check for null on user object.
-        this.user = new User();
+        user = new User();
     }
+    
 
     /**
      * Construct a new Session instance with given User entity.
      *
      * @param user contains the User attributes that are associated with the Session.
      */
-    public Session(User user)
+    public Session( User user )
     {
         init();
         this.user = user;
     }
+    
 
     /**
      * Construct a new Session instance with given User entity.
      *
      * @param user contains the User attributes that are associated with the Session.
      */
-    public Session(User user, String sessionId)
+    public Session (User user, String sessionId )
     {
         this.sessionId = sessionId;
         this.user = user;
     }
+    
 
     /**
      * Return the unique id that is associated with User.  This attribute is generated automatically
@@ -253,7 +262,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public String getSessionId()
     {
-        return this.sessionId;
+        return sessionId;
     }
 
 
@@ -310,6 +319,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         return this.user;
     }
+    
 
     /**
      * Return the userId that is associated with this Session object.
@@ -320,6 +330,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         return this.user.getUserId();
     }
+    
 
     /**
      * Return the internal userId that is associated with User.  This attribute is generated
automatically
@@ -331,6 +342,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         return this.user.getInternalId();
     }
+    
 
     /**
      * Return the list of User's RBAC Roles that have been activated into User's session.
 This list will not include
@@ -342,11 +354,14 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         List<UserRole> roles = null;
 
-        if (user != null)
+        if ( user != null )
+        {
             roles = user.getRoles();
+        }
 
         return roles;
     }
+    
 
     /**
      * Return a list of User's Admin Roles  that have been activated into User's session.
 This list will not include
@@ -358,8 +373,10 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         List<UserAdminRole> roles = null;
 
-        if (user != null)
+        if ( user != null )
+        {
             roles = user.getAdminRoles();
+        }
 
         return roles;
     }
@@ -373,8 +390,9 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public long getLastAccess()
     {
-        return this.lastAccess;
+        return lastAccess;
     }
+    
 
     /**
      * Gets the message that is associated with the user's last authentication attempt.
@@ -383,8 +401,9 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public String getMsg()
     {
-        return this.message;
+        return message;
     }
+    
 
     /**
      * Gets the attribute that specifies the number of times an expired password can
@@ -394,8 +413,9 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public int getGraceLogins()
     {
-        return this.graceLogins;
+        return graceLogins;
     }
+    
 
     /**
      * This attribute specifies the maximum number of seconds before a
@@ -410,8 +430,9 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public int getExpirationSeconds()
     {
-        return this.expirationSeconds;
+        return expirationSeconds;
     }
+    
 
     /**
      * Get the integer timeout that contains max time (in seconds) that User's session may
remain inactive.
@@ -421,8 +442,9 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     private int getTimeout()
     {
-        return this.timeout;
+        return timeout;
     }
+    
 
     /**
      * Get the value that will be set to 'true' if user has successfully authenticated with
Fortress for this Session.  This value is set by
@@ -432,8 +454,9 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public boolean setAuthenticated()
     {
-        return this.isAuthenticated;
+        return isAuthenticated;
     }
+    
 
     /**
      * Return the error id that is associated with the password policy checks.  a '0' indicates
no errors.
@@ -457,9 +480,10 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public int getErrorId()
     {
-        return this.errorId;
+        return errorId;
     }
 
+    
     /**
      * Set a User entity into the Session.
      * Sample User data contained in Session object:
@@ -508,10 +532,11 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      * <p/>
      * @param user Contains userId, roles and other security attributes used for access control.
      */
-    public void setUser(User user)
+    public void setUser( User user )
     {
         this.user = user;
     }
+    
 
     /**
      * Set the internal userId that is associated with User.  This method is used by DAO
class and
@@ -520,10 +545,11 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      *
      * @param internalUserId maps to 'ftId' in 'ftUserAttrs' object class.
      */
-    public void setInternalUserId(String internalUserId)
+    public void setInternalUserId( String internalUserId )
     {
-        this.user.setInternalId(internalUserId);
+        this.user.setInternalId( internalUserId );
     }
+    
 
     /**
      * Set the value to 'true' indicating that user has successfully authenticated with Fortress.
 This value is set by
@@ -531,19 +557,20 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      *
      * @param authenticated indicates result of authentication.
      */
-    public void setAuthenticated(boolean authenticated)
+    public void setAuthenticated( boolean authenticated )
     {
         isAuthenticated = authenticated;
     }
+    
 
     /**
      * Set the userId that is associated with User.  UserId is required attribute and must
be set on add, update, delete, createSession, authenticate, etc..
      *
      * @param userId maps to 'uid' attribute in 'inNetOrgPerson' object class.
      */
-    public void setUserId(String userId)
+    public void setUserId( String userId )
     {
-        this.user.setUserId(userId);
+        user.setUserId( userId );
     }
 
 
@@ -552,20 +579,22 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      *
      * @param roles List of type UserRole that contains at minimum UserId and Role name.
      */
-    public void setRoles(List<UserRole> roles)
+    public void setRoles( List<UserRole> roles )
     {
-        this.user.setRoles(roles);
+        user.setRoles( roles );
     }
+    
 
     /**
      * Add a single user-role object to the list of UserRoles for User.
      *
      * @param role UserRole contains at least userId and role name (activation) and additional
constraints (assignment)
      */
-    public void setRole(UserRole role)
+    public void setRole( UserRole role )
     {
-        user.setRole(role);
+        user.setRole( role );
     }
+    
 
     /**
      * Set the integer timeout that contains max time (in seconds) that User's session may
remain inactive.
@@ -577,6 +606,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         this.timeout = timeout;
     }
+    
 
     /**
      * Set the last access time in milliseconds. Note that while the unit of time of the
return value is a millisecond,
@@ -585,18 +615,20 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      */
     public void setLastAccess()
     {
-        this.lastAccess = System.currentTimeMillis();
+        lastAccess = System.currentTimeMillis();
     }
+    
 
     /**
      * Set the message that is associated with the user's last authentication attempt.
      *
      * @param message Contains text explaining result of user's last authentication.
      */
-    public void setMsg(String message)
+    public void setMsg( String message )
     {
         this.message = message;
     }
+    
 
     /**
      * Set the error id that is associated with the password policy checks.  a '0' indicates
no errors.
@@ -618,10 +650,11 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      *
      * @param error contains the error id that was generated on the user's last authentication.
      */
-    public void setErrorId(int error)
+    public void setErrorId( int error )
     {
         this.errorId = error;
     }
+    
 
     /**
      * This attribute specifies the number of times an expired password can
@@ -629,10 +662,11 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      *
      * @param grace The number of logins the user has left before password fails.
      */
-    public void setGraceLogins(int grace)
+    public void setGraceLogins( int grace )
     {
         this.graceLogins = grace;
     }
+    
 
     /**
      * This attribute specifies the maximum number of seconds before a
@@ -645,10 +679,11 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
      *
      * @param expire attribute is computed based on last time user has changed their password.
      */
-    public void setExpirationSeconds(int expire)
+    public void setExpirationSeconds( int expire )
     {
         this.expirationSeconds = expire;
     }
+    
 
     /**
      * Get the warnings attached to this Session.  Used for processing password policy scenarios,
e.g.. password expiring message.
@@ -659,6 +694,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         return warnings;
     }
+    
 
     /**
      * Set the warnings on this Session.  Used for processing password policy scenarios,
e.g.. password expiring message.
@@ -670,6 +706,7 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         this.warnings = warnings;
     }
+    
 
     /**
      * Add a warning to the collection into Fortress Session object.  Used for processing
password policy scenarios, e.g.. password expiring message.
@@ -681,8 +718,55 @@ public class Session  extends FortEntity implements PwMessage, java.io.Serializa
     {
         if ( warnings == null )
         {
-            warnings = new ArrayList<>();
+            warnings = new ArrayList<Warning>();
         }
+        
         this.warnings.add( warning );
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "Session object: \n" );
+
+        sb.append( "    sessionId :" ).append( sessionId ).append( '\n' );
+        sb.append( "    user :" ).append( user ).append( '\n' );
+        sb.append( "    isAuthenticated :" ).append( isAuthenticated ).append( '\n' );
+        sb.append( "    lastAccess :" ).append( lastAccess ).append( '\n' );
+        sb.append( "    timeout :" ).append( timeout ).append( '\n' );
+        sb.append( "    graceLogins :" ).append( graceLogins ).append( '\n' );
+        sb.append( "    expirationSeconds :" ).append( expirationSeconds ).append( '\n' );
+        sb.append( "    errorId :" ).append( errorId ).append( '\n' );
+        sb.append( "    message :" ).append( message ).append( '\n' );
+
+        if ( warnings != null )
+        {
+            sb.append( "    warnings : " );
+
+            boolean isFirst = true;
+
+            for ( Warning warning : warnings )
+            {
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( ", " );
+                }
+
+                sb.append( warning );
+            }
+
+            sb.append( '\n' );
+        }
+
+        return sb.toString();
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java
index bd619e0..7d7913a 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/UserRole.java
@@ -20,6 +20,7 @@
 package org.apache.directory.fortress.core.rbac;
 
 
+import java.io.Serializable;
 import java.util.Set;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -78,8 +79,10 @@ import org.apache.directory.fortress.core.util.time.Constraint;
 @XmlType( name = "userRole", propOrder = {"name", "userId", "parents", "beginDate", "beginLockDate",
"beginTime",
     "dayMask", "endDate", "endLockDate", "endTime", "timeout"} )
 @XmlSeeAlso( {UserAdminRole.class} )
-public class UserRole extends FortEntity implements java.io.Serializable, Constraint
+public class UserRole extends FortEntity implements Serializable, Constraint
 {
+    private static final long serialVersionUID = 1L;
+    
     protected String userId;
     protected String name;
     private Integer timeout;
@@ -269,17 +272,6 @@ public class UserRole extends FortEntity implements java.io.Serializable,
Constr
 
 
     /**
-     * Used to retrieve UserRole Role name attribute.  The Fortress UserRole name maps to
'ftRA' attribute on
-     * 'ftUserAttrs' object class.
-     */
-    @Override
-    public String toString()
-    {
-        return name;
-    }
-
-
-    /**
      * Return the userId that is associated with UserRole.  UserId is required attribute
and must be set on all
      * UserRole assignment operations.
      *
@@ -615,4 +607,15 @@ public class UserRole extends FortEntity implements java.io.Serializable,
Constr
 
         return ( thatRole.getName().equalsIgnoreCase( name ) );
     }
+
+
+    /**
+     * Used to retrieve UserRole Role name attribute.  The Fortress UserRole name maps to
'ftRA' attribute on
+     * 'ftUserAttrs' object class.
+     */
+    @Override
+    public String toString()
+    {
+        return name;
+    }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/08ea401b/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java b/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
index b6a8d2f..0f37245 100644
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/Warning.java
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlEnum;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
+
 import java.io.Serializable;
 
 /**
@@ -34,7 +35,8 @@ import java.io.Serializable;
  * @author Shawn McKinney
  */
 /**
- * This entity is stored on {@link org.apache.directory.fortress.core.rbac.Session} and is
used to pass warnings that occur during role activation and password policy validation.
+ * This entity is stored on {@link org.apache.directory.fortress.core.rbac.Session} and is
used to pass warnings 
+ * that occur during role activation and password policy validation.
  * <p/>
  * Contains data from event that occurs during session initialization:
  * <p/>
@@ -60,9 +62,16 @@ import java.io.Serializable;
     })
 public class Warning implements Serializable
 {
+    private static final long serialVersionUID = 1L;
+    private int id;
+    private String msg;
+    private String name;
+    private Type type;
+
     public Warning()
     {
     }
+    
 
     /**
      *
@@ -70,12 +79,13 @@ public class Warning implements Serializable
      * @param msg
      * @param type
      */
-    public Warning(int id, String msg, Type type)
+    public Warning( int id, String msg, Type type )
     {
         this.id = id;
         this.msg = msg;
         this.type = type;
     }
+    
 
     /**
      *
@@ -84,13 +94,14 @@ public class Warning implements Serializable
      * @param type
      * @param name
      */
-    public Warning(int id, String msg, Type type, String name)
+    public Warning( int id, String msg, Type type, String name )
     {
         this.id = id;
         this.msg = msg;
         this.name = name;
         this.type = type;
     }
+    
 
     /**
      * Type determines if warning is of type Role or Password Policy.
@@ -109,11 +120,7 @@ public class Warning implements Serializable
          */
         PASSWORD
     }
-
-    private int id;
-    private String msg;
-    private String name;
-    private Type type;
+    
 
     public int getId()
     {
@@ -124,16 +131,19 @@ public class Warning implements Serializable
     {
         this.id = id;
     }
+    
 
     public String getMsg()
     {
         return msg;
     }
+    
 
     public void setMsg( String msg )
     {
         this.msg = msg;
     }
+    
 
     public String getName()
     {
@@ -144,14 +154,34 @@ public class Warning implements Serializable
     {
         this.name = name;
     }
+    
 
     public Type getType()
     {
         return type;
     }
+    
 
     public void setType( Type type )
     {
         this.type = type;
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "Warning object: \n" );
+
+        sb.append( "    id :" ).append( id ).append( '\n' );
+        sb.append( "    name :" ).append( name ).append( '\n' );
+        sb.append( "    type :" ).append( type ).append( '\n' );
+        sb.append( "    msg :" ).append( msg ).append( '\n' );
+
+        return sb.toString();
+    }
 }
\ No newline at end of file


Mime
View raw message