ERXDenyRestEntityDelegate Class Reference

Inherits er::rest::entityDelegates::IERXRestEntityDelegate.

Collaboration diagram for ERXDenyRestEntityDelegate:

Collaboration graph
[legend]

List of all members.

Public Member Functions

boolean canDeleteObject (EOEntity entity, EOEnterpriseObject eo, ERXRestContext context)
boolean canInsertObject (EOEntity parentEntity, Object parentObject, String parentKey, EOEntity entity, ERXRestContext context)
boolean canInsertObject (EOEntity entity, ERXRestContext context)
boolean canInsertProperty (EOEntity entity, EOEnterpriseObject eo, String propertyName, ERXRestContext context)
boolean canUpdateObject (EOEntity entity, EOEnterpriseObject eo, ERXRestContext context)
boolean canUpdateProperty (EOEntity entity, EOEnterpriseObject eo, String propertyName, ERXRestContext context)
boolean canViewObject (EOEntity entity, EOEnterpriseObject eo, ERXRestContext context)
boolean canViewProperty (EOEntity entity, Object obj, String propertyName, ERXRestContext context)
void delete (EOEntity entity, EOEnterpriseObject eo, ERXRestContext context) throws ERXRestException
boolean displayDetails (ERXRestKey key, ERXRestContext context)
String[] displayProperties (ERXRestKey key, boolean allProperties, boolean allToMany, ERXRestContext context) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException
String entityAliasForEntityNamed (String entityName)
String formatAttributeValue (EOEntity entity, Object object, String attributeName, Object attributeValue) throws ParseException, ERXRestException
Object idForEO (EOEntity entity, EOEnterpriseObject eo)
void initializeEntityNamed (String entityName)
void inserted (EOEntity entity, EOEnterpriseObject eo, ERXRestContext context) throws ERXRestException
EOEnterpriseObject insertObjectFromDocument (EOEntity entity, ERXRestRequestNode insertNode, EOEntity parentEntity, EOEnterpriseObject parentObject, String parentKey, ERXRestContext context) throws ERXRestSecurityException, ERXRestException, ERXRestNotFoundException
boolean isEOID (ERXRestKey restKey)
EOEntity nextEntity (EOEntity entity, String key)
EOEnterpriseObject objectForNode (EOEntity entity, ERXRestRequestNode node, ERXRestContext context) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException
EOEnterpriseObject objectFromNode (EOEntity entity, ERXRestRequestNode node, ERXRestContext context) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException
NSArray objectsForEntity (EOEntity entity, ERXRestContext context)
EOEnterpriseObject objectWithKey (EOEntity entity, String key, NSArray objs, ERXRestContext context) throws ERXRestException, ERXRestSecurityException, ERXRestNotFoundException
EOEnterpriseObject objectWithKey (EOEntity entity, String key, ERXRestContext context) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException
void preprocess (EOEntity entity, NSArray objects, ERXRestContext context) throws ERXRestException
EOEnterpriseObject processObjectFromDocument (EOEntity entity, ERXRestRequestNode eoNode, ERXRestContext context) throws ERXRestSecurityException, ERXRestException, ERXRestNotFoundException
String propertyAliasForPropertyNamed (EOEntity entity, String propertyName)
String propertyNameForPropertyAlias (EOEntity entity, String propertyAlias)
String stringIDForEO (EOEntity entity, EOEnterpriseObject eo)
void takeValueForKey (EOEntity entity, Object obj, String propertyName, String value, ERXRestContext context) throws ParseException, ERXRestException
void updateArrayFromDocument (EOEntity parentEntity, EOEnterpriseObject parentObject, String attributeName, EOEntity entity, NSArray currentObjects, NSArray toManyNodes, ERXRestContext context) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException
void updated (EOEntity entity, EOEnterpriseObject eo, ERXRestContext context) throws ERXRestException
void updateObjectFromDocument (EOEntity entity, EOEnterpriseObject eo, ERXRestRequestNode eoNode, ERXRestContext context) throws ERXRestSecurityException, ERXRestException, ERXRestNotFoundException
Object valueForKey (EOEntity entity, Object obj, String propertyName, ERXRestContext context)
NSArray visibleObjects (EOEntity parentEntity, Object parent, String key, EOEntity entity, NSArray objects, ERXRestContext context)


Detailed Description

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

Member Function Documentation

boolean canDeleteObject ( EOEntity  entity,
EOEnterpriseObject  eo,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

boolean canInsertObject ( EOEntity  parentEntity,
Object  parentObject,
String  parentKey,
EOEntity  entity,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

boolean canInsertObject ( EOEntity  entity,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

boolean canInsertProperty ( EOEntity  entity,
EOEnterpriseObject  eo,
String  propertyName,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

boolean canUpdateObject ( EOEntity  entity,
EOEnterpriseObject  eo,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

boolean canUpdateProperty ( EOEntity  entity,
EOEnterpriseObject  eo,
String  propertyName,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

boolean canViewObject ( EOEntity  entity,
EOEnterpriseObject  eo,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

boolean canViewProperty ( EOEntity  entity,
Object  obj,
String  propertyName,
ERXRestContext  context 
) [virtual]

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

Implements IERXRestSecurityDelegate.

void delete ( EOEntity  entity,
EOEnterpriseObject  eo,
ERXRestContext  context 
) throws ERXRestException

Deletes the given object.

Parameters:
entity the entity of the object
eo the object to delete
context the rest context
Exceptions:
ERXRestException if a general failure occurs.
ERXRestSecurityException if a security failure occurs

Implements IERXRestEntityDelegate.

boolean displayDetails ( ERXRestKey  key,
ERXRestContext  context 
)

String [] displayProperties ( ERXRestKey  key,
boolean  allProperties,
boolean  allToMany,
ERXRestContext  context 
) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException

String entityAliasForEntityNamed ( String  entityName  ) 

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.

Parameters:
entityName the name of the entity to lookup
Returns:
the alias for the given entity name

Implements IERXRestEntityDelegate.

String formatAttributeValue ( EOEntity  entity,
Object  object,
String  attributeName,
Object  attributeValue 
) throws ParseException, ERXRestException

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.

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
Exceptions:
ParseException if a parse error occurs
ERXRestException if a general error occurs

Implements IERXRestEntityDelegate.

Object idForEO ( EOEntity  entity,
EOEnterpriseObject  eo 
)

Returns the primary key of the given EO.

Parameters:
eo the EO to get a primary key for
Returns:
the primary key

Implements IERXRestEntityDelegate.

void initializeEntityNamed ( String  entityName  ) 

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.

Parameters:
entityName the name of the entity to initialize

Implements IERXRestEntityDelegate.

void inserted ( EOEntity  entity,
EOEnterpriseObject  eo,
ERXRestContext  context 
) throws ERXRestException

EOEnterpriseObject insertObjectFromDocument ( EOEntity  entity,
ERXRestRequestNode  insertNode,
EOEntity  parentEntity,
EOEnterpriseObject  parentObject,
String  parentKey,
ERXRestContext  context 
) throws ERXRestSecurityException, ERXRestException, ERXRestNotFoundException

Insert a new object of the given type into a parent object's keypath from an XML document.

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
Exceptions:
ERXRestSecurityException if a security failure occurs
ERXRestException if a general failure occurs
ERXRestNotFoundException if a related object cannot be found

Implements IERXRestEntityDelegate.

boolean isEOID ( ERXRestKey  restKey  ) 

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.

Parameters:
restKey the possible EO key
Returns:
true if key is a primary key

Implements IERXRestEntityDelegate.

EOEntity nextEntity ( EOEntity  entity,
String  key 
)

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)

Implements IERXRestEntityDelegate.

EOEnterpriseObject objectForNode ( EOEntity  entity,
ERXRestRequestNode  node,
ERXRestContext  context 
) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException

Returns the object that is associated with the given node.

Parameters:
entity the entity
node the node that represents the object
context the rest context
Returns:
the matching object
Exceptions:
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

Implements IERXRestEntityDelegate.

EOEnterpriseObject objectFromNode ( EOEntity  entity,
ERXRestRequestNode  node,
ERXRestContext  context 
) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException

NSArray objectsForEntity ( EOEntity  entity,
ERXRestContext  context 
)

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
Exceptions:
ERXRestException if there is a general failure
ERXRestSecurityException if the user requests objects that he/she is not permitted to see

Implements IERXRestEntityDelegate.

EOEnterpriseObject objectWithKey ( EOEntity  entity,
String  key,
NSArray  objs,
ERXRestContext  context 
) throws ERXRestException, ERXRestSecurityException, ERXRestNotFoundException

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.

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
Exceptions:
ERXRestException if a general failure occurs
ERXRestNotFoundException if there is no object in the array with the given key
ERXRestSecurityException if the caller is not permitted to view the requested object

Implements IERXRestEntityDelegate.

EOEnterpriseObject objectWithKey ( EOEntity  entity,
String  key,
ERXRestContext  context 
) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException

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.

Parameters:
entity the entity
key the unique key for an object
context the rest context
Returns:
the matching object
Exceptions:
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

Implements IERXRestEntityDelegate.

void preprocess ( EOEntity  entity,
NSArray  objects,
ERXRestContext  context 
) throws ERXRestException

Called before enumerating the given array of objects for display. This provides an opportunity to prefetch any of the properties that will be displayed.

Parameters:
entity the entity of the objects
objects the objects to be displayed
Exceptions:
ERXRestException if there is a general failure

Implements IERXRestEntityDelegate.

EOEnterpriseObject processObjectFromDocument ( EOEntity  entity,
ERXRestRequestNode  eoNode,
ERXRestContext  context 
) throws ERXRestSecurityException, ERXRestException, ERXRestNotFoundException

Inserts or updates an object of the given type.

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
Exceptions:
ERXRestSecurityException if a security failure occurs
ERXRestException if a general failure occurs
ERXRestNotFoundException if a related object cannot be found

Implements IERXRestEntityDelegate.

String propertyAliasForPropertyNamed ( EOEntity  entity,
String  propertyName 
)

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.

Parameters:
entity the entity that contains the property
propertyName the property name
Returns:
the alias for the given property name

Implements IERXRestEntityDelegate.

String propertyNameForPropertyAlias ( EOEntity  entity,
String  propertyAlias 
)

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

Parameters:
entity the entity that contains the property
propertyAlias the alias to lookup
Returns:
the original property names for the given alias

Implements IERXRestEntityDelegate.

String stringIDForEO ( EOEntity  entity,
EOEnterpriseObject  eo 
)

Returns the string form of the primary key of the given EO.

Parameters:
eo the EO to get a primary key for
Returns:
the primary key

Implements IERXRestEntityDelegate.

void takeValueForKey ( EOEntity  entity,
Object  obj,
String  propertyName,
String  value,
ERXRestContext  context 
) throws ParseException, ERXRestException

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.

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
Exceptions:
ParseException if the property value cannot be parsed
ERXRestException if a general failure occurs.

Implements IERXRestEntityDelegate.

void updateArrayFromDocument ( EOEntity  parentEntity,
EOEnterpriseObject  parentObject,
String  attributeName,
EOEntity  entity,
NSArray  currentObjects,
NSArray  toManyNodes,
ERXRestContext  context 
) throws ERXRestException, ERXRestNotFoundException, ERXRestSecurityException

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.

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
Exceptions:
ERXRestSecurityException if a security failure occurs
ERXRestException if a general failure occurs
ERXRestNotFoundException if a related object cannot be found

Implements IERXRestEntityDelegate.

void updated ( EOEntity  entity,
EOEnterpriseObject  eo,
ERXRestContext  context 
) throws ERXRestException

void updateObjectFromDocument ( EOEntity  entity,
EOEnterpriseObject  eo,
ERXRestRequestNode  eoNode,
ERXRestContext  context 
) throws ERXRestSecurityException, ERXRestException, ERXRestNotFoundException

Updates an existing object from an XML document.

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
Exceptions:
ERXRestSecurityException if a security failure occurs
ERXRestException if a general failure occurs
ERXRestNotFoundException if a related object cannot be found

Implements IERXRestEntityDelegate.

Object valueForKey ( EOEntity  entity,
Object  obj,
String  propertyName,
ERXRestContext  context 
)

Returns the value for the specified property name on the given object. This method does not need to deal with security issues.

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

Implements IERXRestEntityDelegate.

NSArray visibleObjects ( EOEntity  parentEntity,
Object  parentObject,
String  parentKey,
EOEntity  entity,
NSArray  objects,
ERXRestContext  context 
)

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
Exceptions:
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

Implements IERXRestEntityDelegate.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:28 2012 for Project Wonder by  doxygen 1.5.8