public class ScenarioDataSource extends Object implements ListsDataSource
ListsDataSource.BinaryData
Constructor and Description |
---|
ScenarioDataSource(DataContainer dataContainer) |
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.
|
public ScenarioDataSource(DataContainer dataContainer)
public List<?> readData(EdmEntitySet entitySet) throws ODataNotImplementedException, ODataNotFoundException, EdmException
ListsDataSource
readData
in interface ListsDataSource
entitySet
- the requested EdmEntitySet
ODataNotImplementedException
ODataNotFoundException
EdmException
public Object readData(EdmEntitySet entitySet, Map<String,Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException
ListsDataSource
readData
in interface ListsDataSource
entitySet
- the requested EdmEntitySet
keys
- the entity key as map of key names to key valuesODataNotImplementedException
ODataNotFoundException
EdmException
public Object readRelatedData(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet, Map<String,Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException
ListsDataSource
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.
readRelatedData
in interface ListsDataSource
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
public Object readData(EdmFunctionImport function, Map<String,Object> parameters, Map<String,Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException
ListsDataSource
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
.
readData
in interface ListsDataSource
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
public ListsDataSource.BinaryData readBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
ListsDataSource
readBinaryData
in interface ListsDataSource
entitySet
- the EdmEntitySet
of the media-link entrymediaLinkEntryData
- the data object of the media-link entryODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
public void writeBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData, ListsDataSource.BinaryData binaryData) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
ListsDataSource
writeBinaryData
in interface ListsDataSource
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
public Object newDataObject(EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException
ListsDataSource
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
.
newDataObject
in interface ListsDataSource
entitySet
- the EdmEntitySet
the object must correspond toODataNotImplementedException
EdmException
public void deleteData(EdmEntitySet entitySet, Map<String,Object> keys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
ListsDataSource
deleteData
in interface ListsDataSource
entitySet
- the EdmEntitySet
of the entity to be deletedkeys
- the entity key as map of key names to key valuesODataNotImplementedException
ODataNotFoundException
EdmException
ODataApplicationException
public void createData(EdmEntitySet entitySet, Object data) throws ODataNotImplementedException, EdmException, ODataApplicationException
ListsDataSource
Inserts an instance into the entity list of the specified entity set.
If ListsDataSource.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.
createData
in interface ListsDataSource
entitySet
- the EdmEntitySet
the object must correspond todata
- the data object of the new entityODataNotImplementedException
EdmException
ODataApplicationException
public void deleteRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet, Map<String,Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
ListsDataSource
deleteRelation
in interface ListsDataSource
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
public void writeRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet, Map<String,Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException
ListsDataSource
writeRelation
in interface ListsDataSource
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.