org.apache.olingo.odata2.ref.processor
Class ListsProcessor

java.lang.Object
  extended by org.apache.olingo.odata2.api.processor.ODataSingleProcessor
      extended by org.apache.olingo.odata2.ref.processor.ListsProcessor
All Implemented Interfaces:
CustomContentType, ODataProcessorFeature, ODataProcessor, BatchProcessor, EntityComplexPropertyProcessor, EntityLinkProcessor, EntityLinksProcessor, EntityMediaProcessor, EntityProcessor, EntitySetProcessor, EntitySimplePropertyProcessor, EntitySimplePropertyValueProcessor, FunctionImportProcessor, FunctionImportValueProcessor, MetadataProcessor, ServiceDocumentProcessor

public class ListsProcessor
extends ODataSingleProcessor

Implementation of the centralized parts of OData processing, allowing to use the simplified DataSource for the actual data handling.


Constructor Summary
ListsProcessor(ScenarioDataSource dataSource)
           
ListsProcessor(ScenarioDataSource dataSource, BeanPropertyAccess valueAccess)
           
 
Method Summary
 ODataResponse countEntityLinks(GetEntitySetLinksCountUriInfo uriInfo, String contentType)
          Counts the number of target entities of a navigation property.
 ODataResponse countEntitySet(GetEntitySetCountUriInfo uriInfo, String contentType)
          Counts the number of requested entities.
 ODataResponse createEntity(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType)
          Creates an entity.
 ODataResponse createEntityLink(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType)
          Creates a new link to a target entity of a navigation property.
 ODataResponse deleteEntity(DeleteUriInfo uriInfo, String contentType)
          Deletes an entity.
 ODataResponse deleteEntityLink(DeleteUriInfo uriInfo, String contentType)
          Deletes the link to the target entity of a navigation property.
 ODataResponse deleteEntityMedia(DeleteUriInfo uriInfo, String contentType)
          Deletes the media resource of an entity.
 ODataResponse deleteEntitySimplePropertyValue(DeleteUriInfo uriInfo, String contentType)
          Deletes the value of a simple property of an entity.
 ODataResponse executeBatch(BatchHandler handler, String contentType, InputStream content)
          Executes a OData batch request and provide Batch Response as ODataResponse
 BatchResponsePart executeChangeSet(BatchHandler handler, List<ODataRequest> requests)
          Executes a Change Set and provide BatchResponsePart as BatchResponsePart that contains the responses to change requests.
 ODataResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, String contentType)
          Executes a function import and returns the result.
 ODataResponse executeFunctionImportValue(GetFunctionImportUriInfo uriInfo, String contentType)
          Returns the unformatted value of a function import.
 ODataResponse existsEntity(GetEntityCountUriInfo uriInfo, String contentType)
          Checks whether an entity exists.
 ODataResponse existsEntityLink(GetEntityLinkCountUriInfo uriInfo, String contentType)
          Returns whether the target entity of a navigation property exists.
 ODataResponse readEntity(GetEntityUriInfo uriInfo, String contentType)
          Reads an entity.
 ODataResponse readEntityComplexProperty(GetComplexPropertyUriInfo uriInfo, String contentType)
          Reads a complex property of an entity.
 ODataResponse readEntityLink(GetEntityLinkUriInfo uriInfo, String contentType)
          Reads the URI of the target entity of a navigation property.
 ODataResponse readEntityLinks(GetEntitySetLinksUriInfo uriInfo, String contentType)
          Reads the URIs of the target entities of a navigation property.
 ODataResponse readEntityMedia(GetMediaResourceUriInfo uriInfo, String contentType)
          Reads the media resource of an entity.
 ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType)
          Reads entities.
 ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType)
          Reads a simple property of an entity.
 ODataResponse readEntitySimplePropertyValue(GetSimplePropertyUriInfo uriInfo, String contentType)
          Reads the unformatted value of a simple property of an entity.
 ODataResponse updateEntity(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType)
          Updates an entity.
 ODataResponse updateEntityComplexProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType)
          Updates a complex property of an entity.
 ODataResponse updateEntityLink(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)
          Updates the link to the target entity of a navigation property.
 ODataResponse updateEntityMedia(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)
          Updates the media resource of an entity.
 ODataResponse updateEntitySimpleProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)
          Updates a simple property of an entity.
 ODataResponse updateEntitySimplePropertyValue(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)
          Updates a simple property of an entity with an unformatted value.
 
Methods inherited from class org.apache.olingo.odata2.api.processor.ODataSingleProcessor
getContext, getCustomContentTypes, readMetadata, readServiceDocument, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListsProcessor

public ListsProcessor(ScenarioDataSource dataSource)

ListsProcessor

public ListsProcessor(ScenarioDataSource dataSource,
                      BeanPropertyAccess valueAccess)
Method Detail

readEntitySet

public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo,
                                   String contentType)
                            throws ODataException
Description copied from interface: EntitySetProcessor
Reads entities.

Specified by:
readEntitySet in interface EntitySetProcessor
Overrides:
readEntitySet in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntitySetProcessor

countEntitySet

public ODataResponse countEntitySet(GetEntitySetCountUriInfo uriInfo,
                                    String contentType)
                             throws ODataException
Description copied from interface: EntitySetProcessor
Counts the number of requested entities.

Specified by:
countEntitySet in interface EntitySetProcessor
Overrides:
countEntitySet in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntitySetProcessor

readEntityLinks

public ODataResponse readEntityLinks(GetEntitySetLinksUriInfo uriInfo,
                                     String contentType)
                              throws ODataException
Description copied from interface: EntityLinksProcessor
Reads the URIs of the target entities of a navigation property.

Specified by:
readEntityLinks in interface EntityLinksProcessor
Overrides:
readEntityLinks in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an OData response object
Throws:
ODataException
See Also:
EntityLinksProcessor

countEntityLinks

public ODataResponse countEntityLinks(GetEntitySetLinksCountUriInfo uriInfo,
                                      String contentType)
                               throws ODataException
Description copied from interface: EntityLinksProcessor
Counts the number of target entities of a navigation property.

Specified by:
countEntityLinks in interface EntityLinksProcessor
Overrides:
countEntityLinks in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an OData response object
Throws:
ODataException
See Also:
EntityLinksProcessor

readEntity

public ODataResponse readEntity(GetEntityUriInfo uriInfo,
                                String contentType)
                         throws ODataException
Description copied from interface: EntityProcessor
Reads an entity.

Specified by:
readEntity in interface EntityProcessor
Overrides:
readEntity in class ODataSingleProcessor
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityProcessor

existsEntity

public ODataResponse existsEntity(GetEntityCountUriInfo uriInfo,
                                  String contentType)
                           throws ODataException
Description copied from interface: EntityProcessor
Checks whether an entity exists.

Specified by:
existsEntity in interface EntityProcessor
Overrides:
existsEntity in class ODataSingleProcessor
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityProcessor

deleteEntity

public ODataResponse deleteEntity(DeleteUriInfo uriInfo,
                                  String contentType)
                           throws ODataException
Description copied from interface: EntityProcessor
Deletes an entity.

Specified by:
deleteEntity in interface EntityProcessor
Overrides:
deleteEntity in class ODataSingleProcessor
Parameters:
uriInfo - a DeleteUriInfo object with information from the URI parser
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityProcessor

createEntity

public ODataResponse createEntity(PostUriInfo uriInfo,
                                  InputStream content,
                                  String requestContentType,
                                  String contentType)
                           throws ODataException
Description copied from interface: EntitySetProcessor
Creates an entity.

Specified by:
createEntity in interface EntitySetProcessor
Overrides:
createEntity in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request, containing the data of the new entity
requestContentType - the content type of the request body
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntitySetProcessor

updateEntity

public ODataResponse updateEntity(PutMergePatchUriInfo uriInfo,
                                  InputStream content,
                                  String requestContentType,
                                  boolean merge,
                                  String contentType)
                           throws ODataException
Description copied from interface: EntityProcessor
Updates an entity.

Specified by:
updateEntity in interface EntityProcessor
Overrides:
updateEntity in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request, containing the updated entity data
requestContentType - the content type of the request body
merge - if true, properties not present in the data are left unchanged; if false, they are reset
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityProcessor

readEntityLink

public ODataResponse readEntityLink(GetEntityLinkUriInfo uriInfo,
                                    String contentType)
                             throws ODataException
Description copied from interface: EntityLinkProcessor
Reads the URI of the target entity of a navigation property.

Specified by:
readEntityLink in interface EntityLinkProcessor
Overrides:
readEntityLink in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityLinkProcessor

existsEntityLink

public ODataResponse existsEntityLink(GetEntityLinkCountUriInfo uriInfo,
                                      String contentType)
                               throws ODataException
Description copied from interface: EntityLinkProcessor
Returns whether the target entity of a navigation property exists.

Specified by:
existsEntityLink in interface EntityLinkProcessor
Overrides:
existsEntityLink in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityLinkProcessor

deleteEntityLink

public ODataResponse deleteEntityLink(DeleteUriInfo uriInfo,
                                      String contentType)
                               throws ODataException
Description copied from interface: EntityLinkProcessor
Deletes the link to the target entity of a navigation property.

Specified by:
deleteEntityLink in interface EntityLinkProcessor
Overrides:
deleteEntityLink in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityLinkProcessor

createEntityLink

public ODataResponse createEntityLink(PostUriInfo uriInfo,
                                      InputStream content,
                                      String requestContentType,
                                      String contentType)
                               throws ODataException
Description copied from interface: EntityLinksProcessor
Creates a new link to a target entity of a navigation property.

Specified by:
createEntityLink in interface EntityLinksProcessor
Overrides:
createEntityLink in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request, containing the link data
requestContentType - the content type of the request body
contentType - the content type of the response
Returns:
an OData response object
Throws:
ODataException
See Also:
EntityLinkProcessor

updateEntityLink

public ODataResponse updateEntityLink(PutMergePatchUriInfo uriInfo,
                                      InputStream content,
                                      String requestContentType,
                                      String contentType)
                               throws ODataException
Description copied from interface: EntityLinkProcessor
Updates the link to the target entity of a navigation property.

Specified by:
updateEntityLink in interface EntityLinkProcessor
Overrides:
updateEntityLink in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request, containing the new URI
requestContentType - the content type of the request body
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityLinkProcessor

readEntityComplexProperty

public ODataResponse readEntityComplexProperty(GetComplexPropertyUriInfo uriInfo,
                                               String contentType)
                                        throws ODataException
Description copied from interface: EntityComplexPropertyProcessor
Reads a complex property of an entity.

Specified by:
readEntityComplexProperty in interface EntityComplexPropertyProcessor
Overrides:
readEntityComplexProperty in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
a ODataResponse object
Throws:
ODataException
See Also:
EntityComplexPropertyProcessor

readEntitySimpleProperty

public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo,
                                              String contentType)
                                       throws ODataException
Description copied from interface: EntitySimplePropertyProcessor
Reads a simple property of an entity.

Specified by:
readEntitySimpleProperty in interface EntitySimplePropertyProcessor
Overrides:
readEntitySimpleProperty in class ODataSingleProcessor
contentType - the content type of the response
Returns:
a ODataResponse object
Throws:
ODataException
See Also:
EntitySimplePropertyProcessor

readEntitySimplePropertyValue

public ODataResponse readEntitySimplePropertyValue(GetSimplePropertyUriInfo uriInfo,
                                                   String contentType)
                                            throws ODataException
Description copied from interface: EntitySimplePropertyValueProcessor
Reads the unformatted value of a simple property of an entity.

Specified by:
readEntitySimplePropertyValue in interface EntitySimplePropertyValueProcessor
Overrides:
readEntitySimplePropertyValue in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntitySimplePropertyValueProcessor

deleteEntitySimplePropertyValue

public ODataResponse deleteEntitySimplePropertyValue(DeleteUriInfo uriInfo,
                                                     String contentType)
                                              throws ODataException
Description copied from interface: EntitySimplePropertyValueProcessor
Deletes the value of a simple property of an entity.

Specified by:
deleteEntitySimplePropertyValue in interface EntitySimplePropertyValueProcessor
Overrides:
deleteEntitySimplePropertyValue in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
a ODataResponse object
Throws:
ODataException
See Also:
EntitySimplePropertyValueProcessor

updateEntityComplexProperty

public ODataResponse updateEntityComplexProperty(PutMergePatchUriInfo uriInfo,
                                                 InputStream content,
                                                 String requestContentType,
                                                 boolean merge,
                                                 String contentType)
                                          throws ODataException
Description copied from interface: EntityComplexPropertyProcessor
Updates a complex property of an entity.

Specified by:
updateEntityComplexProperty in interface EntityComplexPropertyProcessor
Overrides:
updateEntityComplexProperty in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request, containing the updated property data
requestContentType - the content type of the request body
merge - if true, properties not present in the data are left unchanged; if false, they are reset
contentType - the content type of the response
Returns:
a ODataResponse object
Throws:
ODataException
See Also:
EntityComplexPropertyProcessor

updateEntitySimpleProperty

public ODataResponse updateEntitySimpleProperty(PutMergePatchUriInfo uriInfo,
                                                InputStream content,
                                                String requestContentType,
                                                String contentType)
                                         throws ODataException
Description copied from interface: EntitySimplePropertyProcessor
Updates a simple property of an entity.

Specified by:
updateEntitySimpleProperty in interface EntitySimplePropertyProcessor
Overrides:
updateEntitySimpleProperty in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request, containing the updated property data
requestContentType - the content type of the request body
contentType - the content type of the response
Returns:
a ODataResponse object
Throws:
ODataException
See Also:
EntitySimplePropertyProcessor

updateEntitySimplePropertyValue

public ODataResponse updateEntitySimplePropertyValue(PutMergePatchUriInfo uriInfo,
                                                     InputStream content,
                                                     String requestContentType,
                                                     String contentType)
                                              throws ODataException
Description copied from interface: EntitySimplePropertyValueProcessor
Updates a simple property of an entity with an unformatted value.

Specified by:
updateEntitySimplePropertyValue in interface EntitySimplePropertyValueProcessor
Overrides:
updateEntitySimplePropertyValue in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request, containing the new value
requestContentType - the content type of the request body (important for a binary property)
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntitySimplePropertyValueProcessor

readEntityMedia

public ODataResponse readEntityMedia(GetMediaResourceUriInfo uriInfo,
                                     String contentType)
                              throws ODataException
Description copied from interface: EntityMediaProcessor
Reads the media resource of an entity.

Specified by:
readEntityMedia in interface EntityMediaProcessor
Overrides:
readEntityMedia in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityMediaProcessor

deleteEntityMedia

public ODataResponse deleteEntityMedia(DeleteUriInfo uriInfo,
                                       String contentType)
                                throws ODataException
Description copied from interface: EntityMediaProcessor
Deletes the media resource of an entity.

Specified by:
deleteEntityMedia in interface EntityMediaProcessor
Overrides:
deleteEntityMedia in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityMediaProcessor

updateEntityMedia

public ODataResponse updateEntityMedia(PutMergePatchUriInfo uriInfo,
                                       InputStream content,
                                       String requestContentType,
                                       String contentType)
                                throws ODataException
Description copied from interface: EntityMediaProcessor
Updates the media resource of an entity.

Specified by:
updateEntityMedia in interface EntityMediaProcessor
Overrides:
updateEntityMedia in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
content - the content of the request
requestContentType - the content type of the request body
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
EntityMediaProcessor

executeFunctionImport

public ODataResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo,
                                           String contentType)
                                    throws ODataException
Description copied from interface: FunctionImportProcessor
Executes a function import and returns the result.

Specified by:
executeFunctionImport in interface FunctionImportProcessor
Overrides:
executeFunctionImport in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
FunctionImportProcessor

executeFunctionImportValue

public ODataResponse executeFunctionImportValue(GetFunctionImportUriInfo uriInfo,
                                                String contentType)
                                         throws ODataException
Description copied from interface: FunctionImportValueProcessor
Returns the unformatted value of a function import.

Specified by:
executeFunctionImportValue in interface FunctionImportValueProcessor
Overrides:
executeFunctionImportValue in class ODataSingleProcessor
Parameters:
uriInfo - information about the request URI
contentType - the content type of the response
Returns:
an ODataResponse object
Throws:
ODataException
See Also:
FunctionImportValueProcessor

executeBatch

public ODataResponse executeBatch(BatchHandler handler,
                                  String contentType,
                                  InputStream content)
                           throws ODataException
Description copied from interface: BatchProcessor
Executes a OData batch request and provide Batch Response as ODataResponse

Specified by:
executeBatch in interface BatchProcessor
Overrides:
executeBatch in class ODataSingleProcessor
Parameters:
handler - batch handler
contentType - the content type of the request
content - Batch Request body
Returns:
a ODataResponse object
Throws:
ODataException
See Also:
BatchProcessor

executeChangeSet

public BatchResponsePart executeChangeSet(BatchHandler handler,
                                          List<ODataRequest> requests)
                                   throws ODataException
Description copied from interface: BatchProcessor
Executes a Change Set and provide BatchResponsePart as BatchResponsePart that contains the responses to change requests. The method has to define a rollback semantic that may be applied when a request within a Change Set fails (all-or-nothing requirement). If a request within a Change Set fails, instead of Change Set Response should be returned the error response

Specified by:
executeChangeSet in interface BatchProcessor
Overrides:
executeChangeSet in class ODataSingleProcessor
Parameters:
handler - batch handler
requests - list of single change requests
Returns:
a BatchResponsePart object
Throws:
ODataException
See Also:
BatchProcessor


Copyright © 2013-2015 The Apache Software Foundation. All Rights Reserved.