Project Wonder 5.0

er.rest.entityDelegates
Class ERXDenyRestEntityDelegate

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

public class ERXDenyRestEntityDelegate
extends java.lang.Object
implements IERXRestEntityDelegate

ERXDenyRestEntityDelegate is the safe default entity delegate (and is used by default on ERXRestDelegate). This delegate denies all requests (view, insert, update, etc) and throws security exceptions at any attempt to perform an action.

Author:
mschrag

Constructor Summary
ERXDenyRestEntityDelegate()
           
 
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.
 void delete(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
          Deletes the given object.
 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 the alias for the given entity name.
 java.lang.String formatAttributeValue(com.webobjects.eoaccess.EOEntity entity, java.lang.Object object, java.lang.String attributeName, java.lang.Object attributeValue)
          Coerce the given value into a String for use in the restful response.
 java.lang.Object idForEO(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo)
          Returns the primary key of the given EO.
 void initializeEntityNamed(java.lang.String entityName)
          Called by the rest delegate for each entity that gets requested.
 void inserted(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
           
 com.webobjects.eocontrol.EOEnterpriseObject insertObjectFromDocument(com.webobjects.eoaccess.EOEntity entity, ERXRestRequestNode insertNode, com.webobjects.eoaccess.EOEntity parentEntity, com.webobjects.eocontrol.EOEnterpriseObject parentObject, java.lang.String parentKey, ERXRestContext context)
          Insert a new object of the given type into a parent object's keypath from an XML document.
 boolean isEOID(ERXRestKey restKey)
          Returns whether or not the given key value is the primary key of an EO.
 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.eocontrol.EOEnterpriseObject objectForNode(com.webobjects.eoaccess.EOEntity entity, ERXRestRequestNode node, ERXRestContext context)
          Returns the object that is associated with the given node.
 com.webobjects.eocontrol.EOEnterpriseObject objectFromNode(com.webobjects.eoaccess.EOEntity entity, ERXRestRequestNode node, ERXRestContext context)
           
 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.
 com.webobjects.eocontrol.EOEnterpriseObject objectWithKey(com.webobjects.eoaccess.EOEntity entity, java.lang.String key, ERXRestContext context)
          Returns the object that has the given key.
 com.webobjects.eocontrol.EOEnterpriseObject objectWithKey(com.webobjects.eoaccess.EOEntity entity, java.lang.String key, com.webobjects.foundation.NSArray objs, ERXRestContext context)
          Returns the object that has the given key from the provided array.
 void preprocess(com.webobjects.eoaccess.EOEntity entity, com.webobjects.foundation.NSArray objects, ERXRestContext context)
          Called before enumerating the given array of objects for display.
 com.webobjects.eocontrol.EOEnterpriseObject processObjectFromDocument(com.webobjects.eoaccess.EOEntity entity, ERXRestRequestNode eoNode, ERXRestContext context)
          Inserts or updates an object of the given type.
 java.lang.String propertyAliasForPropertyNamed(com.webobjects.eoaccess.EOEntity entity, java.lang.String propertyName)
          Just like for entity names, it may be necessary to rename certain properties of your entities for consumers of your restful service.
 java.lang.String propertyNameForPropertyAlias(com.webobjects.eoaccess.EOEntity entity, java.lang.String propertyAlias)
          The inverse of propertyAliasForPropertyNamed.
 java.lang.String stringIDForEO(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo)
          Returns the string form of the primary key of the given EO.
 void takeValueForKey(com.webobjects.eoaccess.EOEntity entity, java.lang.Object obj, java.lang.String propertyName, java.lang.String value, ERXRestContext context)
          Sets the value for the specified property name on the given object.
 void updateArrayFromDocument(com.webobjects.eoaccess.EOEntity parentEntity, com.webobjects.eocontrol.EOEnterpriseObject parentObject, java.lang.String attributeName, com.webobjects.eoaccess.EOEntity entity, com.webobjects.foundation.NSArray currentObjects, com.webobjects.foundation.NSArray toManyNodes, ERXRestContext context)
          Updates an array of objects for a to-many relationship from an XML document.
 void updated(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestContext context)
           
 void updateObjectFromDocument(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, ERXRestRequestNode eoNode, ERXRestContext context)
          Updates an existing object from an XML document.
 java.lang.Object valueForKey(com.webobjects.eoaccess.EOEntity entity, java.lang.Object obj, java.lang.String propertyName, ERXRestContext context)
          Returns the value for the specified property name on the given object.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXDenyRestEntityDelegate

public ERXDenyRestEntityDelegate()
Method Detail

initializeEntityNamed

public void initializeEntityNamed(java.lang.String entityName)
Description copied from interface: IERXRestEntityDelegate
Called by the rest delegate for each entity that gets requested. This is called every time, so your entity delegate should manage only executing one time if necessary.

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

entityAliasForEntityNamed

public java.lang.String entityAliasForEntityNamed(java.lang.String entityName)
Description copied from interface: IERXRestEntityDelegate
Returns the alias for the given entity name. It is often the case that the actual name of the entity in your model may not be the name that you want to expose to the outside world. From this method, you can return the externally visible name. This method should never return null (just return entityName if you don't have an alias), and you will only get requests for entities that you are registered for.

Specified by:
entityAliasForEntityNamed in interface IERXRestEntityDelegate
Parameters:
entityName - the name of the entity to lookup
Returns:
the alias for the given entity name

propertyNameForPropertyAlias

public java.lang.String propertyNameForPropertyAlias(com.webobjects.eoaccess.EOEntity entity,
                                                     java.lang.String propertyAlias)
Description copied from interface: IERXRestEntityDelegate
The inverse of propertyAliasForPropertyNamed. Entity names are known, but property names aren't. So the inverse lookup must be provided. You must always provide an inverse lookup that matches the corresponding lookup from propertyAliasForPropertyNamed, and you must never return null form this method (just return propertyAlias if there is no alias).

Specified by:
propertyNameForPropertyAlias in interface IERXRestEntityDelegate
Parameters:
entity - the entity that contains the property
propertyAlias - the alias to lookup
Returns:
the original property names for the given alias

propertyAliasForPropertyNamed

public java.lang.String propertyAliasForPropertyNamed(com.webobjects.eoaccess.EOEntity entity,
                                                      java.lang.String propertyName)
Description copied from interface: IERXRestEntityDelegate
Just like for entity names, it may be necessary to rename certain properties of your entities for consumers of your restful service. This method should return the alias for the given propertyName for the given entity. This method should never return null (just return propertyName if you don't have an alias), and you will only get requests for entities that you are registered for.

Specified by:
propertyAliasForPropertyNamed in interface IERXRestEntityDelegate
Parameters:
entity - the entity that contains the property
propertyName - the property name
Returns:
the alias for the given property name

idForEO

public java.lang.Object idForEO(com.webobjects.eoaccess.EOEntity entity,
                                com.webobjects.eocontrol.EOEnterpriseObject eo)
Description copied from interface: IERXRestEntityDelegate
Returns the primary key of the given EO.

Specified by:
idForEO in interface IERXRestEntityDelegate
eo - the EO to get a primary key for
Returns:
the primary key

isEOID

public boolean isEOID(ERXRestKey restKey)
Description copied from interface: IERXRestEntityDelegate
Returns whether or not the given key value is the primary key of an EO. This is crazy -- It tries to guess if it's looking at a key or not.

Specified by:
isEOID in interface IERXRestEntityDelegate
Parameters:
restKey - the possible EO key
Returns:
true if key is a primary key

stringIDForEO

public java.lang.String stringIDForEO(com.webobjects.eoaccess.EOEntity entity,
                                      com.webobjects.eocontrol.EOEnterpriseObject eo)
Description copied from interface: IERXRestEntityDelegate
Returns the string form of the primary key of the given EO.

Specified by:
stringIDForEO in interface IERXRestEntityDelegate
eo - the EO to get a primary key for
Returns:
the primary key

processObjectFromDocument

public com.webobjects.eocontrol.EOEnterpriseObject processObjectFromDocument(com.webobjects.eoaccess.EOEntity entity,
                                                                             ERXRestRequestNode eoNode,
                                                                             ERXRestContext context)
                                                                      throws ERXRestSecurityException,
                                                                             ERXRestException,
                                                                             ERXRestNotFoundException
Description copied from interface: IERXRestEntityDelegate
Inserts or updates an object of the given type.

Specified by:
processObjectFromDocument in interface IERXRestEntityDelegate
Parameters:
entity - the entity of the object to insert or update
eoNode - the node that describes the insert or update
context - the rest context
Returns:
the inserted or updated object
Throws:
ERXRestSecurityException - if a security failure occurs
ERXRestException - if a general failure occurs
ERXRestNotFoundException - if a related object cannot be found

objectWithKey

public com.webobjects.eocontrol.EOEnterpriseObject objectWithKey(com.webobjects.eoaccess.EOEntity entity,
                                                                 java.lang.String key,
                                                                 ERXRestContext context)
                                                          throws ERXRestException,
                                                                 ERXRestNotFoundException,
                                                                 ERXRestSecurityException
Description copied from interface: IERXRestEntityDelegate
Returns the object that has the given key. In all of the provided implementations, key is interpreted to be an integer primary key in string form.

Specified by:
objectWithKey in interface IERXRestEntityDelegate
Parameters:
entity - the entity
key - the unique key for an object
context - the rest context
Returns:
the matching object
Throws:
ERXRestException - if a general failure occurs
ERXRestNotFoundException - if there is no object with the given key
ERXRestSecurityException - if the caller is not permitted to view the requested object

objectForNode

public com.webobjects.eocontrol.EOEnterpriseObject objectForNode(com.webobjects.eoaccess.EOEntity entity,
                                                                 ERXRestRequestNode node,
                                                                 ERXRestContext context)
                                                          throws ERXRestException,
                                                                 ERXRestNotFoundException,
                                                                 ERXRestSecurityException
Description copied from interface: IERXRestEntityDelegate
Returns the object that is associated with the given node.

Specified by:
objectForNode in interface IERXRestEntityDelegate
Parameters:
entity - the entity
node - the node that represents the object
context - the rest context
Returns:
the matching object
Throws:
ERXRestException - if a general failure occurs
ERXRestNotFoundException - if there is no object with the given key
ERXRestSecurityException - if the caller is not permitted to view the requested object

objectFromNode

public com.webobjects.eocontrol.EOEnterpriseObject objectFromNode(com.webobjects.eoaccess.EOEntity entity,
                                                                  ERXRestRequestNode node,
                                                                  ERXRestContext context)
                                                           throws ERXRestException,
                                                                  ERXRestNotFoundException,
                                                                  ERXRestSecurityException
Throws:
ERXRestException
ERXRestNotFoundException
ERXRestSecurityException

objectWithKey

public com.webobjects.eocontrol.EOEnterpriseObject objectWithKey(com.webobjects.eoaccess.EOEntity entity,
                                                                 java.lang.String key,
                                                                 com.webobjects.foundation.NSArray objs,
                                                                 ERXRestContext context)
                                                          throws ERXRestException,
                                                                 ERXRestSecurityException,
                                                                 ERXRestNotFoundException
Description copied from interface: IERXRestEntityDelegate
Returns the object that has the given key from the provided array. This is just like objectWithKey except limited to an array instead of the entire set of objects for the entity. In all of the provided implementations, key is interpreted to be an integer primary key in string form.

Specified by:
objectWithKey in interface IERXRestEntityDelegate
Parameters:
entity - the entity
key - the unique key for an object
objs - the objects to restrict the match to
context - the rest context
Returns:
the matching object
Throws:
ERXRestException - if a general failure occurs
ERXRestSecurityException - if the caller is not permitted to view the requested object
ERXRestNotFoundException - if there is no object in the array with the given key

insertObjectFromDocument

public com.webobjects.eocontrol.EOEnterpriseObject insertObjectFromDocument(com.webobjects.eoaccess.EOEntity entity,
                                                                            ERXRestRequestNode insertNode,
                                                                            com.webobjects.eoaccess.EOEntity parentEntity,
                                                                            com.webobjects.eocontrol.EOEnterpriseObject parentObject,
                                                                            java.lang.String parentKey,
                                                                            ERXRestContext context)
                                                                     throws ERXRestSecurityException,
                                                                            ERXRestException,
                                                                            ERXRestNotFoundException
Description copied from interface: IERXRestEntityDelegate
Insert a new object of the given type into a parent object's keypath from an XML document.

Specified by:
insertObjectFromDocument in interface IERXRestEntityDelegate
Parameters:
entity - the entity of the object to insert
insertNode - the node that describes the insert
parentEntity - the entity of the parent object to insert into
parentObject - the parent object of the insert
parentKey - the key on the parent that represents the relationship to this new object
context - the rest context
Returns:
the newly created object
Throws:
ERXRestSecurityException - if a security failure occurs
ERXRestException - if a general failure occurs
ERXRestNotFoundException - if a related object cannot be found

updateArrayFromDocument

public void updateArrayFromDocument(com.webobjects.eoaccess.EOEntity parentEntity,
                                    com.webobjects.eocontrol.EOEnterpriseObject parentObject,
                                    java.lang.String attributeName,
                                    com.webobjects.eoaccess.EOEntity entity,
                                    com.webobjects.foundation.NSArray currentObjects,
                                    com.webobjects.foundation.NSArray toManyNodes,
                                    ERXRestContext context)
                             throws ERXRestException,
                                    ERXRestNotFoundException,
                                    ERXRestSecurityException
Description copied from interface: IERXRestEntityDelegate
Updates an array of objects for a to-many relationship from an XML document. This method is responsible for deleting and inserting objects into the specified relationship.

Specified by:
updateArrayFromDocument in interface IERXRestEntityDelegate
Parameters:
parentEntity - the entity of the parent object
parentObject - the parent object
attributeName - the name of the to-many key on the parent
entity - the entity of the objects in the array
currentObjects - the existing objects in the to-many relationship
toManyNodes - the array containing the nodes that describe the update
context - the rest context
Throws:
ERXRestException - if a general failure occurs
ERXRestNotFoundException - if a related object cannot be found
ERXRestSecurityException - if a security failure occurs

updateObjectFromDocument

public void updateObjectFromDocument(com.webobjects.eoaccess.EOEntity entity,
                                     com.webobjects.eocontrol.EOEnterpriseObject eo,
                                     ERXRestRequestNode eoNode,
                                     ERXRestContext context)
                              throws ERXRestSecurityException,
                                     ERXRestException,
                                     ERXRestNotFoundException
Description copied from interface: IERXRestEntityDelegate
Updates an existing object from an XML document.

Specified by:
updateObjectFromDocument in interface IERXRestEntityDelegate
Parameters:
entity - the entity of the object to update
eo - the object to update
eoNode - the node that describes the update
context - the rest context
Throws:
ERXRestSecurityException - if a security failure occurs
ERXRestException - if a general failure occurs
ERXRestNotFoundException - if a related object cannot be found

formatAttributeValue

public java.lang.String formatAttributeValue(com.webobjects.eoaccess.EOEntity entity,
                                             java.lang.Object object,
                                             java.lang.String attributeName,
                                             java.lang.Object attributeValue)
                                      throws java.text.ParseException,
                                             ERXRestException
Description copied from interface: IERXRestEntityDelegate
Coerce the given value into a String for use in the restful response. This may move to the RestResponseWriter at some point, but it's kind of a strange design issue.

Specified by:
formatAttributeValue in interface IERXRestEntityDelegate
Parameters:
entity - the entity of the object
object - the object
attributeName - the name of the key
attributeValue - the value of the key to format
Returns:
the formatted string for the attributeValue
Throws:
ParseException - if a parse error occurs
ERXRestException - if a general error occurs

takeValueForKey

public void takeValueForKey(com.webobjects.eoaccess.EOEntity entity,
                            java.lang.Object obj,
                            java.lang.String propertyName,
                            java.lang.String value,
                            ERXRestContext context)
                     throws java.text.ParseException,
                            ERXRestException
Description copied from interface: IERXRestEntityDelegate
Sets the value for the specified property name on the given object. Notice that the value is a String. You will need to parse the String appropriately to coerce it into the property type for the property. This method does not need to deal with security issues.

Specified by:
takeValueForKey in interface IERXRestEntityDelegate
Parameters:
entity - the entity of the object
obj - the object to set a property on
propertyName - the property name to set
value - the new value of the property
context - the rest context
Throws:
ParseException - if the property value cannot be parsed
ERXRestException - if a general failure occurs.

valueForKey

public java.lang.Object valueForKey(com.webobjects.eoaccess.EOEntity entity,
                                    java.lang.Object obj,
                                    java.lang.String propertyName,
                                    ERXRestContext context)
Description copied from interface: IERXRestEntityDelegate
Returns the value for the specified property name on the given object. This method does not need to deal with security issues.

Specified by:
valueForKey in interface IERXRestEntityDelegate
Parameters:
entity - the entity of the given object
obj - the object itself
propertyName - the property name to lookup
context - the rest context
Returns:
the value for the given property

delete

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

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

updated

public void updated(com.webobjects.eoaccess.EOEntity entity,
                    com.webobjects.eocontrol.EOEnterpriseObject eo,
                    ERXRestContext context)
             throws ERXRestException
Throws:
ERXRestException

inserted

public void inserted(com.webobjects.eoaccess.EOEntity entity,
                     com.webobjects.eocontrol.EOEnterpriseObject eo,
                     ERXRestContext context)
              throws ERXRestException
Throws:
ERXRestException

canInsertProperty

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

Specified by:
canInsertProperty in interface IERXRestSecurityDelegate
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

canUpdateProperty

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

Specified by:
canUpdateProperty in interface IERXRestSecurityDelegate
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

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.

Specified by:
objectsForEntity in interface IERXRestEntityDelegate
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.

Specified by:
canInsertObject in interface IERXRestSecurityDelegate
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.

Specified by:
canInsertObject in interface IERXRestSecurityDelegate
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.

Specified by:
canDeleteObject in interface IERXRestSecurityDelegate
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

Specified by:
canUpdateObject in interface IERXRestSecurityDelegate
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.

Specified by:
canViewObject in interface IERXRestSecurityDelegate
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.

Specified by:
canViewProperty in interface IERXRestSecurityDelegate
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

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.

Specified by:
visibleObjects in interface IERXRestEntityDelegate
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

preprocess

public void preprocess(com.webobjects.eoaccess.EOEntity entity,
                       com.webobjects.foundation.NSArray objects,
                       ERXRestContext context)
                throws ERXRestException
Description copied from interface: IERXRestEntityDelegate
Called before enumerating the given array of objects for display. This provides an opportunity to prefetch any of the properties that will be displayed.

Specified by:
preprocess in interface IERXRestEntityDelegate
Parameters:
entity - the entity of the objects
objects - the objects to be displayed
Throws:
ERXRestException - if there is a general failure

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.

Specified by:
nextEntity in interface IERXRestEntityDelegate
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)

displayDetails

public boolean displayDetails(ERXRestKey key,
                              ERXRestContext context)
Specified by:
displayDetails in interface IERXRestEntityDelegate

displayProperties

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

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

Copyright © 2002 – 2007 Project Wonder.