public interface ListsDataSource
This interface is intended to make it easier to implement an OData
service in cases where all data for each entity set can be provided as a List
of objects from which all
properties described in the
Entity Data Model can be retrieved and set.
By obeying these restrictions, data-source implementations get the following advantages:
Modifier and Type | Interface and Description |
---|---|
static class |
ListsDataSource.BinaryData
Container to store binary data (as byte array) and the associated MIME type.
|
Modifier and Type | Method and Description |
---|---|
void |
createData(EdmEntitySet entitySet,
Object data)
Inserts an instance into the entity list of the specified entity set.
|
void |
deleteData(EdmEntitySet entitySet,
Map<String,Object> keys)
Deletes a single data object identified by the specified entity set and key.
|
void |
deleteRelation(EdmEntitySet sourceEntitySet,
Object sourceData,
EdmEntitySet targetEntitySet,
Map<String,Object> targetKeys)
Deletes the relation from the specified source data to a target entity
specified by entity set and key.
|
Object |
newDataObject(EdmEntitySet entitySet)
Creates and returns a new instance of the requested data-object type.
|
ListsDataSource.BinaryData |
readBinaryData(EdmEntitySet entitySet,
Object mediaLinkEntryData)
Retrieves the binary data and the MIME type for the media resource
associated to the specified media-link entry.
|
List<?> |
readData(EdmEntitySet entitySet)
Retrieves the whole data list for the specified entity set.
|
Object |
readData(EdmEntitySet entitySet,
Map<String,Object> keys)
Retrieves a single data object for the specified entity set and key.
|
Object |
readData(EdmFunctionImport function,
Map<String,Object> parameters,
Map<String,Object> keys)
Retrieves data for the specified function import and key.
|
Object |
readRelatedData(EdmEntitySet sourceEntitySet,
Object sourceData,
EdmEntitySet targetEntitySet,
Map<String,Object> targetKeys)
Retrieves related data for the specified source data, entity set, and key.
|
void |
writeBinaryData(EdmEntitySet entitySet,
Object mediaLinkEntryData,
ListsDataSource.BinaryData binaryData)
Writes the binary data for the media resource associated to the
specified media-link entry.
|
void |
writeRelation(EdmEntitySet sourceEntitySet,
Object sourceData,
EdmEntitySet targetEntitySet,
Map<String,Object> targetKeys)
Writes a relation from the specified source data to a target entity
specified by entity set and key.
|
List<?> readData(EdmEntitySet entitySet) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
entitySet
- the requested EdmEntitySet
ODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
Object readData(EdmEntitySet entitySet, Map<String,Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
entitySet
- the requested EdmEntitySet
keys
- the entity key as map of key names to key valuesODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
Object readData(EdmFunctionImport function, Map<String,Object> parameters, Map<String,Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
Retrieves data for the specified function import and key.
This method is called also for function imports that have defined in
their metadata an other HTTP method than GET
.
function
- the requested EdmFunctionImport
parameters
- the parameters of the function import
as map of parameter names to parameter valueskeys
- the key of the returned entity set, as map of key names to key values,
if the return type of the function import is a collection of entities
(optional)Binary
,
the returned object(s) must be of type ListsDataSource.BinaryData
ODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
Object readRelatedData(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet, Map<String,Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
Retrieves related data for the specified source data, entity set, and key.
If the underlying association of the EDM is specified to have target multiplicity '*' and no target key is given, this method returns a list of related data, otherwise it returns a single data object.
sourceEntitySet
- the EdmEntitySet
of the source entitysourceData
- the data object of the source entitytargetEntitySet
- the requested target EdmEntitySet
targetKeys
- the key of the target entity as map of key names to key values
(optional)ODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
ListsDataSource.BinaryData readBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
entitySet
- the EdmEntitySet
of the media-link entrymediaLinkEntryData
- the data object of the media-link entryODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
Object newDataObject(EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException, ODataApplicationException
Creates and returns a new instance of the requested data-object type.
This instance must not be part of the corresponding list and should
have empty content, apart from the key and other mandatory properties.
However, intermediate objects to access complex properties must not be
null
.
entitySet
- the EdmEntitySet
the object must correspond toODataNotImplementedException
EdmException
ODataApplicationException
void writeBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData, ListsDataSource.BinaryData binaryData) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
entitySet
- the EdmEntitySet
of the media-link entrymediaLinkEntryData
- the data object of the media-link entrybinaryData
- the binary data of the media resource along with
the MIME type of the binary dataODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
void deleteData(EdmEntitySet entitySet, Map<String,Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
entitySet
- the EdmEntitySet
of the entity to be deletedkeys
- the entity key as map of key names to key valuesODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
void createData(EdmEntitySet entitySet, Object data) throws ODataNotImplementedException, EdmException, ODataApplicationException
Inserts an instance into the entity list of the specified entity set.
If newDataObject(org.apache.olingo.odata2.api.edm.EdmEntitySet)
has not set the key and other mandatory
properties already, this method must set them before inserting the
instance into the list.
entitySet
- the EdmEntitySet
the object must correspond todata
- the data object of the new entityODataNotImplementedException
EdmException
ODataApplicationException
void deleteRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet, Map<String,Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
sourceEntitySet
- the EdmEntitySet
of the source entitysourceData
- the data object of the source entitytargetEntitySet
- the EdmEntitySet
of the target entitytargetKeys
- the key of the target entity as map of key names to key values
(optional)ODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
void writeRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet, Map<String,Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
sourceEntitySet
- the EdmEntitySet
of the source entitysourceData
- the data object of the source entitytargetEntitySet
- the EdmEntitySet
of the relation targettargetKeys
- the key of the target entity as map of key names to key valuesODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.