Project Wonder 5.0

er.directtorest
Class ERD2RestDefaultEntityDelegate

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

public class ERD2RestDefaultEntityDelegate
extends ERXAbstractRestEntityDelegate


Constructor Summary
ERD2RestDefaultEntityDelegate()
           
 
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 whether or not the given property can be set during an insert.
 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 whether or not the given property can be set during an update.
 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 whether or not the given property can be seen.
 boolean displayDetails(ERXRestKey key, ERXRestContext context)
           
 java.lang.String[] displayProperties(ERXRestKey key, boolean allProperties, boolean allToMany, ERXRestContext context)
           
 java.lang.String entityAliasForEntityNamed(java.lang.String entityName)
          Returns entityName;
 void inserted(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Called after performing the user's requested insert.
 com.webobjects.eoaccess.EOEntity nextEntity(com.webobjects.eoaccess.EOEntity entity, java.lang.String key)
          Returns the destination entity for the given key on the specified entity.
 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.
 java.lang.String propertyAliasForPropertyNamed(com.webobjects.eoaccess.EOEntity entity, java.lang.String propertyName)
          Returns propertyName.
 java.lang.String propertyNameForPropertyAlias(com.webobjects.eoaccess.EOEntity entity, java.lang.String propertyAlias)
          Returns propertyAlias.
 IERXRestSecurityDelegate securityHandler()
           
 void updated(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Called after performing the user's requested updates.
protected  java.lang.Object valueForKey(java.lang.String key, java.lang.String secondKey, com.webobjects.foundation.NSKeyValueCoding first, com.webobjects.foundation.NSKeyValueCoding second, java.lang.Object defaultValue)
           
 com.webobjects.foundation.NSArray visibleObjects(com.webobjects.eoaccess.EOEntity parentEntity, java.lang.Object parentObject, java.lang.String parentKey, 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.ERXAbstractRestEntityDelegate
_cascadingValue, _displayDetailsFromProperties, _displayPropertiesFromProperties, _isEOID, _objectWithKey, _updateArrayFromDocument, _updatePropertiesFromDocument, _updateRelationshipFromDocument, allPossiblePropertyNamesOnEarth, cascadingValue, delete, formatAttributeValue, idAttributeName, idForEO, idForNode, initializeEntityNamed, 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

ERD2RestDefaultEntityDelegate

public ERD2RestDefaultEntityDelegate()
Method Detail

inserted

public void inserted(com.webobjects.eoaccess.EOEntity entity,
                     com.webobjects.eocontrol.EOEnterpriseObject eo,
                     ERXRestContext context)
              throws ERXRestException,
                     ERXRestSecurityException
Description copied from class: ERXAbstractRestEntityDelegate
Called after performing the user's requested insert. This provides support for subclasses to extend and set "automatic" attributes. For instance, if you wanted to set a creation date, or a created-by-user field, you could do that here.

Specified by:
inserted in class ERXAbstractRestEntityDelegate
Parameters:
entity - the entity of the object being inserted
eo - the inserted object
context - the rest context
Throws:
ERXRestException - if a general error occurs
ERXRestSecurityException - if a security error occurs

updated

public void updated(com.webobjects.eoaccess.EOEntity entity,
                    com.webobjects.eocontrol.EOEnterpriseObject eo,
                    ERXRestContext context)
             throws ERXRestException,
                    ERXRestSecurityException
Description copied from class: ERXAbstractRestEntityDelegate
Called after performing the user's requested updates. This provides support for subclasses to extend and perform "automatic" updates. For instance, if you wanted to set a last modified date, or a modified-by-user field, you could do that here.

Specified by:
updated in class ERXAbstractRestEntityDelegate
Parameters:
entity - the entity of the object being updated
eo - the updated object
context - the rest context
Throws:
ERXRestException - if a general error occurs
ERXRestSecurityException - if a security error occurs

displayProperties

public java.lang.String[] displayProperties(ERXRestKey key,
                                            boolean allProperties,
                                            boolean allToMany,
                                            ERXRestContext context)
                                     throws ERXRestException,
                                            ERXRestNotFoundException,
                                            ERXRestSecurityException
Specified by:
displayProperties in interface IERXRestEntityDelegate
Overrides:
displayProperties in class ERXAbstractRestEntityDelegate
Throws:
ERXRestException
ERXRestNotFoundException
ERXRestSecurityException

displayDetails

public boolean displayDetails(ERXRestKey key,
                              ERXRestContext context)
                       throws ERXRestException,
                              ERXRestNotFoundException,
                              ERXRestSecurityException
Specified by:
displayDetails in interface IERXRestEntityDelegate
Overrides:
displayDetails in class ERXAbstractRestEntityDelegate
Throws:
ERXRestException
ERXRestNotFoundException
ERXRestSecurityException

entityAliasForEntityNamed

public java.lang.String entityAliasForEntityNamed(java.lang.String entityName)
Returns entityName;

Specified by:
entityAliasForEntityNamed in interface IERXRestEntityDelegate
Overrides:
entityAliasForEntityNamed in class ERXAbstractRestEntityDelegate
Parameters:
entityName - the name of the entity to lookup
Returns:
entityName

propertyNameForPropertyAlias

public java.lang.String propertyNameForPropertyAlias(com.webobjects.eoaccess.EOEntity entity,
                                                     java.lang.String propertyAlias)
Returns propertyAlias.

Specified by:
propertyNameForPropertyAlias in interface IERXRestEntityDelegate
Overrides:
propertyNameForPropertyAlias in class ERXAbstractRestEntityDelegate
Parameters:
entity - the entity that contains the property
propertyAlias - the alias to lookup
Returns:
propertyAlias

propertyAliasForPropertyNamed

public java.lang.String propertyAliasForPropertyNamed(com.webobjects.eoaccess.EOEntity entity,
                                                      java.lang.String propertyName)
Returns propertyName.

Specified by:
propertyAliasForPropertyNamed in interface IERXRestEntityDelegate
Overrides:
propertyAliasForPropertyNamed in class ERXAbstractRestEntityDelegate
Parameters:
entity - the entity that contains the property
propertyName - the property name
Returns:
propertyName

nextEntity

public com.webobjects.eoaccess.EOEntity nextEntity(com.webobjects.eoaccess.EOEntity entity,
                                                   java.lang.String key)
Description copied from interface: IERXRestEntityDelegate
Returns the destination entity for the given key on the specified entity. If the key is a non-entity, you can return null.

Parameters:
entity - the entity to check
key - the key to return the entity for
Returns:
the destination entity for the given key (or null if there isn't one)

valueForKey

protected java.lang.Object valueForKey(java.lang.String key,
                                       java.lang.String secondKey,
                                       com.webobjects.foundation.NSKeyValueCoding first,
                                       com.webobjects.foundation.NSKeyValueCoding second,
                                       java.lang.Object defaultValue)

objectsForEntity

public com.webobjects.foundation.NSArray objectsForEntity(com.webobjects.eoaccess.EOEntity entity,
                                                          ERXRestContext context)
                                                   throws ERXRestException,
                                                          ERXRestSecurityException
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
Throws:
ERXRestException - if there is a general failure
ERXRestSecurityException - if the user requests objects that he/she is not permitted to see

visibleObjects

public com.webobjects.foundation.NSArray visibleObjects(com.webobjects.eoaccess.EOEntity parentEntity,
                                                        java.lang.Object parentObject,
                                                        java.lang.String parentKey,
                                                        com.webobjects.eoaccess.EOEntity entity,
                                                        com.webobjects.foundation.NSArray objects,
                                                        ERXRestContext context)
                                                 throws ERXRestException,
                                                        ERXRestSecurityException,
                                                        ERXRestNotFoundException
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
parentObject - the parent object
parentKey - 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
Throws:
ERXRestException - if a general failure occurs
ERXRestSecurityException - if a security violation occurs (note that filtering results should not constitute a security violation)
ERXRestNotFoundException - if an object cannot be found

securityHandler

public IERXRestSecurityDelegate securityHandler()

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

canInsertObject

public final 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 final 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

canInsertProperty

public final boolean canInsertProperty(com.webobjects.eoaccess.EOEntity entity,
                                       com.webobjects.eocontrol.EOEnterpriseObject eo,
                                       java.lang.String propertyName,
                                       ERXRestContext context)
Description copied from interface: IERXRestSecurityDelegate
Returns whether or not the given property can be set during an insert. This is only called if canInsertObject has returned true.

Parameters:
entity - the entity of the object
eo - the object
propertyName - the property name to check
context - the rest context
Returns:
whether or not the given property can be set during an insert

canUpdateObject

public final 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

canUpdateProperty

public final boolean canUpdateProperty(com.webobjects.eoaccess.EOEntity entity,
                                       com.webobjects.eocontrol.EOEnterpriseObject eo,
                                       java.lang.String propertyName,
                                       ERXRestContext context)
Description copied from interface: IERXRestSecurityDelegate
Returns whether or not the given property can be set during an update. This is only called if canUpdateObject has returned true.

Parameters:
entity - the entity of the object
eo - the object
propertyName - the property name to check
context - the rest context
Returns:
whether or not the given property can be set during an update

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 interface: IERXRestSecurityDelegate
Returns whether or not the given property can be seen. This is only called if canViewObject has returned true.

Parameters:
entity - the entity of the object
obj - the object
propertyName - the property name to check
context - the rest context
Returns:
whether or not the given property can be seen

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

Copyright © 2002 – 2007 Project Wonder.