org.openpermis.policy
Class Role

java.lang.Object
  extended by org.openpermis.policy.Role
All Implemented Interfaces:
Serializable

public final class Role
extends Object
implements Serializable

A reference to a named role within a role hierarchy.

See Also:
Serialized Form
Since:
0.3.0

Constructor Summary
Role(RoleHierarchy roleHierarchy, String name)
          Creates a new role reference.
 
Method Summary
static Role create(RoleHierarchy hierarchy, String name)
          Factory method for creating a role reference.
 boolean equals(Object obj)
           
 String getName()
           
 RoleHierarchy getRoleHierarchy()
           
 Set<Role> getSubRoles()
          Returns all the roles that inherit privileges from this role.
 Set<Role> getSuperRoles()
          Returns all the roles from which this role inherits privileges.
 int hashCode()
           
static Set<Role> set(RoleHierarchy hierarchy, Collection<String> names)
          Creates a set of roles from a role hierarchy and a collection of role names.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Role

public Role(RoleHierarchy roleHierarchy,
            String name)
Creates a new role reference.

Parameters:
roleHierarchy - the RoleHierarchy to which the role belongs.
name - the name identifying the role within its hierarchy.
Since:
0.3.0
Method Detail

create

public static Role create(RoleHierarchy hierarchy,
                          String name)
Factory method for creating a role reference.

Parameters:
hierarchy - the RoleHierarchy from which to refer to a role.
name - the name of the role to refer to.
Returns:
a new Role.
Since:
0.3.0

set

public static Set<Role> set(RoleHierarchy hierarchy,
                            Collection<String> names)
Creates a set of roles from a role hierarchy and a collection of role names.

Parameters:
hierarchy - the RoleHierarchy to which the roles belong.
names - a collection of role names.
Returns:
a Set of roles.
Since:
0.3.0

getRoleHierarchy

public RoleHierarchy getRoleHierarchy()
Since:
0.3.0

getName

public String getName()
Since:
0.3.0

getSuperRoles

public Set<Role> getSuperRoles()
Returns all the roles from which this role inherits privileges.

Returns:
a Set of roles from which this role inherits privileges. The passed role is itself included, so the returned set will always contain at least one role.
Since:
0.3.0

getSubRoles

public Set<Role> getSubRoles()
Returns all the roles that inherit privileges from this role.

Returns:
a Set of roles that inherit privileges from this role. The passed role is itself included, so the returned set will always contain at least one role.
Since:
0.3.0

toString

public String toString()
Overrides:
toString in class Object
Since:
0.3.0

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
Since:
0.3.0

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Since:
0.3.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:10
Copyright (c) 2002-2007 Ergon Informatik AG