Project Wonder 5.0

er.rest.entityDelegates
Class ERXDictionaryRestResponseWriter

java.lang.Object
  extended by er.rest.entityDelegates.ERXAbstractRestResponseWriter
      extended by er.rest.entityDelegates.ERXDictionaryRestResponseWriter
All Implemented Interfaces:
IERXRestResponseWriter

public class ERXDictionaryRestResponseWriter
extends ERXAbstractRestResponseWriter

Provides the common output methods for generating a dictionary response, which can be used by several other writers (json, plist, etc).

Author:
mschrag

Field Summary
 
Fields inherited from interface er.rest.entityDelegates.IERXRestResponseWriter
DETAILS_PREFIX, DETAILS_PROPERTIES_PREFIX, REST_PREFIX
 
Constructor Summary
ERXDictionaryRestResponseWriter()
          Constructs an ERXDictionaryRestResponseWriter with displayAllProperties = false.
ERXDictionaryRestResponseWriter(boolean displayAllProperties, boolean displayAllToMany)
          Constructs an ERXDictionaryRestResponseWriter.
ERXDictionaryRestResponseWriter(ERXKeyFilter filter)
          Constructs an ERXDictionaryRestResponseWriter.
 
Method Summary
protected  void addToCollection(java.lang.String name, java.lang.Object value)
           
protected  void appendArrayToResponse(ERXRestContext context, IERXRestResponse response, ERXRestKey result, java.lang.String arrayName, java.lang.String entityName, com.webobjects.foundation.NSArray valueKeys, int indent, com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects)
          Writes the given array of objects to the response.
protected  void appendDetailsToResponse(ERXRestContext context, IERXRestResponse response, com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String objectName, java.lang.String entityName, java.lang.Object id, com.webobjects.foundation.NSArray displayKeys, int indent, com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects)
          Writes the visible details of an object to the response.
protected  void appendNoDetailsToResponse(ERXRestContext context, IERXRestResponse response, com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String objectName, java.lang.String entityName, java.lang.Object id, int indent)
          Write an object to the response without showing its details.
protected  void appendPrimitiveToResponse(ERXRestContext context, IERXRestResponse response, ERXRestKey result, int indent, java.lang.Object value)
          Writes the bare primitive out to the response.
protected  void appendVisitedToResponse(ERXRestContext context, IERXRestResponse response, com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String objectName, java.lang.String entityName, java.lang.Object id, int indent)
          Write an object to the response that has already been visited.
 java.lang.Object current()
           
 java.lang.Object root()
           
 
Methods inherited from class er.rest.entityDelegates.ERXAbstractRestResponseWriter
appendArrayToResponse, appendDictionaryToResponse, appendToResponse, appendToResponse, displayDetails, displayProperties, indent, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXDictionaryRestResponseWriter

public ERXDictionaryRestResponseWriter()
Constructs an ERXDictionaryRestResponseWriter with displayAllProperties = false.


ERXDictionaryRestResponseWriter

public ERXDictionaryRestResponseWriter(boolean displayAllProperties,
                                       boolean displayAllToMany)
Constructs an ERXDictionaryRestResponseWriter.

Parameters:
displayAllProperties - if true, by default all properties are eligible to be displayed (probably should only be true in development, but it won't really hurt anything). Note that entity delegates will still control permissions on the properties, it just defaults to checking all of them.
displayAllToMany - if true, all to-many relationships will be displayed

ERXDictionaryRestResponseWriter

public ERXDictionaryRestResponseWriter(ERXKeyFilter filter)
Constructs an ERXDictionaryRestResponseWriter.

Parameters:
filter - the filter to apply to the written results
Method Detail

root

public java.lang.Object root()

current

public java.lang.Object current()

addToCollection

protected void addToCollection(java.lang.String name,
                               java.lang.Object value)

appendArrayToResponse

protected void appendArrayToResponse(ERXRestContext context,
                                     IERXRestResponse response,
                                     ERXRestKey result,
                                     java.lang.String arrayName,
                                     java.lang.String entityName,
                                     com.webobjects.foundation.NSArray valueKeys,
                                     int indent,
                                     com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects)
                              throws ERXRestException,
                                     ERXRestSecurityException,
                                     ERXRestNotFoundException,
                                     java.text.ParseException
Description copied from class: ERXAbstractRestResponseWriter
Writes the given array of objects to the response. Permissions have already been checked by the time this method is called.

Specified by:
appendArrayToResponse in class ERXAbstractRestResponseWriter
Parameters:
context - the rest context
response - the response
result - the current key
arrayName - the name of the array in the context of its parent
entityName - the entity name of the contents of the array
valueKeys - an array of ERXRestKeys that represent the entries in the array
indent - the indent level
visitedObjects - the list of objects that have been visited already in this request (to prevent infinite loops)
Throws:
ERXRestException - if a general error occurs
ERXRestSecurityException - if a security error occurs
ERXRestNotFoundException - if an object is not found
ParseException - if a parse error occurs

appendVisitedToResponse

protected void appendVisitedToResponse(ERXRestContext context,
                                       IERXRestResponse response,
                                       com.webobjects.eoaccess.EOEntity entity,
                                       com.webobjects.eocontrol.EOEnterpriseObject eo,
                                       java.lang.String objectName,
                                       java.lang.String entityName,
                                       java.lang.Object id,
                                       int indent)
Description copied from class: ERXAbstractRestResponseWriter
Write an object to the response that has already been visited. Typically this would just write out the type and id of the object, to prevent entering an infinite loop in the renderer. Permissions have already been checked by the time this method is called.

Specified by:
appendVisitedToResponse in class ERXAbstractRestResponseWriter
Parameters:
context - the rest context
response - the response
entity - the entity of the object
eo - the current object
objectName - the name of the object (relative to its parent)
entityName - the entity name of the object
id - the id of the object
indent - the indent level

appendNoDetailsToResponse

protected void appendNoDetailsToResponse(ERXRestContext context,
                                         IERXRestResponse response,
                                         com.webobjects.eoaccess.EOEntity entity,
                                         com.webobjects.eocontrol.EOEnterpriseObject eo,
                                         java.lang.String objectName,
                                         java.lang.String entityName,
                                         java.lang.Object id,
                                         int indent)
Description copied from class: ERXAbstractRestResponseWriter
Write an object to the response without showing its details. This is typically similar to appendVisitedToResponse, but is provided as a separate call because it is semantically a different scenario. Permissions have already been checked by the time this method is called.

Specified by:
appendNoDetailsToResponse in class ERXAbstractRestResponseWriter
Parameters:
context - the rest context
response - the response
entity - the entity of the object
eo - the current object
objectName - the name of the object (relative to its parent)
entityName - the entity name of the object
id - the id of the object
indent - the indent level

appendDetailsToResponse

protected void appendDetailsToResponse(ERXRestContext context,
                                       IERXRestResponse response,
                                       com.webobjects.eoaccess.EOEntity entity,
                                       com.webobjects.eocontrol.EOEnterpriseObject eo,
                                       java.lang.String objectName,
                                       java.lang.String entityName,
                                       java.lang.Object id,
                                       com.webobjects.foundation.NSArray displayKeys,
                                       int indent,
                                       com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects)
                                throws ERXRestException,
                                       ERXRestSecurityException,
                                       ERXRestNotFoundException,
                                       java.text.ParseException
Description copied from class: ERXAbstractRestResponseWriter
Writes the visible details of an object to the response. Permissions have already been checked by the time this method is called.

Specified by:
appendDetailsToResponse in class ERXAbstractRestResponseWriter
Parameters:
context - the rest context
response - the response
entity - the entity of the object
eo - the current object
objectName - the name of the object (relative to its parent)
entityName - the entity name of the object
id - the id of the object
displayKeys - the list of ERXRestKeys to display
indent - the indent level
visitedObjects - the list of objects that have been visited already in this request (to prevent infinite loops)
Throws:
ERXRestException - if a general error occurs
ERXRestSecurityException - if a security error occurs
ERXRestNotFoundException - if an object is not found
ParseException - if a parse error occurs

appendPrimitiveToResponse

protected void appendPrimitiveToResponse(ERXRestContext context,
                                         IERXRestResponse response,
                                         ERXRestKey result,
                                         int indent,
                                         java.lang.Object value)
                                  throws ERXRestException
Description copied from class: ERXAbstractRestResponseWriter
Writes the bare primitive out to the response. Permissions have already been checked by the time this method is called.

Specified by:
appendPrimitiveToResponse in class ERXAbstractRestResponseWriter
Parameters:
context - the rest context
response - the response
result - the current key
indent - the indent level
value - the value to append
Throws:
ERXRestException - if a general failure occurs

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

Copyright © 2002 – 2007 Project Wonder.