[jboss-cvs] JBossAS SVN: r69807 - projects/security/security-jboss-sx/trunk/identity/src/main/org/jboss/security/identity/plugins.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 12 18:04:54 EST 2008


Author: sguilhen at redhat.com
Date: 2008-02-12 18:04:53 -0500 (Tue, 12 Feb 2008)
New Revision: 69807

Modified:
   projects/security/security-jboss-sx/trunk/identity/src/main/org/jboss/security/identity/plugins/SimpleRole.java
Log:
Added getParent() method implementation.



Modified: projects/security/security-jboss-sx/trunk/identity/src/main/org/jboss/security/identity/plugins/SimpleRole.java
===================================================================
--- projects/security/security-jboss-sx/trunk/identity/src/main/org/jboss/security/identity/plugins/SimpleRole.java	2008-02-12 23:03:31 UTC (rev 69806)
+++ projects/security/security-jboss-sx/trunk/identity/src/main/org/jboss/security/identity/plugins/SimpleRole.java	2008-02-12 23:04:53 UTC (rev 69807)
@@ -37,23 +37,33 @@
 public class SimpleRole implements Role, Serializable, Cloneable
 {
    private static final long serialVersionUID = 1L;
-   private String roleName;
-   
+
+   private final String roleName;
+
+   private final Role parent;
+
    public static final Role ANYBODY_ROLE = new SimpleRole("<ANYBODY>");
+
    public static final String ANYBODY = "<ANYBODY>";
 
    public SimpleRole(String roleName)
    {
+      this(roleName, null);
+   }
+
+   public SimpleRole(String roleName, Role parent)
+   {
       this.roleName = roleName;
+      this.parent = parent;
    }
-   
+
    public String getRoleName()
-   { 
+   {
       return this.roleName;
    }
 
    public RoleType getType()
-   { 
+   {
       return RoleType.simple;
    }
 
@@ -62,25 +72,34 @@
     */
    public boolean containsAll(Role anotherRole)
    {
-      if(anotherRole.getType() == RoleType.simple)
+      if (anotherRole.getType() == RoleType.simple)
       {
-         if(ANYBODY.equals(roleName))
-            return true; 
-         return roleName.equals(anotherRole.getRoleName()); 
+         if (ANYBODY.equals(roleName))
+            return true;
+         return roleName.equals(anotherRole.getRoleName());
       }
-      return false; 
+      return false;
    }
 
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.security.identity.Role#getParent()
+    */
+   public Role getParent()
+   {
+      return this.parent;
+   }
+
    @Override
    protected Object clone() throws CloneNotSupportedException
    {
       // TODO Auto-generated method stub
       return super.clone();
-   } 
-   
+   }
+
    @Override
    public String toString()
    {
-     return roleName;
+      return roleName;
    }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list