Class ODataSingleProcessor
- java.lang.Object
-
- org.apache.olingo.odata2.api.processor.ODataSingleProcessor
-
- All Implemented Interfaces:
CustomContentType,ODataProcessorFeature,ODataProcessor,BatchProcessor,EntityComplexPropertyProcessor,EntityLinkProcessor,EntityLinksProcessor,EntityMediaProcessor,EntityProcessor,EntitySetProcessor,EntitySimplePropertyProcessor,EntitySimplePropertyValueProcessor,FunctionImportProcessor,FunctionImportValueProcessor,MetadataProcessor,ServiceDocumentProcessor
public abstract class ODataSingleProcessor extends Object implements MetadataProcessor, ServiceDocumentProcessor, EntityProcessor, EntitySetProcessor, EntityComplexPropertyProcessor, EntityLinkProcessor, EntityLinksProcessor, EntityMediaProcessor, EntitySimplePropertyProcessor, EntitySimplePropertyValueProcessor, FunctionImportProcessor, FunctionImportValueProcessor, BatchProcessor, CustomContentType
A default
ODataProcessorthat implements all processor features in a single class.It is recommended to derive from this class and it is required by the
ODataServiceFactoryto build anODataService.This abstract class provides a default behavior, returning the correct response for requests for the service or the metadata document, respectively, and throwing an
ODataNotImplementedExceptionfor all other requests. Sub classes have to override only methods they want to support.
-
-
Constructor Summary
Constructors Constructor Description ODataSingleProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ODataResponsecountEntityLinks(GetEntitySetLinksCountUriInfo uriInfo, String contentType)Counts the number of target entities of a navigation property.ODataResponsecountEntitySet(GetEntitySetCountUriInfo uriInfo, String contentType)Counts the number of requested entities.ODataResponsecreateEntity(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType)Creates an entity.ODataResponsecreateEntityLink(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType)Creates a new link to a target entity of a navigation property.ODataResponsedeleteEntity(DeleteUriInfo uriInfo, String contentType)Deletes an entity.ODataResponsedeleteEntityLink(DeleteUriInfo uriInfo, String contentType)Deletes the link to the target entity of a navigation property.ODataResponsedeleteEntityMedia(DeleteUriInfo uriInfo, String contentType)Deletes the media resource of an entity.ODataResponsedeleteEntitySimplePropertyValue(DeleteUriInfo uriInfo, String contentType)Deletes the value of a simple property of an entity.ODataResponseexecuteBatch(BatchHandler handler, String contentType, InputStream content)Executes a OData batch request and provide Batch Response asODataResponseBatchResponsePartexecuteChangeSet(BatchHandler handler, List<ODataRequest> requests)Executes a Change Set and provide BatchResponsePart asBatchResponsePartthat contains the responses to change requests.ODataResponseexecuteFunctionImport(GetFunctionImportUriInfo uriInfo, String contentType)Executes a function import and returns the result.ODataResponseexecuteFunctionImportValue(GetFunctionImportUriInfo uriInfo, String contentType)Returns the unformatted value of a function import.ODataResponseexistsEntity(GetEntityCountUriInfo uriInfo, String contentType)Checks whether an entity exists.ODataResponseexistsEntityLink(GetEntityLinkCountUriInfo uriInfo, String contentType)Returns whether the target entity of a navigation property exists.ODataContextgetContext()List<String>getCustomContentTypes(Class<? extends ODataProcessor> processorFeature)The OData library will consider these additional content types during negotiation of http content type header.ODataResponsereadEntity(GetEntityUriInfo uriInfo, String contentType)Reads an entity.ODataResponsereadEntityComplexProperty(GetComplexPropertyUriInfo uriInfo, String contentType)Reads a complex property of an entity.ODataResponsereadEntityLink(GetEntityLinkUriInfo uriInfo, String contentType)Reads the URI of the target entity of a navigation property.ODataResponsereadEntityLinks(GetEntitySetLinksUriInfo uriInfo, String contentType)Reads the URIs of the target entities of a navigation property.ODataResponsereadEntityMedia(GetMediaResourceUriInfo uriInfo, String contentType)Reads the media resource of an entity.ODataResponsereadEntitySet(GetEntitySetUriInfo uriInfo, String contentType)Reads entities.ODataResponsereadEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType)Reads a simple property of an entity.ODataResponsereadEntitySimplePropertyValue(GetSimplePropertyUriInfo uriInfo, String contentType)Reads the unformatted value of a simple property of an entity.ODataResponsereadMetadata(GetMetadataUriInfo uriInfo, String contentType)ODataResponsereadServiceDocument(GetServiceDocumentUriInfo uriInfo, String contentType)voidsetContext(ODataContext context)ODataResponseupdateEntity(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType)Updates an entity.ODataResponseupdateEntityComplexProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType)Updates a complex property of an entity.ODataResponseupdateEntityLink(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)Updates the link to the target entity of a navigation property.ODataResponseupdateEntityMedia(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)Updates the media resource of an entity.ODataResponseupdateEntitySimpleProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)Updates a simple property of an entity.ODataResponseupdateEntitySimplePropertyValue(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType)Updates a simple property of an entity with an unformatted value.
-
-
-
Method Detail
-
setContext
public void setContext(ODataContext context)
- Specified by:
setContextin interfaceODataProcessor- Parameters:
context- A request context object which is usually injected by the OData library itself.- See Also:
ODataProcessor
-
getContext
public ODataContext getContext()
- Specified by:
getContextin interfaceODataProcessor- Returns:
- A request context object.
- See Also:
ODataProcessor
-
executeBatch
public ODataResponse executeBatch(BatchHandler handler, String contentType, InputStream content) throws ODataException
Description copied from interface:BatchProcessorExecutes a OData batch request and provide Batch Response asODataResponse- Specified by:
executeBatchin interfaceBatchProcessor- Parameters:
handler- batch handlercontentType- the content type of the requestcontent- Batch Request body- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
BatchProcessor
-
executeChangeSet
public BatchResponsePart executeChangeSet(BatchHandler handler, List<ODataRequest> requests) throws ODataException
Description copied from interface:BatchProcessorExecutes a Change Set and provide BatchResponsePart asBatchResponsePartthat 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:
executeChangeSetin interfaceBatchProcessor- Parameters:
handler- batch handlerrequests- list of single change requests- Returns:
- a
BatchResponsePartobject - Throws:
ODataNotImplementedException- Caso ocorra uma exceçãoODataException- Caso ocorra exceção OData- See Also:
BatchProcessor
-
executeFunctionImport
public ODataResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:FunctionImportProcessorExecutes a function import and returns the result.- Specified by:
executeFunctionImportin interfaceFunctionImportProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
FunctionImportProcessor
-
executeFunctionImportValue
public ODataResponse executeFunctionImportValue(GetFunctionImportUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:FunctionImportValueProcessorReturns the unformatted value of a function import.- Specified by:
executeFunctionImportValuein interfaceFunctionImportValueProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
FunctionImportValueProcessor
-
readEntitySimplePropertyValue
public ODataResponse readEntitySimplePropertyValue(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntitySimplePropertyValueProcessorReads the unformatted value of a simple property of an entity.- Specified by:
readEntitySimplePropertyValuein interfaceEntitySimplePropertyValueProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySimplePropertyValueProcessor
-
updateEntitySimplePropertyValue
public ODataResponse updateEntitySimplePropertyValue(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
Description copied from interface:EntitySimplePropertyValueProcessorUpdates a simple property of an entity with an unformatted value.- Specified by:
updateEntitySimplePropertyValuein interfaceEntitySimplePropertyValueProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the request, containing the new valuerequestContentType- the content type of the request body (important for a binary property)contentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySimplePropertyValueProcessor
-
deleteEntitySimplePropertyValue
public ODataResponse deleteEntitySimplePropertyValue(DeleteUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntitySimplePropertyValueProcessorDeletes the value of a simple property of an entity.- Specified by:
deleteEntitySimplePropertyValuein interfaceEntitySimplePropertyValueProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySimplePropertyValueProcessor
-
readEntitySimpleProperty
public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntitySimplePropertyProcessorReads a simple property of an entity.- Specified by:
readEntitySimplePropertyin interfaceEntitySimplePropertyProcessor- Parameters:
uriInfo- URI InfocontentType- the content type of the response- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySimplePropertyProcessor
-
updateEntitySimpleProperty
public ODataResponse updateEntitySimpleProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
Description copied from interface:EntitySimplePropertyProcessorUpdates a simple property of an entity.- Specified by:
updateEntitySimplePropertyin interfaceEntitySimplePropertyProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the request, containing the updated property datarequestContentType- the content type of the request bodycontentType- the content type of the response- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySimplePropertyProcessor
-
readEntityMedia
public ODataResponse readEntityMedia(GetMediaResourceUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityMediaProcessorReads the media resource of an entity.- Specified by:
readEntityMediain interfaceEntityMediaProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityMediaProcessor
-
updateEntityMedia
public ODataResponse updateEntityMedia(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
Description copied from interface:EntityMediaProcessorUpdates the media resource of an entity.- Specified by:
updateEntityMediain interfaceEntityMediaProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the requestrequestContentType- the content type of the request bodycontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityMediaProcessor
-
deleteEntityMedia
public ODataResponse deleteEntityMedia(DeleteUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityMediaProcessorDeletes the media resource of an entity.- Specified by:
deleteEntityMediain interfaceEntityMediaProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityMediaProcessor
-
readEntityLinks
public ODataResponse readEntityLinks(GetEntitySetLinksUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityLinksProcessorReads the URIs of the target entities of a navigation property.- Specified by:
readEntityLinksin interfaceEntityLinksProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an OData response object
- Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityLinksProcessor
-
countEntityLinks
public ODataResponse countEntityLinks(GetEntitySetLinksCountUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityLinksProcessorCounts the number of target entities of a navigation property.- Specified by:
countEntityLinksin interfaceEntityLinksProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an OData response object
- Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityLinksProcessor
-
createEntityLink
public ODataResponse createEntityLink(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
Description copied from interface:EntityLinksProcessorCreates a new link to a target entity of a navigation property.- Specified by:
createEntityLinkin interfaceEntityLinksProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the request, containing the link datarequestContentType- the content type of the request bodycontentType- the content type of the response- Returns:
- an OData response object
- Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityLinkProcessor
-
readEntityLink
public ODataResponse readEntityLink(GetEntityLinkUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityLinkProcessorReads the URI of the target entity of a navigation property.- Specified by:
readEntityLinkin interfaceEntityLinkProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityLinkProcessor
-
existsEntityLink
public ODataResponse existsEntityLink(GetEntityLinkCountUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityLinkProcessorReturns whether the target entity of a navigation property exists.- Specified by:
existsEntityLinkin interfaceEntityLinkProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityLinkProcessor
-
updateEntityLink
public ODataResponse updateEntityLink(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
Description copied from interface:EntityLinkProcessorUpdates the link to the target entity of a navigation property.- Specified by:
updateEntityLinkin interfaceEntityLinkProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the request, containing the new URIrequestContentType- the content type of the request bodycontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityLinkProcessor
-
deleteEntityLink
public ODataResponse deleteEntityLink(DeleteUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityLinkProcessorDeletes the link to the target entity of a navigation property.- Specified by:
deleteEntityLinkin interfaceEntityLinkProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityLinkProcessor
-
readEntityComplexProperty
public ODataResponse readEntityComplexProperty(GetComplexPropertyUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityComplexPropertyProcessorReads a complex property of an entity.- Specified by:
readEntityComplexPropertyin interfaceEntityComplexPropertyProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityComplexPropertyProcessor
-
updateEntityComplexProperty
public ODataResponse updateEntityComplexProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType) throws ODataException
Description copied from interface:EntityComplexPropertyProcessorUpdates a complex property of an entity.- Specified by:
updateEntityComplexPropertyin interfaceEntityComplexPropertyProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the request, containing the updated property datarequestContentType- the content type of the request bodymerge- iftrue, properties not present in the data are left unchanged; iffalse, they are resetcontentType- the content type of the response- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityComplexPropertyProcessor
-
readEntitySet
public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntitySetProcessorReads entities.- Specified by:
readEntitySetin interfaceEntitySetProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySetProcessor
-
countEntitySet
public ODataResponse countEntitySet(GetEntitySetCountUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntitySetProcessorCounts the number of requested entities.- Specified by:
countEntitySetin interfaceEntitySetProcessor- Parameters:
uriInfo- information about the request URIcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySetProcessor
-
createEntity
public ODataResponse createEntity(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
Description copied from interface:EntitySetProcessorCreates an entity.- Specified by:
createEntityin interfaceEntitySetProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the request, containing the data of the new entityrequestContentType- the content type of the request bodycontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntitySetProcessor
-
readEntity
public ODataResponse readEntity(GetEntityUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityProcessorReads an entity.- Specified by:
readEntityin interfaceEntityProcessor- Parameters:
uriInfo- URI InfocontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityProcessor
-
existsEntity
public ODataResponse existsEntity(GetEntityCountUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityProcessorChecks whether an entity exists.- Specified by:
existsEntityin interfaceEntityProcessor- Parameters:
uriInfo- URI InfocontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityProcessor
-
updateEntity
public ODataResponse updateEntity(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType) throws ODataException
Description copied from interface:EntityProcessorUpdates an entity.- Specified by:
updateEntityin interfaceEntityProcessor- Parameters:
uriInfo- information about the request URIcontent- the content of the request, containing the updated entity datarequestContentType- the content type of the request bodymerge- iftrue, properties not present in the data are left unchanged; iffalse, they are resetcontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityProcessor
-
deleteEntity
public ODataResponse deleteEntity(DeleteUriInfo uriInfo, String contentType) throws ODataException
Description copied from interface:EntityProcessorDeletes an entity.- Specified by:
deleteEntityin interfaceEntityProcessor- Parameters:
uriInfo- aDeleteUriInfoobject with information from the URI parsercontentType- the content type of the response- Returns:
- an
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
EntityProcessor
-
readServiceDocument
public ODataResponse readServiceDocument(GetServiceDocumentUriInfo uriInfo, String contentType) throws ODataException
- Specified by:
readServiceDocumentin interfaceServiceDocumentProcessor- Parameters:
uriInfo- URI InfocontentType- Tipo- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
ServiceDocumentProcessor
-
readMetadata
public ODataResponse readMetadata(GetMetadataUriInfo uriInfo, String contentType) throws ODataException
- Specified by:
readMetadatain interfaceMetadataProcessor- Parameters:
uriInfo- URI InfocontentType- Tipo- Returns:
- a
ODataResponseobject - Throws:
ODataException- Caso ocorra exceção OData- See Also:
MetadataProcessor
-
getCustomContentTypes
public List<String> getCustomContentTypes(Class<? extends ODataProcessor> processorFeature) throws ODataException
Description copied from interface:CustomContentTypeThe OData library will consider these additional content types during negotiation of http content type header.- Specified by:
getCustomContentTypesin interfaceCustomContentType- Parameters:
processorFeature- ProcessorFeature- Returns:
- a list of additional supported content types in the format "type/sub type"
- Throws:
ODataException- Caso ocorra exceção OData- See Also:
CustomContentType
-
-