public static interface EntityProvider.EntityProviderInterface
EntityProvider
necessary read and write methods for accessing
entities defined in an Entity Data Model
.
This interface is declared as inner interface (class) because the EntityProvider
provides a convenience
access (and basic implementation for XML and JSON format) to all interface methods.
Hence, it is not recommended to implement this interface (it is possible to implement it and to provide an
own EntityProvider
for support of additional formats but it is recommended to
handle additional formats directly within an ODataProcessor
).
Modifier and Type | Method and Description |
---|---|
List<BatchRequestPart> |
parseBatchRequest(String contentType,
InputStream content,
EntityProviderBatchProperties properties)
Parse Batch Request body
inputStream (as InputStream ) and provide a list of Batch Parts as
BatchPart |
List<BatchSingleResponse> |
parseBatchResponse(String contentType,
InputStream content)
Parse Batch Response body (as
InputStream ) and provide a list of single responses as
BatchSingleResponse |
byte[] |
readBinary(InputStream content)
|
ODataDeltaFeed |
readDeltaFeed(String contentType,
EdmEntitySet entitySet,
InputStream content,
EntityProviderReadProperties properties)
Read (de-serialize) a delta data feed from
content (as InputStream ) in specified format
(given as contentType )
based on entity data model (given as EdmEntitySet ) and provide this data as
ODataDeltaFeed . |
ODataEntry |
readEntry(String contentType,
EdmEntitySet entitySet,
InputStream content,
EntityProviderReadProperties properties)
Reads (de-serializes) data from
content (as InputStream )
in specified format (given as contentType ) based on
entity data model (given as EdmEntitySet )
and provides this data as ODataEntry . |
ODataErrorContext |
readErrorDocument(InputStream errorDocument,
String contentType)
Read (de-serialize) data from error document as
InputStream and provide according
ODataErrorContext . |
ODataFeed |
readFeed(String contentType,
EdmEntitySet entitySet,
InputStream content,
EntityProviderReadProperties properties)
Read (de-serialize) a data feed from
content (as InputStream ) in specified format (given as
contentType )
based on entity data model (given as EdmEntitySet ) and provide this data as
ODataFeed . |
Object |
readFunctionImport(String contentType,
EdmFunctionImport functionImport,
InputStream content,
EntityProviderReadProperties properties)
Reads (de-serializes) function-import data from
content (as InputStream ) in specified format
(given as contentType ) based on entity data model (given as EdmFunctionImport )
and provide this data as Object . |
String |
readLink(String contentType,
EdmEntitySet entitySet,
InputStream content)
Read (de-serialize) a link from
content (as InputStream ) in specified format (given as
contentType )
based on entity data model (given as EdmEntitySet ) and provide the link as String . |
List<String> |
readLinks(String contentType,
EdmEntitySet entitySet,
InputStream content)
Read (de-serialize) all links from
content (as InputStream )
in specified format (given as contentType ) based on entity data model
(given as EdmEntitySet ) and provide the link as List of Strings. |
Edm |
readMetadata(InputStream inputStream,
boolean validate)
|
Map<String,Object> |
readProperty(String contentType,
EdmProperty edmProperty,
InputStream content,
EntityProviderReadProperties properties)
Read (de-serialize) properties from
content (as InputStream ) in specified format (given as
contentType )
based on entity data model (given as EdmProperty ) and provide this data as Map which
contains
the read data in form of property name to property value mapping. |
Object |
readPropertyValue(EdmProperty edmProperty,
InputStream content,
Class<?> typeMapping)
Read (de-serialize) a property value from
content (as InputStream ) in format
text/plain
based on entity data model (given as EdmProperty ) and provide this data as Object . |
ServiceDocument |
readServiceDocument(InputStream serviceDocument,
String contentType)
Read (de-serialize) data from service document
inputStream (as InputStream ) and provide
ServiceDocument as ServiceDocument |
InputStream |
writeBatchRequest(List<BatchPart> batchParts,
String boundary)
Create Batch Request body as InputStream.
|
ODataResponse |
writeBatchResponse(List<BatchResponsePart> batchResponseParts)
Write responses of Batch Response Parts in Batch Response as
ODataResponse . |
ODataResponse |
writeBinary(String mimeType,
byte[] data)
Write binary content with content type header set to given
mime type parameter. |
ODataResponse |
writeEntry(String contentType,
EdmEntitySet entitySet,
Map<String,Object> data,
EntityProviderWriteProperties properties)
Write given
data (which is given in form of a Map for which contains all properties
as property name to property value mapping) for the entry in the specified
format (given as contentType ) based on entity data model for an entity set (given as
EdmEntitySet )
and properties for this entity provider (given as EntityProviderWriteProperties ). |
ODataResponse |
writeErrorDocument(ODataErrorContext context)
Serializes an error message according to the OData standard.
|
ODataResponse |
writeFeed(String contentType,
EdmEntitySet entitySet,
List<Map<String,Object>> data,
EntityProviderWriteProperties properties)
|
ODataResponse |
writeFunctionImport(String contentType,
EdmFunctionImport functionImport,
Object data,
EntityProviderWriteProperties properties)
Write
data result (given as Object ) of function import based on return type
of EdmFunctionImport in specified format (given as contentType ). |
ODataResponse |
writeLink(String contentType,
EdmEntitySet entitySet,
Map<String,Object> data,
EntityProviderWriteProperties properties)
Write link for key property based on
entity data model for an entity set (given as
EdmEntitySet )
in the specified format (given as contentType ). |
ODataResponse |
writeLinks(String contentType,
EdmEntitySet entitySet,
List<Map<String,Object>> data,
EntityProviderWriteProperties properties)
Write all links for key property based on
entity data model for an entity set (given as
EdmEntitySet )
in the specified format (given as contentType ) for a set of entries. |
ODataResponse |
writeMetadata(DataServices serviceMetadata,
Map<String,String> predefinedNamespaces)
Write metadata document in XML format for the given schemas and the provided predefined
namespaces at the EDMX element.
|
ODataResponse |
writeMetadata(List<Schema> schemas,
Map<String,String> predefinedNamespaces)
Write metadata document in XML format for the given schemas and the provided predefined
namespaces at the EDMX element.
|
ODataResponse |
writeProperty(String contentType,
EdmProperty edmProperty,
Object value)
Write given
value (which is given in form of an Object ) for the property in the specified
format (given as contentType ) based on given entity data model for an entity property
(given as EdmProperty ). |
ODataResponse |
writePropertyValue(EdmProperty edmProperty,
Object value)
Write property as content type
application/octet-stream or text/plain . |
ODataResponse |
writeServiceDocument(String contentType,
Edm edm,
String serviceRoot)
Write service document based on given
Edm and service root as
given content type. |
ODataResponse |
writeText(String value)
Write text value as content type
text/plain . |
ODataResponse writeMetadata(List<Schema> schemas, Map<String,String> predefinedNamespaces) throws EntityProviderException
schemas
- all XML schemas which will be writtenpredefinedNamespaces
- type of Map<prefix,namespace> and may be null or an empty MapODataResponse
with written metadata content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeMetadata(DataServices serviceMetadata, Map<String,String> predefinedNamespaces) throws EntityProviderException
serviceMetadata
- predefinedNamespaces
- type of Map<prefix,namespace> and may be null or an empty MapODataResponse
with written metadata content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeServiceDocument(String contentType, Edm edm, String serviceRoot) throws EntityProviderException
Edm
and service root
as
given content type.contentType
- format in which service document should be writtenedm
- entity data model to be writtenserviceRoot
- service root for the written service documentODataResponse
with written service document content.EntityProviderException
- if writing of data (serialization) failsODataResponse writePropertyValue(EdmProperty edmProperty, Object value) throws EntityProviderException
application/octet-stream
or text/plain
.edmProperty
- entity data model for to be written propertyvalue
- property which will be writtenODataResponse
with written property value content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeText(String value) throws EntityProviderException
text/plain
.value
- text value which will be writtenODataResponse
with written text/plain content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeBinary(String mimeType, byte[] data) throws EntityProviderException
mime type
parameter.mimeType
- mime type which is written and used as content type header information.data
- which is written to ODataResponse
.ODataResponse
with written binary content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeFeed(String contentType, EdmEntitySet entitySet, List<Map<String,Object>> data, EntityProviderWriteProperties properties) throws EntityProviderException
data
(which is given in form of a List
with a Map
for each entity. Such
a Map
contains all properties [as property name
to property value
mapping] for
the entry) in the specified
format (given as contentType
) based on given entity data model for an entity set
(given
as EdmEntitySet
)
and properties
for this entity provider (given as EntityProviderWriteProperties
).contentType
- format in which the feed should be writtenentitySet
- entity data model for given entity data setdata
- set of entries in form of a List
with a Map
for each entity (such a Map
contains all properties [as property name
to property value
mapping).properties
- additional properties necessary for writing of dataODataResponse
with written feed content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeEntry(String contentType, EdmEntitySet entitySet, Map<String,Object> data, EntityProviderWriteProperties properties) throws EntityProviderException
data
(which is given in form of a Map
for which contains all properties
as property name
to property value
mapping) for the entry in the specified
format (given as contentType
) based on entity data model for an entity set
(given as
EdmEntitySet
)
and properties
for this entity provider (given as EntityProviderWriteProperties
).contentType
- format in which the entry should be writtenentitySet
- entity data model for given entity data setdata
- which contains all properties as property name
to property value
mapping
for the entryproperties
- additional properties necessary for writing of dataODataResponse
with written entry contentEntityProviderException
- if writing of data (serialization) failsODataResponse writeProperty(String contentType, EdmProperty edmProperty, Object value) throws EntityProviderException
value
(which is given in form of an Object
) for the property in the specified
format (given as contentType
) based on given entity data model for an entity property
(given as EdmProperty
).contentType
- format in which the property should be writtenedmProperty
- entity data model for given propertyvalue
- data which is writtenODataResponse
with written property content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeLink(String contentType, EdmEntitySet entitySet, Map<String,Object> data, EntityProviderWriteProperties properties) throws EntityProviderException
entity data model for an entity set
(given as
EdmEntitySet
)
in the specified format (given as contentType
).
The necessary key property values must be provided within the data
(in the form of property
name
to property value
mapping) and properties
for this entity provider must be set
(given as EntityProviderWriteProperties
).contentType
- format in which the entry should be writtenentitySet
- entity data model for given entity data setdata
- which contains all key properties as property name
to property value
mapping for the entryproperties
- additional properties necessary for writing of dataODataResponse
with written link content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeLinks(String contentType, EdmEntitySet entitySet, List<Map<String,Object>> data, EntityProviderWriteProperties properties) throws EntityProviderException
entity data model for an entity set
(given as
EdmEntitySet
)
in the specified format (given as contentType
) for a set of entries.
The necessary key property values must be provided within the data
(in form of a List
with a
Map
for each entry. Such a Map
contains all key properties [as property name
to
property value
mapping] for the entry) and properties
for this entity provider must be
set
(given as EntityProviderWriteProperties
).contentType
- format in which the entry should be writtenentitySet
- entity data model for given entity data setdata
- set of entries in form of a List
with a Map
for each entry (such a Map
contains all key properties [as property name
to property value
mapping).properties
- additional properties necessary for writing of dataODataResponse
with written links content.EntityProviderException
- if writing of data (serialization) failsODataResponse writeFunctionImport(String contentType, EdmFunctionImport functionImport, Object data, EntityProviderWriteProperties properties) throws EntityProviderException
data
result (given as Object
) of function import based on return type
of EdmFunctionImport
in specified format (given as contentType
). Additional
properties
for this entity provider must be set (given as EntityProviderWriteProperties
).contentType
- format in which the entry should be writtenfunctionImport
- entity data model for executed function importdata
- result of function importproperties
- additional properties necessary for writing of dataODataResponse
with written function import result content.EntityProviderException
- if writing of data (serialization) failsODataFeed readFeed(String contentType, EdmEntitySet entitySet, InputStream content, EntityProviderReadProperties properties) throws EntityProviderException
content
(as InputStream
) in specified format (given as
contentType
)
based on entity data model
(given as EdmEntitySet
) and provide this data as
ODataFeed
.contentType
- format of content in the given input stream.entitySet
- entity data model for entity set to be readcontent
- feed data in form of an InputStream
which contains the data in specified formatproperties
- additional properties necessary for reading content from InputStream
into Map
.ODataFeed
objectEntityProviderException
- if reading of data (de-serialization) failsODataDeltaFeed readDeltaFeed(String contentType, EdmEntitySet entitySet, InputStream content, EntityProviderReadProperties properties) throws EntityProviderException
content
(as InputStream
) in specified format
(given as contentType
)
based on entity data model
(given as EdmEntitySet
) and provide this data as
ODataDeltaFeed
.contentType
- format of content in the given input stream.entitySet
- entity data model for entity set to be readcontent
- delta feed data in form of an InputStream
which contains the data in specified formatproperties
- additional properties necessary for reading content from InputStream
into Map
.ODataDeltaFeed
objectEntityProviderException
- if reading of data (de-serialization) failsODataEntry readEntry(String contentType, EdmEntitySet entitySet, InputStream content, EntityProviderReadProperties properties) throws EntityProviderException
content
(as InputStream
)
in specified format (given as contentType
) based on
entity data model
(given as EdmEntitySet
)
and provides this data as ODataEntry
.
Does not return complete entry data but only data present in the
de-serialized content.contentType
- format of content in the given input streamentitySet
- entity data model for entity set to be readcontent
- data in form of an InputStream
which
contains the data in specified formatproperties
- additional properties necessary for reading
content from InputStream
into Map
.ODataEntry
EntityProviderException
- if reading of data (de-serialization) failsMap<String,Object> readProperty(String contentType, EdmProperty edmProperty, InputStream content, EntityProviderReadProperties properties) throws EntityProviderException
content
(as InputStream
) in specified format (given as
contentType
)
based on entity data model
(given as EdmProperty
) and provide this data as Map
which
contains
the read data in form of property name
to property value
mapping.contentType
- format of content in the given input stream.edmProperty
- entity data model for entity property to be readcontent
- data in form of an InputStream
which contains the data in specified formatproperties
- additional properties necessary for reading content from InputStream
into Map
.EntityProviderException
- if reading of data (de-serialization) failsObject readPropertyValue(EdmProperty edmProperty, InputStream content, Class<?> typeMapping) throws EntityProviderException
content
(as InputStream
) in format
text/plain
based on entity data model
(given as EdmProperty
) and provide this data as Object
.edmProperty
- entity data model for entity property to be readcontent
- data in form of an InputStream
which contains the data in format text/plain
typeMapping
- defines the mapping for this edm property
to a java class
which
should be used
during read of the content. If according edm property
can not be read
into given java class
an EntityProviderException
is thrown.
Supported mappings are documented in EdmSimpleType
.EntityProviderException
- if reading of data (de-serialization) failsObject readFunctionImport(String contentType, EdmFunctionImport functionImport, InputStream content, EntityProviderReadProperties properties) throws EntityProviderException
content
(as InputStream
) in specified format
(given as contentType
) based on entity data model
(given as EdmFunctionImport
)
and provide this data as Object
.contentType
- format of content in the given input stream.functionImport
- entity data model for Function Import to be readcontent
- data in form of an InputStream
which contains the data in specified formatproperties
- additional properties necessary for reading content from InputStream
into Map
.
Must not be null.Object
EntityProviderException
- if reading of data (de-serialization) failsString readLink(String contentType, EdmEntitySet entitySet, InputStream content) throws EntityProviderException
content
(as InputStream
) in specified format (given as
contentType
)
based on entity data model
(given as EdmEntitySet
) and provide the link as String
.contentType
- format of content in the given input stream.entitySet
- entity data model for entity property to be readcontent
- data in form of an InputStream
which contains the data in specified formatEntityProviderException
- if reading of data (de-serialization) failsList<String> readLinks(String contentType, EdmEntitySet entitySet, InputStream content) throws EntityProviderException
content
(as InputStream
)
in specified format (given as contentType
) based on entity data model
(given as EdmEntitySet
) and provide the link as List of Strings.contentType
- format of content in the given input stream.entitySet
- entity data model for entity property to be readcontent
- data in form of an InputStream
which contains the data in specified formatEntityProviderException
- if reading of data (de-serialization) failsEdm readMetadata(InputStream inputStream, boolean validate) throws EntityProviderException
inputStream
- the given input streamvalidate
- has to be true if metadata should be validatedEdm
EntityProviderException
- if reading of data (de-serialization) failsbyte[] readBinary(InputStream content) throws EntityProviderException
content
- data in form of an InputStream
which contains the binary dataEntityProviderException
- if reading of data (de-serialization) failsODataResponse writeErrorDocument(ODataErrorContext context)
Serializes an error message according to the OData standard.
context
- contains error details see ODataErrorContext
ODataResponse
containing the serialized error messageServiceDocument readServiceDocument(InputStream serviceDocument, String contentType) throws EntityProviderException
inputStream
(as InputStream
) and provide
ServiceDocument as ServiceDocument
serviceDocument
- the given input streamcontentType
- format of content in the given input streamServiceDocument
EntityProviderException
- if reading of data (de-serialization) failsList<BatchRequestPart> parseBatchRequest(String contentType, InputStream content, EntityProviderBatchProperties properties) throws BatchException
inputStream
(as InputStream
) and provide a list of Batch Parts as
BatchPart
contentType
- format of content in the given input streamcontent
- request bodyproperties
- additional properties necessary for parsing. Must not be null.BatchPart
BatchException
- if parsing failsODataResponse writeBatchResponse(List<BatchResponsePart> batchResponseParts) throws BatchException
ODataResponse
.
Batch Response body matches one-to-one with the corresponding Batch Request bodybatchResponseParts
- a list of BatchResponsePart
ODataResponse
BatchException
InputStream writeBatchRequest(List<BatchPart> batchParts, String boundary)
batchParts
- a list of BatchPartRequests BatchPart
boundary
- List<BatchSingleResponse> parseBatchResponse(String contentType, InputStream content) throws BatchException
InputStream
) and provide a list of single responses as
BatchSingleResponse
content
- response bodycontentType
- format of content in the given input stream (incl. boundary parameter)BatchSingleResponse
BatchException
ODataErrorContext readErrorDocument(InputStream errorDocument, String contentType) throws EntityProviderException
InputStream
and provide according
ODataErrorContext
.errorDocument
- error document which is readcontentType
- format of content in the given input streamEntityProviderException
- if reading of data (de-serialization) failsCopyright © 2013-2017 The Apache Software Foundation. All Rights Reserved.