Project Wonder 5.0

er.rest.entityDelegates
Class ERXDefaultRestDelegate

java.lang.Object
  extended by er.rest.entityDelegates.ERXDefaultRestDelegate
All Implemented Interfaces:
IERXRestDelegate
Direct Known Subclasses:
ERD2RestDelegate

public class ERXDefaultRestDelegate
extends java.lang.Object
implements IERXRestDelegate

ERXDefaultRestDelegate is the default implementation of the IERXRestDelegate interface. It provides support for registering custom IERXRestEntityDelegates for specific entities.

Author:
mschrag

Constructor Summary
ERXDefaultRestDelegate()
          Constructs an ERXDefaultRestDelegate with an ERXDenyRestEntityDelegate as the default entity delegate.
ERXDefaultRestDelegate(boolean guessDelegateNames)
          Constructs an ERXDefaultRestDelegate with an ERXDenyRestEntityDelegate as the default entity delegate.
ERXDefaultRestDelegate(IERXRestEntityDelegate defaultDelegate)
          Constructs an ERXDefaultRestDelegate with the given default entity delegate and with delegate name guessing turned on.
ERXDefaultRestDelegate(IERXRestEntityDelegate defaultDelegate, boolean guessDelegateNames)
          Constructs an ERXDefaultRestDelegate with the given default entity delegate.
 
Method Summary
 void addDelegateForEntityNamed(IERXRestEntityDelegate entityDelegate, java.lang.String entityName)
          Call this method to register an entity-specific delegate for a particular entity name.
 void delete(ERXRestRequest deleteRequest, ERXRestContext context)
          Deletes the given object (NSArray of EOEnterpriseObject).
 IERXRestEntityDelegate entityDelegate(com.webobjects.eoaccess.EOEntity entity)
          Returns the per-entity rest delegate.
 java.lang.String entityNameForAlias(java.lang.String entityAlias)
          Returns the actual name for the entity from its aliased name.
 ERXRestKey insert(ERXRestRequest insertRequest, ERXRestContext context)
          Creates the objects defined by the XML document (which can contain a single object or an array inserts).
protected  ERXRestKey insertInto(com.webobjects.eoaccess.EOEntity entity, ERXRestRequest insertRequest, com.webobjects.eoaccess.EOEntity parentEntity, com.webobjects.eocontrol.EOEnterpriseObject parentObject, java.lang.String parentKey, ERXRestContext context)
           
 ERXRestKey process(ERXRestRequest restRequest, ERXRestContext context)
          Inserts or updates the objects defined by the XML document.
 void removeDelegateForEntityNamed(java.lang.String entityName)
          Removes the delegate for the given entity name.
 void update(ERXRestRequest updateRequest, ERXRestContext context)
          Updates the objects defined by the XML document (which can contain partial updates or array updates).
 ERXRestKey view(ERXRestRequest restRequest, ERXRestContext restContext)
          Views the object defined by the incoming url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXDefaultRestDelegate

public ERXDefaultRestDelegate()
Constructs an ERXDefaultRestDelegate with an ERXDenyRestEntityDelegate as the default entity delegate.


ERXDefaultRestDelegate

public ERXDefaultRestDelegate(boolean guessDelegateNames)
Constructs an ERXDefaultRestDelegate with an ERXDenyRestEntityDelegate as the default entity delegate.

Parameters:
guessDelegateNames - if true, delegates names will be guessed "RestEntityDelegate" before falling back to the default

ERXDefaultRestDelegate

public ERXDefaultRestDelegate(IERXRestEntityDelegate defaultDelegate)
Constructs an ERXDefaultRestDelegate with the given default entity delegate and with delegate name guessing turned on. If no entity delegate is specified for a particular entity name, the default delegate will be returned.

Parameters:
defaultDelegate - the default entity delegate to use

ERXDefaultRestDelegate

public ERXDefaultRestDelegate(IERXRestEntityDelegate defaultDelegate,
                              boolean guessDelegateNames)
Constructs an ERXDefaultRestDelegate with the given default entity delegate. If no entity delegate is specified for a particular entity name, the default delegate will be returned.

Parameters:
defaultDelegate - the default entity delegate to use
guessDelegateNames - if true, delegates names will be guessed "RestEntityDelegate" before falling back to the default
Method Detail

process

public ERXRestKey process(ERXRestRequest restRequest,
                          ERXRestContext context)
                   throws ERXRestException,
                          ERXRestSecurityException,
                          ERXRestNotFoundException
Description copied from interface: IERXRestDelegate
Inserts or updates the objects defined by the XML document.

Specified by:
process in interface IERXRestDelegate
Parameters:
restRequest - the incoming inserts or updates
context - the rest context
Returns:
the inserted or updates objects as an ERXRestResult
Throws:
ERXRestException - if there is a general failure
ERXRestSecurityException - if the user attempts to insert or updates objects that he/she is not permitted to
ERXRestNotFoundException - if one of the requested objects does not exist

view

public ERXRestKey view(ERXRestRequest restRequest,
                       ERXRestContext restContext)
Description copied from interface: IERXRestDelegate
Views the object defined by the incoming url.

Specified by:
view in interface IERXRestDelegate
Parameters:
restRequest - the incoming viewing request.
restContext - the rest context
Returns:
the actual result as an ERXRestResult

insert

public ERXRestKey insert(ERXRestRequest insertRequest,
                         ERXRestContext context)
                  throws ERXRestException,
                         ERXRestSecurityException,
                         ERXRestNotFoundException
Description copied from interface: IERXRestDelegate
Creates the objects defined by the XML document (which can contain a single object or an array inserts).

Specified by:
insert in interface IERXRestDelegate
Parameters:
insertRequest - the incoming inserts
context - the rest context
Returns:
the inserted objects as an ERXRestResult
Throws:
ERXRestException - if there is a general failure
ERXRestSecurityException - if the user attempts to insert objects that he/she is not permitted to insert
ERXRestNotFoundException - if one of the requested objects does not exist

insertInto

protected ERXRestKey insertInto(com.webobjects.eoaccess.EOEntity entity,
                                ERXRestRequest insertRequest,
                                com.webobjects.eoaccess.EOEntity parentEntity,
                                com.webobjects.eocontrol.EOEnterpriseObject parentObject,
                                java.lang.String parentKey,
                                ERXRestContext context)
                         throws ERXRestSecurityException,
                                ERXRestException,
                                ERXRestNotFoundException
Throws:
ERXRestSecurityException
ERXRestException
ERXRestNotFoundException

update

public void update(ERXRestRequest updateRequest,
                   ERXRestContext context)
            throws ERXRestException,
                   ERXRestSecurityException,
                   ERXRestNotFoundException
Description copied from interface: IERXRestDelegate
Updates the objects defined by the XML document (which can contain partial updates or array updates).

Specified by:
update in interface IERXRestDelegate
Parameters:
updateRequest - the incoming updates
context - the rest context
Throws:
ERXRestException - if there is a general failure
ERXRestSecurityException - if the user attempts to update objects that he/she is not permitted to update
ERXRestNotFoundException - if one of the requested objects does not exist

delete

public void delete(ERXRestRequest deleteRequest,
                   ERXRestContext context)
            throws ERXRestException,
                   ERXRestSecurityException,
                   ERXRestNotFoundException
Description copied from interface: IERXRestDelegate
Deletes the given object (NSArray of EOEnterpriseObject).

Specified by:
delete in interface IERXRestDelegate
Parameters:
deleteRequest - the incoming delete
context - the rest context
Throws:
ERXRestException - if there is a general failure
ERXRestSecurityException - if the user attempts to delete objects that he/she is not permitted to delete
ERXRestNotFoundException - if one of the requested objects does not exist

entityNameForAlias

public java.lang.String entityNameForAlias(java.lang.String entityAlias)
Description copied from interface: IERXRestDelegate
Returns the actual name for the entity from its aliased name. The mappings for aliases is acquired when entity delegates are registered by calling entityAliasForEntityNamed.

Specified by:
entityNameForAlias in interface IERXRestDelegate
Parameters:
entityAlias - the entity alias
Returns:
the actual entity name

entityDelegate

public IERXRestEntityDelegate entityDelegate(com.webobjects.eoaccess.EOEntity entity)
Description copied from interface: IERXRestDelegate
Returns the per-entity rest delegate.

Specified by:
entityDelegate in interface IERXRestDelegate
Parameters:
entity - the entity
Returns:
the per-entity rest delegate

addDelegateForEntityNamed

public void addDelegateForEntityNamed(IERXRestEntityDelegate entityDelegate,
                                      java.lang.String entityName)
Call this method to register an entity-specific delegate for a particular entity name.

Parameters:
entityDelegate - the entity delegate
entityName - the entity name to associate the delegate with

removeDelegateForEntityNamed

public void removeDelegateForEntityNamed(java.lang.String entityName)
Removes the delegate for the given entity name.

Parameters:
entityName - the name of the entity

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

Copyright © 2002 – 2007 Project Wonder.