org.jcreme.permissioning
Class Role

java.lang.Object
  extended byorg.jcreme.enumerations.Enumeration
      extended byorg.jcreme.permissioning.Role
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class Role
extends Enumeration

Role defines the business Roles available to Users. These Roles are associated to business Tasks that can be legitimately carried out.

Version:
$Revision: 1.1 $
Author:
$Author: dbregeon $
See Also:
Serialized Form

Field Summary
protected  Domain domain
           
protected static java.util.Hashtable fromName
           
protected  java.util.HashSet subRoles
           
protected  java.util.HashSet tasks
           
 
Fields inherited from class org.jcreme.enumerations.Enumeration
 
Constructor Summary
protected Role(java.lang.String name)
           
 
Method Summary
 void addSubRole(Role r)
           
 void addTask(Task t)
           
static boolean contains(java.lang.String name)
           
static Role get(java.lang.String name)
           
 Domain getDomain()
           
protected  java.util.Hashtable getFromName()
          This method is for internal use only.
 Purpose getPurpose(Task t)
          This method provides the purpose that the role has to carry out the given Task.
static Role[] getRoles()
           
 Task[] getTasks()
           
static Enumeration[] getValues()
          This method enables to retrieve all the possible values of an Enumeration class.
 boolean hasTask(Task t)
          Checks if the Role or one of its sub roles is authorized to perform that Task.
protected  boolean isSubRole(Role r)
           
static void remove(java.lang.String name)
           
 void removeSubRole(Role r)
           
 void removeTask(Task t)
           
 void setDomain(Domain d)
           
 
Methods inherited from class org.jcreme.enumerations.Enumeration
compareTo, getName, readResolve, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fromName

protected static final java.util.Hashtable fromName

tasks

protected java.util.HashSet tasks

subRoles

protected java.util.HashSet subRoles

domain

protected Domain domain
Constructor Detail

Role

protected Role(java.lang.String name)
Method Detail

addSubRole

public void addSubRole(Role r)
                throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

removeSubRole

public void removeSubRole(Role r)

isSubRole

protected boolean isSubRole(Role r)

addTask

public void addTask(Task t)

removeTask

public void removeTask(Task t)

getTasks

public Task[] getTasks()

hasTask

public boolean hasTask(Task t)
Checks if the Role or one of its sub roles is authorized to perform that Task. This applies to a business Task so the Task has to be directly authorized for the Role.

Parameters:
t - the Task to perform.
Returns:
true if the Role is authorized directly or indirectly to perform the Task.

getPurpose

public Purpose getPurpose(Task t)
This method provides the purpose that the role has to carry out the given Task. There may be multiple purposes as Role may be authorized to carry

Parameters:
t -
Returns:

setDomain

public void setDomain(Domain d)

getDomain

public Domain getDomain()

get

public static Role get(java.lang.String name)

contains

public static boolean contains(java.lang.String name)

remove

public static void remove(java.lang.String name)

getFromName

protected java.util.Hashtable getFromName()
Description copied from class: Enumeration
This method is for internal use only.

Specified by:
getFromName in class Enumeration
Returns:
the Hashtable that links the enumerated values names with the actual enumerated value.
See Also:
Enumeration.getFromName()

getRoles

public static Role[] getRoles()

getValues

public static Enumeration[] getValues()
Description copied from class: Enumeration
This method enables to retrieve all the possible values of an Enumeration class. This method should be overriden in the subclasses to have the desired result. The method in this class returns an empty array.



Copyright 2006 null. All Rights Reserved.