public abstract class ODataSingleProcessor extends Object implements MetadataProcessor, ServiceDocumentProcessor, EntityProcessor, EntitySetProcessor, EntityComplexPropertyProcessor, EntityLinkProcessor, EntityLinksProcessor, EntityMediaProcessor, EntitySimplePropertyProcessor, EntitySimplePropertyValueProcessor, FunctionImportProcessor, FunctionImportValueProcessor, BatchProcessor, CustomContentType
A default ODataProcessor
that implements all processor features in a single class.
It is recommended to derive from this class and it is required by the
ODataServiceFactory
to build an
ODataService
.
This abstract class provides a default behavior, returning the correct response
for requests for the service or the metadata document, respectively, and throwing an
ODataNotImplementedException
for all other requests.
Sub classes have to override only methods they want to support.
Constructor and Description |
---|
ODataSingleProcessor() |
Modifier and Type | Method and Description |
---|---|
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.
|
ODataContext |
getContext() |
List<String> |
getCustomContentTypes(Class<? extends ODataProcessor> processorFeature)
The OData library will consider these additional content types during negotiation of http content type header.
|
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 |
readMetadata(GetMetadataUriInfo uriInfo,
String contentType) |
ODataResponse |
readServiceDocument(GetServiceDocumentUriInfo uriInfo,
String contentType) |
void |
setContext(ODataContext context) |
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.
|
public void setContext(ODataContext context)
setContext
in interface ODataProcessor
context
- A request context object which is usually injected by the OData library itself.ODataProcessor
public ODataContext getContext()
getContext
in interface ODataProcessor
ODataProcessor
public ODataResponse executeBatch(BatchHandler handler, String contentType, InputStream content) throws ODataException
BatchProcessor
ODataResponse
executeBatch
in interface BatchProcessor
handler
- batch handlercontentType
- the content type of the requestcontent
- Batch Request bodyODataResponse
objectODataException
BatchProcessor
public BatchResponsePart executeChangeSet(BatchHandler handler, List<ODataRequest> requests) throws ODataException
BatchProcessor
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 responseexecuteChangeSet
in interface BatchProcessor
handler
- batch handlerrequests
- list of single change requestsBatchResponsePart
objectODataNotImplementedException
ODataException
BatchProcessor
public ODataResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, String contentType) throws ODataException
FunctionImportProcessor
executeFunctionImport
in interface FunctionImportProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
FunctionImportProcessor
public ODataResponse executeFunctionImportValue(GetFunctionImportUriInfo uriInfo, String contentType) throws ODataException
FunctionImportValueProcessor
executeFunctionImportValue
in interface FunctionImportValueProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
FunctionImportValueProcessor
public ODataResponse readEntitySimplePropertyValue(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException
EntitySimplePropertyValueProcessor
readEntitySimplePropertyValue
in interface EntitySimplePropertyValueProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntitySimplePropertyValueProcessor
public ODataResponse updateEntitySimplePropertyValue(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
EntitySimplePropertyValueProcessor
updateEntitySimplePropertyValue
in interface EntitySimplePropertyValueProcessor
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 responseODataResponse
objectODataException
EntitySimplePropertyValueProcessor
public ODataResponse deleteEntitySimplePropertyValue(DeleteUriInfo uriInfo, String contentType) throws ODataException
EntitySimplePropertyValueProcessor
deleteEntitySimplePropertyValue
in interface EntitySimplePropertyValueProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntitySimplePropertyValueProcessor
public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException
EntitySimplePropertyProcessor
readEntitySimpleProperty
in interface EntitySimplePropertyProcessor
contentType
- the content type of the responseODataResponse
objectODataException
EntitySimplePropertyProcessor
public ODataResponse updateEntitySimpleProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
EntitySimplePropertyProcessor
updateEntitySimpleProperty
in interface EntitySimplePropertyProcessor
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 responseODataResponse
objectODataException
EntitySimplePropertyProcessor
public ODataResponse readEntityMedia(GetMediaResourceUriInfo uriInfo, String contentType) throws ODataException
EntityMediaProcessor
readEntityMedia
in interface EntityMediaProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntityMediaProcessor
public ODataResponse updateEntityMedia(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
EntityMediaProcessor
updateEntityMedia
in interface EntityMediaProcessor
uriInfo
- information about the request URIcontent
- the content of the requestrequestContentType
- the content type of the request bodycontentType
- the content type of the responseODataResponse
objectODataException
EntityMediaProcessor
public ODataResponse deleteEntityMedia(DeleteUriInfo uriInfo, String contentType) throws ODataException
EntityMediaProcessor
deleteEntityMedia
in interface EntityMediaProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntityMediaProcessor
public ODataResponse readEntityLinks(GetEntitySetLinksUriInfo uriInfo, String contentType) throws ODataException
EntityLinksProcessor
readEntityLinks
in interface EntityLinksProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataException
EntityLinksProcessor
public ODataResponse countEntityLinks(GetEntitySetLinksCountUriInfo uriInfo, String contentType) throws ODataException
EntityLinksProcessor
countEntityLinks
in interface EntityLinksProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataException
EntityLinksProcessor
public ODataResponse createEntityLink(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
EntityLinksProcessor
createEntityLink
in interface EntityLinksProcessor
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 responseODataException
EntityLinkProcessor
public ODataResponse readEntityLink(GetEntityLinkUriInfo uriInfo, String contentType) throws ODataException
EntityLinkProcessor
readEntityLink
in interface EntityLinkProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntityLinkProcessor
public ODataResponse existsEntityLink(GetEntityLinkCountUriInfo uriInfo, String contentType) throws ODataException
EntityLinkProcessor
existsEntityLink
in interface EntityLinkProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntityLinkProcessor
public ODataResponse updateEntityLink(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
EntityLinkProcessor
updateEntityLink
in interface EntityLinkProcessor
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 responseODataResponse
objectODataException
EntityLinkProcessor
public ODataResponse deleteEntityLink(DeleteUriInfo uriInfo, String contentType) throws ODataException
EntityLinkProcessor
deleteEntityLink
in interface EntityLinkProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntityLinkProcessor
public ODataResponse readEntityComplexProperty(GetComplexPropertyUriInfo uriInfo, String contentType) throws ODataException
EntityComplexPropertyProcessor
readEntityComplexProperty
in interface EntityComplexPropertyProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntityComplexPropertyProcessor
public ODataResponse updateEntityComplexProperty(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType) throws ODataException
EntityComplexPropertyProcessor
updateEntityComplexProperty
in interface EntityComplexPropertyProcessor
uriInfo
- information about the request URIcontent
- the content of the request, containing the updated property datarequestContentType
- the content type of the request bodymerge
- if true
, properties not present in the data are left unchanged;
if false
, they are resetcontentType
- the content type of the responseODataResponse
objectODataException
EntityComplexPropertyProcessor
public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException
EntitySetProcessor
readEntitySet
in interface EntitySetProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntitySetProcessor
public ODataResponse countEntitySet(GetEntitySetCountUriInfo uriInfo, String contentType) throws ODataException
EntitySetProcessor
countEntitySet
in interface EntitySetProcessor
uriInfo
- information about the request URIcontentType
- the content type of the responseODataResponse
objectODataException
EntitySetProcessor
public ODataResponse createEntity(PostUriInfo uriInfo, InputStream content, String requestContentType, String contentType) throws ODataException
EntitySetProcessor
createEntity
in interface EntitySetProcessor
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 responseODataResponse
objectODataException
EntitySetProcessor
public ODataResponse readEntity(GetEntityUriInfo uriInfo, String contentType) throws ODataException
EntityProcessor
readEntity
in interface EntityProcessor
contentType
- the content type of the responseODataResponse
objectODataException
EntityProcessor
public ODataResponse existsEntity(GetEntityCountUriInfo uriInfo, String contentType) throws ODataException
EntityProcessor
existsEntity
in interface EntityProcessor
contentType
- the content type of the responseODataResponse
objectODataException
EntityProcessor
public ODataResponse updateEntity(PutMergePatchUriInfo uriInfo, InputStream content, String requestContentType, boolean merge, String contentType) throws ODataException
EntityProcessor
updateEntity
in interface EntityProcessor
uriInfo
- information about the request URIcontent
- the content of the request, containing the updated entity datarequestContentType
- the content type of the request bodymerge
- if true
, properties not present in the data are left unchanged;
if false
, they are resetcontentType
- the content type of the responseODataResponse
objectODataException
EntityProcessor
public ODataResponse deleteEntity(DeleteUriInfo uriInfo, String contentType) throws ODataException
EntityProcessor
deleteEntity
in interface EntityProcessor
uriInfo
- a DeleteUriInfo
object with information from the URI parsercontentType
- the content type of the responseODataResponse
objectODataException
EntityProcessor
public ODataResponse readServiceDocument(GetServiceDocumentUriInfo uriInfo, String contentType) throws ODataException
readServiceDocument
in interface ServiceDocumentProcessor
ODataResponse
objectODataException
ServiceDocumentProcessor
public ODataResponse readMetadata(GetMetadataUriInfo uriInfo, String contentType) throws ODataException
readMetadata
in interface MetadataProcessor
ODataResponse
objectODataException
MetadataProcessor
public List<String> getCustomContentTypes(Class<? extends ODataProcessor> processorFeature) throws ODataException
CustomContentType
getCustomContentTypes
in interface CustomContentType
ODataException
CustomContentType
Copyright © 2013-2017 The Apache Software Foundation. All Rights Reserved.