Project Wonder 5.0

er.rest.entityDelegates
Class ERXUnsafeReadOnlyRestEntityDelegate

java.lang.Object
  extended by er.rest.entityDelegates.ERXAbstractRestEntityDelegate
      extended by er.rest.entityDelegates.ERXStandardRestEntityDelegate
          extended by er.rest.entityDelegates.ERXUnsafeReadOnlyRestEntityDelegate
All Implemented Interfaces:
IERXRestEntityDelegate, IERXRestSecurityDelegate

public class ERXUnsafeReadOnlyRestEntityDelegate
extends ERXStandardRestEntityDelegate

ERXUnsafeRestEntityDelegate should probably never be used in production. This is an entity delegate implementation designed to allow you to explore the features of ERRest without having to actually write custom delegates. This implementation allows full access to read any object in any model in your system that it is assigned to be a delegate for.

Author:
mschrag

Constructor Summary
ERXUnsafeReadOnlyRestEntityDelegate()
           
 
Method Summary
 boolean canDeleteObject(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Returns whether or not the given object can be deleted.
 boolean canInsertObject(com.webobjects.eoaccess.EOEntity entity, ERXRestContext context)
          Returns whether or not the caller is allowed to insert a new object of the given entity.
 boolean canInsertObject(com.webobjects.eoaccess.EOEntity parentEntity, java.lang.Object parentObject, java.lang.String parentKey, com.webobjects.eoaccess.EOEntity entity, ERXRestContext context)
          Returns whether or not a new object can be inserted into the specified relationship of an existing object.
 boolean canInsertProperty(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String propertyName, ERXRestContext context)
          Returns true if propertyName is declared as an insert property.
 boolean canUpdateObject(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Returns whether or not the given object can be updated.
 boolean canUpdateProperty(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String propertyName, ERXRestContext context)
          Returns true if propertyName is declared as an update property.
 boolean canViewObject(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Returns whether or not the given object can be seen.
 boolean canViewProperty(com.webobjects.eoaccess.EOEntity entity, java.lang.Object obj, java.lang.String propertyName, ERXRestContext context)
          Returns true if propertyName is declared as a view property.
 void delete(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Deletes the given object.
 void initializeEntityNamed(java.lang.String entityName)
          Do nothing by default
 void inserted(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Default empty implementation.
 com.webobjects.foundation.NSArray objectsForEntity(com.webobjects.eoaccess.EOEntity entity, ERXRestContext context)
          Returns an array of all of the EOs visible to the user for the given entity.
 void updated(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Default empty implementation.
 com.webobjects.foundation.NSArray visibleObjects(com.webobjects.eoaccess.EOEntity parentEntity, java.lang.Object parent, java.lang.String key, com.webobjects.eoaccess.EOEntity entity, com.webobjects.foundation.NSArray objects, ERXRestContext context)
          Given an array, this method filters the array based on the callers permission level.
 
Methods inherited from class er.rest.entityDelegates.ERXStandardRestEntityDelegate
addInsertPropertyName, addUpdatePropertyName, addViewPropertyName, defaultIDAttributeName, entityAliasForEntityNamed, hasViewProperties, idAttributeName, loadDetailsPropertiesAsViewPropertiesForEntityNamed, loadInsertPropertiesForEntityNamed, loadUpdatePropertiesForEntityNamed, loadViewPropertiesForEntityNamed, nextEntity, propertyAliasForPropertyNamed, propertyNameForPropertyAlias, qualifierFromContext, setDefaultIDAttributeName, sortOrderingsFromContext, updatePropertyAliasForPropertyNamed
 
Methods inherited from class er.rest.entityDelegates.ERXAbstractRestEntityDelegate
_cascadingValue, _displayDetailsFromProperties, _displayPropertiesFromProperties, _isEOID, _objectWithKey, _updateArrayFromDocument, _updatePropertiesFromDocument, _updateRelationshipFromDocument, allPossiblePropertyNamesOnEarth, cascadingValue, displayDetails, displayProperties, formatAttributeValue, idForEO, idForNode, insertObjectFromDocument, isEOID, objectForNode, objectWithKey, objectWithKey, parseAttributeValue, preprocess, processObjectFromDocument, stringIDForEO, takeValueForKey, updateArrayFromDocument, updateObjectFromDocument, valueForKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXUnsafeReadOnlyRestEntityDelegate

public ERXUnsafeReadOnlyRestEntityDelegate()
Method Detail

initializeEntityNamed

public void initializeEntityNamed(java.lang.String entityName)
Description copied from class: ERXAbstractRestEntityDelegate
Do nothing by default

Specified by:
initializeEntityNamed in interface IERXRestEntityDelegate
Overrides:
initializeEntityNamed in class ERXAbstractRestEntityDelegate
Parameters:
entityName - the name of the entity to initialize

delete

public void delete(com.webobjects.eoaccess.EOEntity entity,
                   com.webobjects.eocontrol.EOEnterpriseObject eo,
                   ERXRestContext context)
            throws ERXRestException,
                   ERXRestSecurityException
Description copied from interface: IERXRestEntityDelegate
Deletes the given object.

Specified by:
delete in interface IERXRestEntityDelegate
Overrides:
delete in class ERXAbstractRestEntityDelegate
Parameters:
entity - the entity of the object
eo - the object to delete
context - the rest context
Throws:
ERXRestException - if a general failure occurs.
ERXRestSecurityException - if a security failure occurs

updated

public void updated(com.webobjects.eoaccess.EOEntity entity,
                    com.webobjects.eocontrol.EOEnterpriseObject eo,
                    ERXRestContext context)
             throws ERXRestException,
                    ERXRestSecurityException
Description copied from class: ERXStandardRestEntityDelegate
Default empty implementation. Extend to do custom update processing for the object.

Overrides:
updated in class ERXStandardRestEntityDelegate
Parameters:
entity - the entity of the object
eo - the updated object
context - the rest context
Throws:
ERXRestException - if a general error occurs
ERXRestSecurityException - if a security exception occurs

inserted

public void inserted(com.webobjects.eoaccess.EOEntity entity,
                     com.webobjects.eocontrol.EOEnterpriseObject eo,
                     ERXRestContext context)
              throws ERXRestException,
                     ERXRestSecurityException
Description copied from class: ERXStandardRestEntityDelegate
Default empty implementation. Extend to do custom insertion processing for the object.

Overrides:
inserted in class ERXStandardRestEntityDelegate
Parameters:
entity - the entity of the object
eo - the inserted object
context - the rest context
Throws:
ERXRestException - if a general error occurs
ERXRestSecurityException - if a security exception occurs

canInsertProperty

public boolean canInsertProperty(com.webobjects.eoaccess.EOEntity entity,
                                 com.webobjects.eocontrol.EOEnterpriseObject eo,
                                 java.lang.String propertyName,
                                 ERXRestContext context)
Description copied from class: ERXStandardRestEntityDelegate
Returns true if propertyName is declared as an insert property.

Specified by:
canInsertProperty in interface IERXRestSecurityDelegate
Overrides:
canInsertProperty in class ERXStandardRestEntityDelegate
Parameters:
entity - the entity
eo - the object to check
propertyName - the property name to check
context - the rest context
Returns:
true if propertyName is declared as an insert property

canUpdateProperty

public boolean canUpdateProperty(com.webobjects.eoaccess.EOEntity entity,
                                 com.webobjects.eocontrol.EOEnterpriseObject eo,
                                 java.lang.String propertyName,
                                 ERXRestContext context)
Description copied from class: ERXStandardRestEntityDelegate
Returns true if propertyName is declared as an update property.

Specified by:
canUpdateProperty in interface IERXRestSecurityDelegate
Overrides:
canUpdateProperty in class ERXStandardRestEntityDelegate
Parameters:
entity - the entity
eo - the object to check
propertyName - the property name to check
context - the rest context
Returns:
true if propertyName is declared as an update property

objectsForEntity

public com.webobjects.foundation.NSArray objectsForEntity(com.webobjects.eoaccess.EOEntity entity,
                                                          ERXRestContext context)
Description copied from interface: IERXRestEntityDelegate
Returns an array of all of the EOs visible to the user for the given entity.

Parameters:
entity - the entity to fetch
context - the rest context
Returns:
the array of EOs

canInsertObject

public boolean canInsertObject(com.webobjects.eoaccess.EOEntity entity,
                               ERXRestContext context)
Description copied from interface: IERXRestSecurityDelegate
Returns whether or not the caller is allowed to insert a new object of the given entity. This variant is called if the caller tries to insert an object without traversing a keypath -- that is, a top level insert. You can return false from this without implying that canInsertObject(..., parentObject, parentKey ..) returns false -- the two are mutually exclusive.

Parameters:
entity - the entity of the object to insert
context - the rest context
Returns:
whether or not a new object can be inserted

canInsertObject

public boolean canInsertObject(com.webobjects.eoaccess.EOEntity parentEntity,
                               java.lang.Object parentObject,
                               java.lang.String parentKey,
                               com.webobjects.eoaccess.EOEntity entity,
                               ERXRestContext context)
Description copied from interface: IERXRestSecurityDelegate
Returns whether or not a new object can be inserted into the specified relationship of an existing object.

Parameters:
parentEntity - the entity of the parent
parentObject - the parent
parentKey - the name of the relationship on the parent
entity - the entity of the object to insert
context - the rest context
Returns:
whether or not a new object can be inserted

canDeleteObject

public boolean canDeleteObject(com.webobjects.eoaccess.EOEntity entity,
                               com.webobjects.eocontrol.EOEnterpriseObject eo,
                               ERXRestContext context)
Description copied from interface: IERXRestSecurityDelegate
Returns whether or not the given object can be deleted. This is called prior to calling canDeleteProperty on any properties and acts as a first line of defenese to completely cut-off access to an object for delete. Note that the actual meaning of "delete" can be defined in your delete method, so returning true for this does not *necessarily* mean the object will be deleted. Instead it just means you will allow access to the delete method.

Parameters:
entity - the entity of the object
eo - the object to check
context - the rest context
Returns:
whether or not the given object can be deleted

canUpdateObject

public boolean canUpdateObject(com.webobjects.eoaccess.EOEntity entity,
                               com.webobjects.eocontrol.EOEnterpriseObject eo,
                               ERXRestContext context)
Description copied from interface: IERXRestSecurityDelegate
Returns whether or not the given object can be updated. This is called prior to calling canUpdateProperty on any properties and acts as a first line of defenese to completely cut-off access to an object for update

Parameters:
entity - the entity of the object
eo - the object to check
context - the rest context
Returns:
whether or not the given object can be updated

canViewObject

public boolean canViewObject(com.webobjects.eoaccess.EOEntity entity,
                             com.webobjects.eocontrol.EOEnterpriseObject eo,
                             ERXRestContext context)
Description copied from interface: IERXRestSecurityDelegate
Returns whether or not the given object can be seen. This is called prior to calling canViewProperty on any properties and acts as a first line of defenese to completely cut-off access to an object.

Parameters:
entity - the entity of the object
eo - the object to check
context - the rest context
Returns:
whether or not the given object can be seen

canViewProperty

public boolean canViewProperty(com.webobjects.eoaccess.EOEntity entity,
                               java.lang.Object obj,
                               java.lang.String propertyName,
                               ERXRestContext context)
Description copied from class: ERXStandardRestEntityDelegate
Returns true if propertyName is declared as a view property.

Specified by:
canViewProperty in interface IERXRestSecurityDelegate
Overrides:
canViewProperty in class ERXStandardRestEntityDelegate
Parameters:
entity - the entity
obj - the object to check
propertyName - the property name to check
context - the rest context
Returns:
true if propertyName is declared as a view property

visibleObjects

public com.webobjects.foundation.NSArray visibleObjects(com.webobjects.eoaccess.EOEntity parentEntity,
                                                        java.lang.Object parent,
                                                        java.lang.String key,
                                                        com.webobjects.eoaccess.EOEntity entity,
                                                        com.webobjects.foundation.NSArray objects,
                                                        ERXRestContext context)
Description copied from interface: IERXRestEntityDelegate
Given an array, this method filters the array based on the callers permission level. This method should never return null. To cut off access to the array entirely, return NSArray.EmptyArray. This method is only called after having verified access to the specified key on the parent object.

Parameters:
parentEntity - the entity of the parent
parent - the parent object
key - the key in the parent that references this array
entity - the entity of the objects in the array
objects - the actual array of objects to filter
context - the rest context
Returns:
a filtered array

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.