DataServiceProvider

A provider interface for data services, using OData conventions for metadata, queries and updates. Where applicable, client applications should use the {@link com.sap.cloud.mobile.kotlin.odata.DataService} wrapper to invoke provider functions.

Inheritors

Properties

Link copied to clipboard
abstract val hasMetadata: Boolean
Link copied to clipboard
abstract var metadata: CsdlDocument
Link copied to clipboard
abstract val serviceName: String

Functions

Link copied to clipboard
abstract fun createEntity(entity: EntityValue, headers: HttpHeaders, options: RequestOptions)

Create an entity in the target system. Automatically calls {@link com.sap.cloud.mobile.kotlin.odata.csdl.CsdlDocument#resolveEntity(com.sap.cloud.mobile.kotlin.odata.EntityValue) CsdlDocument.resolveEntity} to ensure that {@link com.sap.cloud.mobile.kotlin.odata.EntityValue#entitySet EntityValue.entitySet} is available.

Throws:

{@link com.sap.cloud.mobile.kotlin.odata.DataServiceException} if the entity set hasn't been explicitly provided before calling createEntity and there isn't a unique entity set for the entity type.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.EntityValue#ofType(com.sap.cloud.mobile.kotlin.odata.EntityType, com.sap.cloud.mobile.kotlin.odata.core.SparseIndexMap?) EntityValue.ofType}, {@link com.sap.cloud.mobile.kotlin.odata.EntityValue#inSet(com.sap.cloud.mobile.kotlin.odata.EntitySet) EntityValue.inSet}.

Link copied to clipboard
abstract fun createLink(from: EntityValue, property: Property, to: EntityValue, headers: HttpHeaders, options: RequestOptions)

Create a link from a source entity to a target entity.

Link copied to clipboard
abstract fun createMedia(entity: EntityValue, content: StreamBase, headers: HttpHeaders, options: RequestOptions)

Create a media entity with the specified content in the target system. If the entity has non-stream structural properties in addition to the key properties and media content, such as label in the examples below, then this function will send two requests to the server: a first request to upload (POST) the media stream, and a second request (PATCH/PUT) to update the non-stream properties. It is not currently supported to make these two calls atomic. Caution: Having too many threads simultaneously creating streams may result in out-of-memory conditions on memory-constrained devices.

Link copied to clipboard
abstract fun deleteByQuery(query: DataQuery, headers: HttpHeaders, options: RequestOptions)

Execute query to delete data from the target system.

Link copied to clipboard
abstract fun deleteEntity(entity: EntityValue, headers: HttpHeaders, options: RequestOptions)

Delete an entity from the target system.

Link copied to clipboard
abstract fun deleteLink(from: EntityValue, property: Property, to: EntityValue, headers: HttpHeaders, options: RequestOptions)

Delete a link from a source entity to a target entity.

Link copied to clipboard
abstract fun deleteStream(entity: EntityValue, link: StreamLink, headers: HttpHeaders, options: RequestOptions)

Delete the content of a stream property from the target system.

Link copied to clipboard
abstract fun downloadMedia(entity: EntityValue, headers: HttpHeaders, options: RequestOptions): ByteStream

Obtain a stream for downloading the content of a media entity from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using {@link com.sap.cloud.mobile.kotlin.odata.ByteStream#readAndClose() ByteStream.readAndClose}, may result in out-of-memory conditions on memory-constrained devices.

Link copied to clipboard
abstract fun downloadStream(entity: EntityValue, link: StreamLink, headers: HttpHeaders, options: RequestOptions): ByteStream

Obtain a stream for downloading the content of a stream property from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using {@link com.sap.cloud.mobile.kotlin.odata.ByteStream#readAndClose() ByteStream.readAndClose}, may result in out-of-memory conditions on memory-constrained devices.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.Property#getStreamLink(com.sap.cloud.mobile.kotlin.odata.StructureBase) Property.getStreamLink}.

Link copied to clipboard
abstract fun executeMethod(method: DataMethod, parameters: ParameterList, headers: HttpHeaders, options: RequestOptions): DataValue?

Execute a data method (action or function) in the target system. Actions may have backend side-effects. Functions should not have backend side-effects.

Throws:

{@link com.sap.cloud.mobile.kotlin.odata.DataServiceException} or {@link com.sap.cloud.mobile.kotlin.odata.DataNetworkException} if an error occurs during action invocation.

Link copied to clipboard
abstract fun executeQuery(query: DataQuery, headers: HttpHeaders, options: RequestOptions): QueryResult

Execute a data query to get data from the target system.

Link copied to clipboard
abstract fun fetchMetadata(headers: HttpHeaders, options: RequestOptions): CsdlDocument

Fetch latest service metadata and return it, but don't change the {@link com.sap.cloud.mobile.kotlin.odata.DataServiceProvider#metadata DataServiceProvider.metadata} property.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DataServiceProvider#loadMetadata(com.sap.cloud.mobile.kotlin.odata.http.HttpHeaders, com.sap.cloud.mobile.kotlin.odata.RequestOptions) DataServiceProvider.loadMetadata}.

Link copied to clipboard
abstract fun loadMetadata(headers: HttpHeaders, options: RequestOptions)

Load service metadata (if not already loaded).

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DataServiceProvider#metadata DataServiceProvider.metadata}, {@link com.sap.cloud.mobile.kotlin.odata.DataServiceProvider#hasMetadata DataServiceProvider.hasMetadata}.

Link copied to clipboard
abstract fun pingServer(headers: HttpHeaders, options: RequestOptions)

Ping the server.

Link copied to clipboard
abstract fun processBatch(batch: RequestBatch, headers: HttpHeaders, options: RequestOptions)

Execute a request batch in the target system.

Link copied to clipboard
abstract fun unloadMetadata()

Unload service metadata (if previously loaded).

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DataServiceProvider#metadata DataServiceProvider.metadata}, {@link com.sap.cloud.mobile.kotlin.odata.DataServiceProvider#hasMetadata DataServiceProvider.hasMetadata}.0

Link copied to clipboard
abstract fun updateEntity(entity: EntityValue, headers: HttpHeaders, options: RequestOptions)

Update an entity in the target system.

Link copied to clipboard
abstract fun updateLink(from: EntityValue, property: Property, to: EntityValue, headers: HttpHeaders, options: RequestOptions)

Update a link from a source entity to a target entity.

Link copied to clipboard
abstract fun uploadMedia(entity: EntityValue, content: StreamBase, headers: HttpHeaders, options: RequestOptions)

Upload content for a media entity to the target system Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices. Note: this function cannot be used to create a media entity. See {@link com.sap.cloud.mobile.kotlin.odata.DataService#createMedia(com.sap.cloud.mobile.kotlin.odata.EntityValue, com.sap.cloud.mobile.kotlin.odata.StreamBase, com.sap.cloud.mobile.kotlin.odata.http.HttpHeaders?, com.sap.cloud.mobile.kotlin.odata.RequestOptions?) DataService.createMedia}.

Link copied to clipboard
abstract fun uploadStream(entity: EntityValue, link: StreamLink, content: StreamBase, headers: HttpHeaders, options: RequestOptions)

Upload content for a stream property to the target system. Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.Property#getStreamLink(com.sap.cloud.mobile.kotlin.odata.StructureBase) Property.getStreamLink}.