directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [17/20] git commit: Formlatting the code
Date Wed, 05 Nov 2014 17:33:24 GMT
Formlatting the code

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/123e9187
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/123e9187
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/123e9187

Branch: refs/heads/master
Commit: 123e9187ba9df4ed495a30ae7fcb0909ed7a22ef
Parents: 7e417f4
Author: Emmanuel L├ęcharny <elecharny@symas.com>
Authored: Wed Nov 5 18:24:13 2014 +0100
Committer: Emmanuel L├ęcharny <elecharny@symas.com>
Committed: Wed Nov 5 18:24:13 2014 +0100

----------------------------------------------------------------------
 .../directory/fortress/core/rbac/Role.java      | 1151 +++++++++---------
 1 file changed, 580 insertions(+), 571 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/123e9187/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Role.java b/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
index 8651808..f974266 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
@@ -189,608 +189,617 @@ import org.apache.directory.fortress.core.util.time.Constraint;
     {
         AdminRole.class
 })
-public class Role extends FortEntity
-implements Constraint, Graphable, java.io.Serializable
-{
-private String id; // this maps to ftId
-private String name; // this is ftRoleName
-private String description; // this is description
-@XmlTransient
-private String dn; // this attribute is automatically saved to each ldap record.
-@XmlTransient
-private List<String> occupants;
-private Set<String> parents;
-private Set<String> children;
-private String beginTime; // this attribute is ftCstr
-private String endTime; // this attribute is ftCstr
-private String beginDate; // this attribute is ftCstr
-private String endDate; // this attribute is ftCstr
-private String beginLockDate;// this attribute is ftCstr
-private String endLockDate; // this attribute is ftCstr
-private String dayMask; // this attribute is ftCstr
-private int timeout; // this attribute is ftCstr
-
-
-/**
- * Default constructor is used by internal Fortress classes.
- */
-public Role()
-{
-}
-
-
-/**
- * Construct a Role entity with a given name.
- *
- * @param name maps to 'cn' attribute on 'organizationalrole' object class.
- */
-public Role( String name )
-{
-    this.name = name;
-}
-
-
-/**
- * Construct an RBAC Role with a given temporal constraint.
- *
- * @param con maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-public Role( Constraint con )
-{
-    CUtil.copy( con, this );
-}
-
-
-/**
- * Required on DAO classes convert Temporal attributes stored on entity to raw data object
format needed for ldap.  For internal use only.
- *
- * @return String that maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-public String getRawData()
-{
-    return rawData;
-}
-
-
-/**
- * Required on DAO classes convert Temporal from raw ldap data to entity attributes.  For
internal use only.
- *
- * @param rawData maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-public void setRawData( String rawData )
-{
-    this.rawData = rawData;
-}
-
-private String rawData;
-
-
-/**
- * Gets the name required attribute of the Role object
- *
- * @return attribute maps to 'cn' attribute on 'organizationalrole' object class.
- */
-public String getName()
-{
-    return name;
-}
-
-
-/**
- * Sets the required name attribute on the Role object
- *
- */
-public void setName( String name )
-{
-    this.name = name;
-}
-
-
-/**
- * Set the occupant attribute with the contents of the User dn.
- * @param occupant maps to 'roleOccupant' attribute on 'organizationalrole' object class.
- */
-public void setOccupant( String occupant )
-{
-    if ( this.occupants == null )
+public class Role extends FortEntity implements Constraint, Graphable, java.io.Serializable
+{
+    private static final long serialVersionUID = 1L;
+    private String id; // this maps to ftId
+    private String name; // this is ftRoleName
+    private String description; // this is description
+    @XmlTransient
+    private String dn; // this attribute is automatically saved to each ldap record.
+    @XmlTransient
+    private List<String> occupants;
+    private Set<String> parents;
+    private Set<String> children;
+    private String beginTime; // this attribute is ftCstr
+    private String endTime; // this attribute is ftCstr
+    private String beginDate; // this attribute is ftCstr
+    private String endDate; // this attribute is ftCstr
+    private String beginLockDate;// this attribute is ftCstr
+    private String endLockDate; // this attribute is ftCstr
+    private String dayMask; // this attribute is ftCstr
+    private int timeout; // this attribute is ftCstr
+    
+    
+    /**
+     * Default constructor is used by internal Fortress classes.
+     */
+    public Role()
     {
-        this.occupants = new ArrayList<>();
     }
-    this.occupants.add( occupant );
-}
-
-
-/**
- * Return list of occupants for a particular Role entity.
- * @return List of type String containing User dn that maps to 'roleOccupant' attribute on
'organizationalrole' object class.
- */
-public List<String> getOccupants()
-{
-    return occupants;
-}
-
-
-/**
- * Set a list of occupants for a particular Role entity.
- * @param occupants contains a List of type String which maps to 'roleOccupant' attribute
on 'organizationalrole' object class.
- */
-public void setOccupants( List<String> occupants )
-{
-    this.occupants = occupants;
-}
-
-
-/**
- * Returns optional description that is associated with Role.  This attribute is validated
but not constrained by Fortress.
- *
- * @return value that is mapped to 'description' in 'organizationalrole' object class.
- */
-public String getDescription()
-{
-    return this.description;
-}
-
-
-/**
- * Sets the optional description that is associated with Role.  This attribute is validated
but not constrained by Fortress.
- *
- * @param description that is mapped to same name in 'organizationalrole' object class.
- */
-public void setDescription( String description )
-{
-    this.description = description;
-}
-
-
-/**
- * Return the internal id that is associated with Role.  This attribute is generated automatically
- * by Fortress when new Role is added to directory and is not known or changeable by external
client.
- *
- * @return attribute maps to 'ftId' in 'ftRls' object class.
- */
-public String getId()
-{
-    return id;
-}
-
-
-/**
- * Generate an internal Id that is associated with Role.  This method is used by DAO class
and
- * is not available to outside classes.   The generated attribute maps to 'ftId' in 'ftRls'
object class.
- */
-public void setId()
-{
-    // generate a unique id that will be used as the rDn for this entry:
-    UUID uuid = UUID.randomUUID();
-    this.id = uuid.toString();
-}
-
-
-/**
- * Set the internal Id that is associated with Role.  This method is used by DAO class and
- * is generated automatically by Fortress.  Attribute stored in LDAP cannot be changed by
external caller.
- * This method can be used by client for search purposes only.
- *
- * @param id maps to 'ftId' in 'ftRls' object class.
- */
-public void setId( String id )
-{
-    this.id = id;
-}
-
-
-/**
- * temporal boolean flag is used by internal Fortress components.
- *
- * @return boolean indicating if temporal constraints are placed on Role.
- */
-@Override
-public boolean isTemporalSet()
-{
-    return ( beginTime != null || endTime != null || beginDate != null || endDate != null
|| beginLockDate != null
-        || endLockDate != null || dayMask != null );
-}
-
-
-/**
- * Contains the begin time of day Role is allowed to be activated in session.  The format
is military time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getBeginTime()
-{
-    return this.beginTime;
-}
-
-
-/**
- * Set the begin time of day Role is allowed to be activated in session.  The format is military
time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginTime maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setBeginTime( String beginTime )
-{
-    this.beginTime = beginTime;
-}
-
-
-/**
- * Contains the end time of day Role is allowed to be activated in session.  The format is
military time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getEndTime()
-{
-    return this.endTime;
-}
-
-
-/**
- * Set the end time of day Role is allowed to be activated in session.  The format is military
time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endTime maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setEndTime( String endTime )
-{
-    this.endTime = endTime;
-}
-
-
-/**
- * Contains the begin date when Role is allowed to be activated in session.  The format is
- YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getBeginDate()
-{
-    return this.beginDate;
-}
-
-
-/**
- * Set the beginDate when Role is allowed to be activated in session.  The format is - YYYYMMDD,
i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setBeginDate( String beginDate )
-{
-    this.beginDate = beginDate;
-}
-
-
-/**
- * Contains the end date when Role is allowed to be activated in session.  The format is
- YYYYMMDD, i.e. 20101231 (December 31, 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getEndDate()
-{
-    return this.endDate;
-}
-
-
-/**
- * Set the end date when Role is not allowed to be activated in session.  The format is -
YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setEndDate( String endDate )
-{
-    this.endDate = endDate;
-}
-
-
-/**
- * Contains the begin lock date when Role is temporarily not allowed to be activated in session.
 The format is - YYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getBeginLockDate()
-{
-    return this.beginLockDate;
-}
-
-
-/**
- * Set the begin lock date when Role is temporarily not allowed to be activated in session.
 The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setBeginLockDate( String beginLockDate )
-{
-    this.beginLockDate = beginLockDate;
-}
-
-
-/**
- * Contains the end lock date when Role is allowed to be activated in session once again.
 The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getEndLockDate()
-{
-    return this.endLockDate;
-}
-
-
-/**
- * Set the end lock date when Role is allowed to be activated in session once again.  The
format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setEndLockDate( String endLockDate )
-{
-    this.endLockDate = endLockDate;
-}
-
-
-/**
- * Get the daymask that indicates what days of week Role is allowed to be activated in session.
 The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getDayMask()
-{
-    return this.dayMask;
-}
-
-
-/**
- * Set the daymask that specifies what days of week Role is allowed to be activated in session.
 The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param dayMask maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setDayMask( String dayMask )
-{
-    this.dayMask = dayMask;
-}
-
-
-/**
- * Return the integer timeout that contains total time (in seconds) that Role may remain
inactive in User's session before it is deactivated.
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return int maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public Integer getTimeout()
-{
-    return this.timeout;
-}
-
-
-/**
- * Set the integer timeout that contains max time (in seconds) that Role may remain inactive
in User's session before it is deactivated.
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param timeout maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setTimeout( Integer timeout )
-{
-    this.timeout = timeout;
-}
-
-
-/**
- * Get the names of roles that are parents (direct ascendants) of this role.
- * @return Set of parent role names assigned to this role.
- */
-@Override
-public Set<String> getParents()
-{
-    if ( this.parents == null )
+    
+    
+    /**
+     * Construct a Role entity with a given name.
+     *
+     * @param name maps to 'cn' attribute on 'organizationalrole' object class.
+     */
+    public Role( String name )
     {
-        this.parents = new HashSet<>();
+        this.name = name;
     }
-    return parents;
-}
-
-
-/**
- * Set the names of roles names that are parents (direct ascendants) of this role.
- * @param parents contains the Set of parent role names assigned to this role.
- */
-@Override
-public void setParents( Set<String> parents )
-{
-    this.parents = parents;
-}
-
-
-/**
- * Set the occupant attribute with the contents of the User dn.
- * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
- */
-@Override
-public void setParent( String parent )
-{
-    if ( this.parents == null )
+    
+    
+    /**
+     * Construct an RBAC Role with a given temporal constraint.
+     *
+     * @param con maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    public Role( Constraint con )
     {
-        this.parents = new HashSet<>();
+        CUtil.copy( con, this );
     }
-    this.parents.add( parent );
-}
-
-
-/**
- * Set the occupant attribute with the contents of the User dn.
- * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
- */
-@Override
-public void delParent( String parent )
-{
-    if ( this.parents != null )
+    
+    
+    /**
+     * Required on DAO classes convert Temporal attributes stored on entity to raw data object
format needed for ldap.  For internal use only.
+     *
+     * @return String that maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    public String getRawData()
     {
-        this.parents.remove( parent );
+        return rawData;
     }
-}
-
-
-/**
- * Return the Set of child role names (direct descendants) of this role.
- * @return Set of child role names assigned to this role.
- */
-public Set<String> getChildren()
-{
-    return children;
-}
-
-
-/**
- * Set the Set of child role names (direct descendants) of this role
- * @param children contains the Set of child role names assigned to this role.
- */
-public void setChildren( Set<String> children )
-{
-    this.children = children;
-}
-
-
-/**
- * Matches the name from two Role entities.
- *
- * @param thatObj contains a Role entity.
- * @return boolean indicating both objects contain matching Role names.
- */
-public boolean equals( Object thatObj )
-{
-    if ( this == thatObj )
+    
+    
+    /**
+     * Required on DAO classes convert Temporal from raw ldap data to entity attributes.
 For internal use only.
+     *
+     * @param rawData maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    public void setRawData( String rawData )
     {
-        return true;
+        this.rawData = rawData;
     }
-
-    if ( name == null )
+    
+    private String rawData;
+    
+    
+    /**
+     * Gets the name required attribute of the Role object
+     *
+     * @return attribute maps to 'cn' attribute on 'organizationalrole' object class.
+     */
+    public String getName()
     {
-        return false;
+        return name;
     }
-
-    if ( !( thatObj instanceof Role ) )
+    
+    
+    /**
+     * Sets the required name attribute on the Role object
+     *
+     */
+    public void setName( String name )
     {
-        return false;
+        this.name = name;
     }
-
-    Role thatRole = ( Role ) thatObj;
-
-    if ( thatRole.getName() == null )
+    
+    
+    /**
+     * Set the occupant attribute with the contents of the User dn.
+     * @param occupant maps to 'roleOccupant' attribute on 'organizationalrole' object class.
+     */
+    public void setOccupant( String occupant )
     {
-        return false;
+        if ( this.occupants == null )
+        {
+            this.occupants = new ArrayList<>();
+        }
+        this.occupants.add( occupant );
     }
-
-    return thatRole.getName().equalsIgnoreCase( name );
-}
-
-
-/**
- * @see Object#toString()
- */
-public String toString()
-{
-    StringBuilder sb = new StringBuilder();
-
-    sb.append( "Role[" );
-
-    // The name
-    sb.append( name ).append( ", " );
-
-    if ( ( description != null ) && ( description.length() > 0 ) )
+    
+    
+    /**
+     * Return list of occupants for a particular Role entity.
+     * @return List of type String containing User dn that maps to 'roleOccupant' attribute
on 'organizationalrole' object class.
+     */
+    public List<String> getOccupants()
     {
-        sb.append( description ).append( ", " );
+        return occupants;
     }
-
-    // the date
-    sb.append( "date : <" ).append( beginDate ).append( ", " ).append( endDate ).append(
">, " );
-
-    // The time
-    sb.append( "time : <" ).append( beginTime ).append( ", " ).append( endTime ).append(
">, " );
-
-    // The lock date
-    sb.append( "lock date : <" ).append( beginLockDate ).append( ", " ).append( endLockDate
).append( ">, " );
-
-    // The timeout
-    sb.append( "timeout : " ).append( timeout ).append( ", " );
-
-    // The day mask
-    sb.append( "daymask : " ).append( dayMask );
-
-    // The parents if any
-    if ( ( parents != null ) && ( parents.size() > 0 ) )
+    
+    
+    /**
+     * Set a list of occupants for a particular Role entity.
+     * @param occupants contains a List of type String which maps to 'roleOccupant' attribute
on 'organizationalrole' object class.
+     */
+    public void setOccupants( List<String> occupants )
+    {
+        this.occupants = occupants;
+    }
+    
+    
+    /**
+     * Returns optional description that is associated with Role.  This attribute is validated
but not constrained by Fortress.
+     *
+     * @return value that is mapped to 'description' in 'organizationalrole' object class.
+     */
+    public String getDescription()
+    {
+        return this.description;
+    }
+    
+    
+    /**
+     * Sets the optional description that is associated with Role.  This attribute is validated
but not constrained by Fortress.
+     *
+     * @param description that is mapped to same name in 'organizationalrole' object class.
+     */
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+    
+    
+    /**
+     * Return the internal id that is associated with Role.  This attribute is generated
automatically
+     * by Fortress when new Role is added to directory and is not known or changeable by
external client.
+     *
+     * @return attribute maps to 'ftId' in 'ftRls' object class.
+     */
+    public String getId()
+    {
+        return id;
+    }
+    
+    
+    /**
+     * Generate an internal Id that is associated with Role.  This method is used by DAO
class and
+     * is not available to outside classes.   The generated attribute maps to 'ftId' in 'ftRls'
object class.
+     */
+    public void setId()
+    {
+        // generate a unique id that will be used as the rDn for this entry:
+        UUID uuid = UUID.randomUUID();
+        this.id = uuid.toString();
+    }
+    
+    
+    /**
+     * Set the internal Id that is associated with Role.  This method is used by DAO class
and
+     * is generated automatically by Fortress.  Attribute stored in LDAP cannot be changed
by external caller.
+     * This method can be used by client for search purposes only.
+     *
+     * @param id maps to 'ftId' in 'ftRls' object class.
+     */
+    public void setId( String id )
     {
-        sb.append( ", parents : {" );
+        this.id = id;
+    }
 
-        boolean isFirst = true;
 
-        for ( String parent : parents )
+    /**
+     * temporal boolean flag is used by internal Fortress components.
+     *
+     * @return boolean indicating if temporal constraints are placed on Role.
+     */
+    @Override
+    public boolean isTemporalSet()
+    {
+        return ( beginTime != null || endTime != null || beginDate != null || endDate !=
null || beginLockDate != null
+            || endLockDate != null || dayMask != null );
+    }
+    
+    
+    /**
+     * Contains the begin time of day Role is allowed to be activated in session.  The format
is military time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getBeginTime()
+    {
+        return this.beginTime;
+    }
+    
+    
+    /**
+     * Set the begin time of day Role is allowed to be activated in session.  The format
is military time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param beginTime maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setBeginTime( String beginTime )
+    {
+        this.beginTime = beginTime;
+    }
+    
+    
+    /**
+     * Contains the end time of day Role is allowed to be activated in session.  The format
is military time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getEndTime()
+    {
+        return this.endTime;
+    }
+    
+    
+    /**
+     * Set the end time of day Role is allowed to be activated in session.  The format is
military time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param endTime maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setEndTime( String endTime )
+    {
+        this.endTime = endTime;
+    }
+    
+    
+    /**
+     * Contains the begin date when Role is allowed to be activated in session.  The format
is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getBeginDate()
+    {
+        return this.beginDate;
+    }
+    
+    
+    /**
+     * Set the beginDate when Role is allowed to be activated in session.  The format is
- YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param beginDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setBeginDate( String beginDate )
+    {
+        this.beginDate = beginDate;
+    }
+    
+    
+    /**
+     * Contains the end date when Role is allowed to be activated in session.  The format
is - YYYYMMDD, i.e. 20101231 (December 31, 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getEndDate()
+    {
+        return this.endDate;
+    }
+    
+    
+    /**
+     * Set the end date when Role is not allowed to be activated in session.  The format
is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param endDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+    
+    
+    /**
+     * Contains the begin lock date when Role is temporarily not allowed to be activated
in session.  The format is - YYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getBeginLockDate()
+    {
+        return this.beginLockDate;
+    }
+    
+    
+    /**
+     * Set the begin lock date when Role is temporarily not allowed to be activated in session.
 The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param beginLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setBeginLockDate( String beginLockDate )
+    {
+        this.beginLockDate = beginLockDate;
+    }
+    
+    
+    /**
+     * Contains the end lock date when Role is allowed to be activated in session once again.
 The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getEndLockDate()
+    {
+        return this.endLockDate;
+    }
+    
+    
+    /**
+     * Set the end lock date when Role is allowed to be activated in session once again.
 The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param endLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setEndLockDate( String endLockDate )
+    {
+        this.endLockDate = endLockDate;
+    }
+    
+    
+    /**
+     * Get the daymask that indicates what days of week Role is allowed to be activated in
session.  The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getDayMask()
+    {
+        return this.dayMask;
+    }
+    
+    
+    /**
+     * Set the daymask that specifies what days of week Role is allowed to be activated in
session.  The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param dayMask maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setDayMask( String dayMask )
+    {
+        this.dayMask = dayMask;
+    }
+    
+    
+    /**
+     * Return the integer timeout that contains total time (in seconds) that Role may remain
inactive in User's session before it is deactivated.
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return int maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public Integer getTimeout()
+    {
+        return this.timeout;
+    }
+    
+    
+    /**
+     * Set the integer timeout that contains max time (in seconds) that Role may remain inactive
in User's session before it is deactivated.
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param timeout maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setTimeout( Integer timeout )
+    {
+        this.timeout = timeout;
+    }
+    
+    
+    /**
+     * Get the names of roles that are parents (direct ascendants) of this role.
+     * @return Set of parent role names assigned to this role.
+     */
+    @Override
+    public Set<String> getParents()
+    {
+        if ( this.parents == null )
         {
-            if ( isFirst )
-            {
-                isFirst = false;
-            }
-            else
-            {
-                sb.append( '|' );
-            }
-
-            sb.append( parent );
+            this.parents = new HashSet<>();
         }
-
-        sb.append( '}' );
+        return parents;
     }
-
-    // The children if any
-    if ( ( children != null ) && ( children.size() > 0 ) )
+    
+    
+    /**
+     * Set the names of roles names that are parents (direct ascendants) of this role.
+     * @param parents contains the Set of parent role names assigned to this role.
+     */
+    @Override
+    public void setParents( Set<String> parents )
     {
-        sb.append( ", children : {" );
-
-        boolean isFirst = true;
-
-        for ( String child : children )
+        this.parents = parents;
+    }
+    
+    
+    /**
+     * Set the occupant attribute with the contents of the User dn.
+     * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
+     */
+    @Override
+    public void setParent( String parent )
+    {
+        if ( this.parents == null )
+        {
+            this.parents = new HashSet<>();
+        }
+        this.parents.add( parent );
+    }
+    
+    
+    /**
+     * Set the occupant attribute with the contents of the User dn.
+     * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
+     */
+    @Override
+    public void delParent( String parent )
+    {
+        if ( this.parents != null )
+        {
+            this.parents.remove( parent );
+        }
+    }
+    
+    
+    /**
+     * Return the Set of child role names (direct descendants) of this role.
+     * @return Set of child role names assigned to this role.
+     */
+    public Set<String> getChildren()
+    {
+        return children;
+    }
+    
+    
+    /**
+     * Set the Set of child role names (direct descendants) of this role
+     * @param children contains the Set of child role names assigned to this role.
+     */
+    public void setChildren( Set<String> children )
+    {
+        this.children = children;
+    }
+    
+    
+    /**
+     * Matches the name from two Role entities.
+     *
+     * @param thatObj contains a Role entity.
+     * @return boolean indicating both objects contain matching Role names.
+     */
+    public boolean equals( Object thatObj )
+    {
+        if ( this == thatObj )
+        {
+            return true;
+        }
+    
+        if ( name == null )
         {
-            if ( isFirst )
+            return false;
+        }
+    
+        if ( !( thatObj instanceof Role ) )
+        {
+            return false;
+        }
+    
+        Role thatRole = ( Role ) thatObj;
+    
+        if ( thatRole.getName() == null )
+        {
+            return false;
+        }
+    
+        return thatRole.getName().equalsIgnoreCase( name );
+    }
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    protected String toString( String tabs )
+    {
+        StringBuilder sb = new StringBuilder();
+    
+        sb.append( tabs ).append( "Role[" );
+    
+        // The name
+        sb.append( name ).append( ", " );
+    
+        if ( ( description != null ) && ( description.length() > 0 ) )
+        {
+            sb.append( description ).append( ", " );
+        }
+    
+        // the date
+        sb.append( "date : <" ).append( beginDate ).append( ", " ).append( endDate ).append(
">, " );
+    
+        // The time
+        sb.append( "time : <" ).append( beginTime ).append( ", " ).append( endTime ).append(
">, " );
+    
+        // The lock date
+        sb.append( "lock date : <" ).append( beginLockDate ).append( ", " ).append( endLockDate
).append( ">, " );
+    
+        // The timeout
+        sb.append( "timeout : " ).append( timeout ).append( ", " );
+    
+        // The day mask
+        sb.append( "daymask : " ).append( dayMask );
+    
+        // The parents if any
+        if ( ( parents != null ) && ( parents.size() > 0 ) )
+        {
+            sb.append( ", parents : {" );
+    
+            boolean isFirst = true;
+    
+            for ( String parent : parents )
             {
-                isFirst = false;
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( '|' );
+                }
+    
+                sb.append( parent );
             }
-            else
+    
+            sb.append( '}' );
+        }
+    
+        // The children if any
+        if ( ( children != null ) && ( children.size() > 0 ) )
+        {
+            sb.append( ", children : {" );
+    
+            boolean isFirst = true;
+    
+            for ( String child : children )
             {
-                sb.append( '|' );
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( '|' );
+                }
+    
+                sb.append( child );
             }
-
-            sb.append( child );
+    
+            sb.append( '}' );
         }
-
-        sb.append( '}' );
+    
+        sb.append( ']' );
+    
+        return sb.toString();
     }
-
-    sb.append( ']' );
-
-    return sb.toString();
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return toString( "" );
     }
 }


Mime
View raw message