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

Quick Search    Search Deep

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

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

public class PermissibleExtension
extends SimplePermissible
implements Permissible

An extension which can be used to stick the Permissible behaviour to any bean.

Version:
$Id: PermissibleExtension.java,v 1.5 2003/10/13 15:42:42 fabrice Exp $

Field Summary
protected  int beanId
          The id of the EntityBean this PermissibleExtension is for.
static java.lang.String DATABASE_TABLE
           
private static java.lang.String DELETE_FROM
           
private static java.lang.String EMPTY_STRING
           
private static java.lang.String ESC
           
private static java.util.HashMap extIdCache
          Cache of beanId-id mappings, used only if not clustered.
private static java.lang.String FIELD_BEAN_ID
           
private static java.lang.String SELECT_DATA
           
private static java.lang.String SELECT_ID
           
private static java.lang.String SPACE
           
private static java.lang.String WHERE_BEAN_ID
           
private static java.lang.String WHERE_ID
           
 
Fields inherited from class com.RuntimeCollective.permission.bean.SimplePermissible
DATABASE_PRULEMAP_TABLE, id, PermissionRuleIds
 
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
PermissibleExtension()
          Constructs a new blank bean with a unique id.
PermissibleExtension(int id)
          Gets a bean from the RuntimeDataSource, given an id.
 
Method Summary
 void clearFromExtIdCache(int extId)
          To notice the cache of stale data.
 void delete()
          Delete this bean from the database.
 com.RuntimeCollective.webapps.bean.EntityBean getEntityBean()
          Gets the bean.
static PermissibleExtension getFor(com.RuntimeCollective.webapps.bean.EntityBean bean)
          Gets the PermissibleExtension for a particular bean, if one exists.
static PermissibleExtension getOrCreateFor(com.RuntimeCollective.webapps.bean.EntityBean bean)
          Gets or creates the PermissibleExtension for a particular bean.
 void save()
          Save this bean in the database.
 void setEntityBean(com.RuntimeCollective.webapps.bean.EntityBean bean)
          Sets the bean.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class com.RuntimeCollective.permission.bean.SimplePermissible
canEdit, canPerformAction, canView, getActionPermissionRule, getActions, getAuthorisationPathForAction, getAuthorisationPathForAction, getId, loadRules, removeActionPermissionRule, saveRules, setActionPermissionRule, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.RuntimeCollective.permission.bean.Permissible
canEdit, canPerformAction, canView, getActionPermissionRule, getActions, getAuthorisationPathForAction, getAuthorisationPathForAction, getId, setActionPermissionRule, setId
 

Field Detail

SELECT_ID

private static final java.lang.String SELECT_ID
See Also:
Constant Field Values

WHERE_BEAN_ID

private static final java.lang.String WHERE_BEAN_ID
See Also:
Constant Field Values

DELETE_FROM

private static final java.lang.String DELETE_FROM
See Also:
Constant Field Values

WHERE_ID

private static final java.lang.String WHERE_ID
See Also:
Constant Field Values

SELECT_DATA

private static final java.lang.String SELECT_DATA
See Also:
Constant Field Values

ESC

private static final java.lang.String ESC
See Also:
Constant Field Values

EMPTY_STRING

private static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values

SPACE

private static final java.lang.String SPACE
See Also:
Constant Field Values

DATABASE_TABLE

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

FIELD_BEAN_ID

private static final java.lang.String FIELD_BEAN_ID
See Also:
Constant Field Values

beanId

protected int beanId
The id of the EntityBean this PermissibleExtension is for.


extIdCache

private static java.util.HashMap extIdCache
Cache of beanId-id mappings, used only if not clustered.

Constructor Detail

PermissibleExtension

public PermissibleExtension()
                     throws java.sql.SQLException
Constructs a new blank bean with a unique id.


PermissibleExtension

public PermissibleExtension(int id)
                     throws java.sql.SQLException
Gets a bean from the RuntimeDataSource, given an id.

Method Detail

save

public void save()
Save this bean in the database.

Specified by:
save in interface Permissible
Overrides:
save in class SimplePermissible

delete

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

Specified by:
delete in interface Permissible
Overrides:
delete in class SimplePermissible

getEntityBean

public com.RuntimeCollective.webapps.bean.EntityBean getEntityBean()
Gets the bean.


setEntityBean

public void setEntityBean(com.RuntimeCollective.webapps.bean.EntityBean bean)
Sets the bean.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getFor

public static PermissibleExtension getFor(com.RuntimeCollective.webapps.bean.EntityBean bean)
Gets the PermissibleExtension for a particular bean, if one exists.


clearFromExtIdCache

public void clearFromExtIdCache(int extId)
To notice the cache of stale data.


getOrCreateFor

public static PermissibleExtension getOrCreateFor(com.RuntimeCollective.webapps.bean.EntityBean bean)
Gets or creates the PermissibleExtension for a particular bean.

NOTE: newly created PermissibleExtension objects are NOT saved - you'll need to do that.