public interface ODataStoreSync extends ODataStore
ODataStore
whose operations are all synchronous.
ODataEntity newTravelagency = new ODataEntityDefaultImpl("RMTSAMPLEFLIGHT.Travelagency");
store.allocateProperties(newTravelagency, PropMode.All);
ODataPropMap propMap = newTravelagency.getProperties();
ODataProperty agencynum = new ODataPropertyDefaultImpl("agencynum", String.valueOf("id"));
propMap.put("agencynum", agencynum);
ODataResponseSingle singleResponse = store.executeCreateEntity(newTravelagency, "TravelagencyCollection", null);
If an error occured during the synchronous request execution an exception is thrown. The root cause of the errors can be a network
error, parsing error, OData Error Response, etc. (see com.sap.smp.client.odata.exception
)ODataNetworkException.AdditionalNetworkExceptionInfo
:
try {
ODataResponseSingle validResponse = store.executeCreateEntity(newEntity, "TravelagencyCollection", null);
} catch (ODataNetworkException e) {
AdditionalNetworkExceptionInfo networkInfo = e.getAdditionalInfo();
String errorStatusCode = networkInfo.getStatusCode();
ODataResponse errorResponse = networkInfo.getResponse();
} catch (ODataException e) {
// handle other exceptions
}
For synchronous batch requests executeRequest
method MUST be used (other methods handle only single request/response).
This case the request parameter is ODataRequestParamBatch
and the response is ODataResponseBatch
.ODataStore.PropMode
Modifier and Type | Method and Description |
---|---|
ODataResponseSingle |
executeCreateEntity(ODataEntity entity,
java.lang.String collectionPath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for creating an Entity.
|
ODataResponseSingle |
executeDeleteEntity(ODataEntity entity,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for deleting an Entity.
|
ODataResponseSingle |
executeDeleteEntity(java.lang.String resourcePath,
java.lang.String etag,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for deleting an Entity.
|
ODataResponseSingle |
executeFunction(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for calling a function.
|
void |
executeMediaDownload(java.net.URL url,
ODataDownloadMediaSyncListener listener)
Executor method for download media content from an URL.
|
ODataResponseSingle |
executePatchEntity(ODataEntity entity,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for patching an Entity.
|
ODataResponseSingle |
executeReadEntity(ODataEntity entity,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading an Entity.
|
ODataResponseSingle |
executeReadEntity(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading an Entity.
|
ODataResponseSingle |
executeReadEntitySet(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading an Entity set.
|
ODataResponseSingle |
executeReadLink(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading a link.
|
ODataResponseSingle |
executeReadLinkSet(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading a link set.
|
ODataResponseSingle |
executeReadPropertyComplex(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading a complex property.
|
ODataResponseSingle |
executeReadPropertyPrimitive(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading a primitive property.
|
ODataResponseSingle |
executeReadPropertyRaw(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for reading the raw value of a property.
|
ODataResponse |
executeRequest(ODataRequestParam request)
General-purpose executor method using which arbitrary requests can be fired.
|
ODataResponseSingle |
executeUpdateEntity(ODataEntity entity,
java.util.Map<java.lang.String,java.lang.String> options)
Executor method for updating an Entity.
|
allocateNavigationProperties, allocateProperties, determineEntitySet, determineEntityType, determineODataType, getMetadata
ODataResponse executeRequest(ODataRequestParam request) throws ODataException
ODataRequestParamBatch
the return object is a ODataResponseBatch
. If the request is a
ODataRequestParamSingle
then the response is ODataResponseSingle
.request
- the actual request to fire. It MUST be non-null, otherwise NullPointerException is thrownODataResponseSingle
) or a batch response (
ODataResponseBatch
.ODataException
- in case of error. E.g. the store is closed, missing resource path, missing batch items. If there is a odata error
server response, the exception is ODataNetworkException. The response can be retrieved by
ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if request parameter is nullODataResponseSingle executeReadEntitySet(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the Entity set. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeReadEntity(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the Entity to be read. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeReadEntity(ODataEntity entity, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
entity
- the Entity to be read. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if entity parameter is nullODataResponseSingle executeCreateEntity(ODataEntity entity, java.lang.String collectionPath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
entity
- the Entity to be created. It MUST be non-null, otherwise NullPointerException is throwncollectionPath
- path of the collection the Entity to be added to. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if entity or collectionPath parameter is nullODataResponseSingle executeUpdateEntity(ODataEntity entity, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
entity
- the Entity to be updated. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if entity parameter is nullODataResponseSingle executePatchEntity(ODataEntity entity, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
entity
- the Entity to be patched. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if entity parameter is nullODataResponseSingle executeDeleteEntity(ODataEntity entity, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
entity
- the Entity to be deleted. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if entity parameter is nullODataResponseSingle executeDeleteEntity(java.lang.String resourcePath, java.lang.String etag, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the Entity to be deleted. It MUST be non-null, otherwise NullPointerException is thrownetag
- ETag can be set for a request for concurrency handling in the server. It sets the "If-Match" header in the HTTP
request. Can be nulloptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeReadPropertyPrimitive(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the property to be read. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeReadPropertyRaw(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the raw value of a property to be read. It MUST be non-null, otherwise NullPointerException is
thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeReadPropertyComplex(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the property to be read. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeReadLink(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the link to be read. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeReadLinkSet(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the link set to be read. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullODataResponseSingle executeFunction(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> options) throws ODataException
resourcePath
- resource path of the function to be called. It MUST be non-null, otherwise NullPointerException is thrownoptions
- the options set for this request. It can be null, in this case default values are used. See
ODataRequestParamSingle.Options
.ODataException
- in case of error. E.g. the store is closed, missing resource path. If there is a odata error server response, the
exception is ODataNetworkException. The response can be retrieved by ODataNetworkException.getAdditionalInfo.java.lang.NullPointerException
- if resourcePath parameter is nullvoid executeMediaDownload(java.net.URL url, ODataDownloadMediaSyncListener listener) throws ODataException
ODataDownloadMediaSyncListener
url
- URL of media content. It MUST be non-null, otherwise NullPointerException is thrown. See
ODataEntity.getMediaLink()
listener
- the listener to invoke with the result. ODataDownloadMediaResult
It MUST be non-null, otherwise
NullPointerException is thrown. See ODataDownloadMediaSyncListener
ODataException