Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.permission.bean
Class SimplePermissible  view SimplePermissible download SimplePermissible.java

java.lang.Object
  extended bycom.RuntimeCollective.permission.bean.SimplePermissible
All Implemented Interfaces:
com.RuntimeCollective.webapps.bean.EntityBean, Permissible, com.RuntimeCollective.webapps.bean.PermissionBean, java.io.Serializable
Direct Known Subclasses:
PermissibleExtension

public class SimplePermissible
extends java.lang.Object
implements Permissible

A simple implementation of Permissible.

Version:
$Id: SimplePermissible.java,v 1.15 2003/09/30 15:12:49 joe Exp $

Field Summary
static java.lang.String DATABASE_PRULEMAP_TABLE
           
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
protected  int id
          This object's id
protected  java.util.HashMap PermissionRuleIds
          The PermissionRules for each action
 
Fields inherited from interface com.RuntimeCollective.permission.bean.Permissible
EDIT_ACTION, VIEW_ACTION
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
SimplePermissible()
          Construct a new blank SimplePermissible, giving it a new unique ID.
SimplePermissible(int id)
          Get a current SimplePermissible from the RuntimeDataSource, given an id.
 
Method Summary
 boolean canEdit(com.RuntimeCollective.webapps.bean.User user)
          Can a user "edit" this Bean.
 boolean canPerformAction(java.lang.String action, com.RuntimeCollective.webapps.bean.User user)
          Can a given User perform a given action on that Bean?
 boolean canView(com.RuntimeCollective.webapps.bean.User user)
          Can a user "view" this Bean.
 void delete()
          Delete this bean from the database.
 PermissionRule getActionPermissionRule(java.lang.String action)
          Get the PermissionRule for a given action on this Bean.
 java.util.Iterator getActions()
          Get an Iterator of the actions constrained until now.
 java.lang.String getAuthorisationPathForAction(java.lang.String action, javax.servlet.http.HttpSession session, java.lang.String returnPath)
          Deprecated. This method was modified not to refer to Client Tier classes (HttpSession). Use instead: getAuthorisationPathForAction(action, (User) session.getAttribute(RuntimeParameters.get("logonUserKey")), (Session) session.getAttribute(Session.SESSION_KEY), new HttpSessionReturnPathContainer(session), returnPath)
 java.lang.String getAuthorisationPathForAction(java.lang.String action, com.RuntimeCollective.webapps.bean.User user, com.RuntimeCollective.webapps.bean.Session session, com.RuntimeCollective.webapps.ReturnPathContainer rpContainer, java.lang.String returnPath)
          Get the path of the page where a User should be sent in order to (maybe) get authorised for an action.
 int getId()
          Get the unique id of this bean instance.
 void loadRules(int id)
          Load the rule mappings data
 void removeActionPermissionRule(java.lang.String action)
          Remove any PermissionRules for a given action on this Bean.
 void save()
          Save this bean to the database.
 void saveRules()
          Save the Rule mappings
 void setActionPermissionRule(java.lang.String action, PermissionRule permissionRule)
          Set the PermissionRule for a given action on this Bean.
 void setId(int id)
          Set the unique id of this bean instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

DATABASE_PRULEMAP_TABLE

public static final java.lang.String DATABASE_PRULEMAP_TABLE
See Also:
Constant Field Values

id

protected int id
This object's id


PermissionRuleIds

protected java.util.HashMap PermissionRuleIds
The PermissionRules for each action

Constructor Detail

SimplePermissible

public SimplePermissible()
Construct a new blank SimplePermissible, giving it a new unique ID.


SimplePermissible

public SimplePermissible(int id)
Get a current SimplePermissible from the RuntimeDataSource, given an id.

Method Detail

setId

public void setId(int id)
Set the unique id of this bean instance.

Specified by:
setId in interface Permissible

getId

public int getId()
Get the unique id of this bean instance.

Specified by:
getId in interface Permissible

save

public void save()
Save this bean to the database.
We assume this bean's PermissionRules have already been saved.

Specified by:
save in interface Permissible

saveRules

public void saveRules()
               throws java.sql.SQLException
Save the Rule mappings


delete

public void delete()
Delete this bean from the database.

Specified by:
delete in interface Permissible

loadRules

public void loadRules(int id)
               throws java.sql.SQLException
Load the rule mappings data


canEdit

public boolean canEdit(com.RuntimeCollective.webapps.bean.User user)
Can a user "edit" this Bean.

Specified by:
canEdit in interface Permissible

canView

public boolean canView(com.RuntimeCollective.webapps.bean.User user)
Can a user "view" this Bean.

Specified by:
canView in interface Permissible

setActionPermissionRule

public void setActionPermissionRule(java.lang.String action,
                                    PermissionRule permissionRule)
Set the PermissionRule for a given action on this Bean.

Specified by:
setActionPermissionRule in interface Permissible

getActionPermissionRule

public PermissionRule getActionPermissionRule(java.lang.String action)
Get the PermissionRule for a given action on this Bean.

Specified by:
getActionPermissionRule in interface Permissible

removeActionPermissionRule

public void removeActionPermissionRule(java.lang.String action)
Remove any PermissionRules for a given action on this Bean.


canPerformAction

public boolean canPerformAction(java.lang.String action,
                                com.RuntimeCollective.webapps.bean.User user)
Can a given User perform a given action on that Bean?

Specified by:
canPerformAction in interface Permissible

getAuthorisationPathForAction

public java.lang.String getAuthorisationPathForAction(java.lang.String action,
                                                      javax.servlet.http.HttpSession session,
                                                      java.lang.String returnPath)
Deprecated. This method was modified not to refer to Client Tier classes (HttpSession). Use instead: getAuthorisationPathForAction(action, (User) session.getAttribute(RuntimeParameters.get("logonUserKey")), (Session) session.getAttribute(Session.SESSION_KEY), new HttpSessionReturnPathContainer(session), returnPath)

Get the path of the page where the Session should be sent in order to (maybe) get authorised for an action. Also sets required attributes in the Session.

On submission of that page, the Session should be checked again, as there may be more than one page to go to.

Specified by:
getAuthorisationPathForAction in interface Permissible

getAuthorisationPathForAction

public java.lang.String getAuthorisationPathForAction(java.lang.String action,
                                                      com.RuntimeCollective.webapps.bean.User user,
                                                      com.RuntimeCollective.webapps.bean.Session session,
                                                      com.RuntimeCollective.webapps.ReturnPathContainer rpContainer,
                                                      java.lang.String returnPath)
Get the path of the page where a User should be sent in order to (maybe) get authorised for an action.

On submission of that resulting page, the user should be checked again, as there may be more than one page to go to before he/she is authorised.

Specified by:
getAuthorisationPathForAction in interface Permissible

getActions

public java.util.Iterator getActions()
Get an Iterator of the actions constrained until now.

Specified by:
getActions in interface Permissible