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
 RoleDefinition asRoleDefinition()
          Returns the role definition representation of this role.
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

asRoleDefinition

public final RoleDefinition asRoleDefinition()
Returns the role definition representation of this role.

The role definition is created as the string version of the identity of the hierarchy of this role and its name.

Returns:
the role definition requested.
Since:
0.9.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


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:16:59
Copyright (c) 2002-2007 Ergon Informatik AG