org.jcreme.permissioning
Class Subject

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

public abstract class Subject
extends Enumeration

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

Field Summary
protected  Domain domain
          The Domain to which the Subject belongs.
protected static java.util.Hashtable fromName
           
protected  Task task
          The leaf task that is solved by the Subject.
 
Fields inherited from class org.jcreme.enumerations.Enumeration
 
Constructor Summary
protected Subject(java.lang.String name)
           
 
Method Summary
 boolean canInvoke(User u, Task t, java.lang.Object[] parameters, AccessType[] accessTypes)
           
 boolean checkAccess(ObjectType type, AccessType access)
          This method is used to determine if the Subject can access a particular type.
protected  void checkParameters(User u, Task t, java.lang.Object[] parameters, AccessType[] accessTypes)
           
 boolean checkPurpose(User user, Task t, ObjectPolicy policy, AccessType access)
          Checks if the calling task (business) purpose matches the subject task's purpose.
 boolean checkRoles(User u, Task t)
          Checks if the user's roles are compatible with the invocation Task and the subject domain.
 boolean checkTask(Task t)
          This method checks whether the invocation task is compatible with the subject's task.
 java.lang.Object[] filterObjects(User u, Task t, java.lang.Object[] parameters, AccessType[] accessTypes)
          This method filters the provided parameters against the requested access and returns only the objects that can be rightfully accessed.
 Domain getDomain()
           
protected  java.util.Hashtable getFromName()
          This method is for internal use only.
static Subject[] getSubjects()
           
static Enumeration[] getValues()
          This method enables to retrieve all the possible values of an Enumeration class.
 void setDomain(Domain d)
           
 void setTask(Task t)
           
 
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

task

protected Task task
The leaf task that is solved by the Subject.


domain

protected Domain domain
The Domain to which the Subject belongs.

Constructor Detail

Subject

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

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.

setDomain

public void setDomain(Domain d)

getDomain

public Domain getDomain()

setTask

public void setTask(Task t)
             throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getSubjects

public static Subject[] getSubjects()

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.


checkParameters

protected void checkParameters(User u,
                               Task t,
                               java.lang.Object[] parameters,
                               AccessType[] accessTypes)
                        throws NoPermissionException,
                               java.lang.IllegalArgumentException
Parameters:
u -
t - is set by the invocation path. It is otherwise impossible to determine a Task that will give a single meaningful business Purpose.
parameters -
accessTypes -
Throws:
NoPermissionException
java.lang.IllegalArgumentException

filterObjects

public java.lang.Object[] filterObjects(User u,
                                        Task t,
                                        java.lang.Object[] parameters,
                                        AccessType[] accessTypes)
                                 throws java.lang.IllegalArgumentException
This method filters the provided parameters against the requested access and returns only the objects that can be rightfully accessed.

Parameters:
u -
t -
parameters -
accessTypes -
Returns:
Throws:
java.lang.IllegalArgumentException

canInvoke

public boolean canInvoke(User u,
                         Task t,
                         java.lang.Object[] parameters,
                         AccessType[] accessTypes)
                  throws NoPermissionException
Parameters:
u -
t -
parameters -
accessTypes -
Returns:
Throws:
NoPermissionException

checkRoles

public boolean checkRoles(User u,
                          Task t)
Checks if the user's roles are compatible with the invocation Task and the subject domain.

Parameters:
u -
t -
Returns:

checkTask

public boolean checkTask(Task t)
This method checks whether the invocation task is compatible with the subject's task.

Parameters:
t - is set by the invocation path. It is otherwise impossible to determine a Task that will give a single meaningful business Purpose.
Returns:

checkAccess

public boolean checkAccess(ObjectType type,
                           AccessType access)
This method is used to determine if the Subject can access a particular type.

Parameters:
type -
access -

checkPurpose

public boolean checkPurpose(User user,
                            Task t,
                            ObjectPolicy policy,
                            AccessType access)
Checks if the calling task (business) purpose matches the subject task's purpose. Checks the ObjectPolicy for the given purpose and access. This method has to be used to check invocation parameters but also to filter out return values.

Parameters:
user -
t -
policy -
access -
Returns:


Copyright 2006 null. All Rights Reserved.