public final class

OfflineODataRequestOptions

extends RequestOptions
java.lang.Object
   ↳ com.sap.cloud.mobile.odata.RequestOptions
     ↳ com.sap.cloud.mobile.odata.offline.OfflineODataRequestOptions

Class Overview

The class provides Offline OData specific request options.

See Also
  • com.sap.cloud.mobile.odata.RequestOptions

Summary

Nested Classes
class OfflineODataRequestOptions.TransactionID The class represents a TransactionID instance. 
enum OfflineODataRequestOptions.TransactionIDType Transaction ID types  
class OfflineODataRequestOptions.UploadCategory The class represents an UploadCategory instance. 
enum OfflineODataRequestOptions.UploadCategoryType UploadCategory types  
[Expand]
Inherited Fields
From class com.sap.cloud.mobile.odata.RequestOptions
Public Constructors
OfflineODataRequestOptions()
Public Methods
String getCustomHeaderFormatTemplate()
Returns a custom header format template for a request.
OfflineODataRequestOptions.TransactionID getTransactionID()
Returns the transaction ID of the request.
OfflineODataRequestOptions.UploadCategory getUploadCategory()
Returns the upload category of the request.
boolean isRemoveCreatedEntityAfterUpload()
Returns true if the created entity or media resource is removed locally from the offline store after successfully uploaded.
boolean isUnmodifiableRequest()
Certain requests may need to be sent as is.
void setCustomHeaderFormatTemplate(String customHeaderFormatTemplate)
Defines a custom header format template for a request.
void setRemoveCreatedEntityAfterUpload(boolean removeCreatedEntityAfterUpload)
Defines true to remove the created entity or media resource locally from the offline store after successfully uploaded.
void setTransactionID(OfflineODataRequestOptions.TransactionID transactionID)
Defines the transaction ID of the request when transaction builder is enabled.
void setUnmodifiableRequest(boolean unmodifiableRequest)
Defines true if the request is a unmodifiable request.
void setUploadCategory(OfflineODataRequestOptions.UploadCategory uploadCategory)
Defines the upload category of the request.
[Expand]
Inherited Methods
From class com.sap.cloud.mobile.odata.RequestOptions
From class java.lang.Object

Public Constructors

public OfflineODataRequestOptions ()

Public Methods

public String getCustomHeaderFormatTemplate ()

Returns a custom header format template for a request.

This feature allows the application to specify a format for a custom header to send to the backend during an upload. The format can contain placeholders for key properties of other entities that have been created locally but not yet uploaded to the backend. When the Offline OData server gets the response for the create request from the backend for the referenced entities, it replaces the placeholders in the custom header format with the real key values. It then sends the header with the replaced placeholders to the backend.

The syntax of the custom header format is

header_name ':' header_value_format

Where header_name is the name of the header to send to the backend and header_value_format is the format for the header value. The header_value_format can contain placeholders for keys of the referenced entity. The header_value_format can have multiple placeholders to reference multiple entities and key properties. The format of a placeholder is as follows:

'<' referenced entity ID ':' key property name '>'

For example, imagine a backend has a WorkOrder entity (with a single key property, ID) and a Document media resource related to the WorkOrder. This backend does not allow a Document media resource to be created unless it is related to a WorkOrder and the backend requires the information about the related WorkOrder to be specified by the Slug header. The Slug header in this example is also used to specify the name of the new document. The application creates a WorkOrder while offline with local ID WorkOrder(lodata_sys_eid=X'C0615B04E08D4E85874F2D2AAEE220E800000000'). The application can then create a related Document offline which will be related to the newly created WorkOrder by the backend by specifying the following customHeaderFormat:

"slug:DocumentName='NewDocument',WorkOrderID="

By default, customHeaderFormatTemplate value is null.

Returns
  • a header format template.

public OfflineODataRequestOptions.TransactionID getTransactionID ()

Returns the transaction ID of the request.

By default, transactionID is null.

Returns
  • transaction ID of the request.

public OfflineODataRequestOptions.UploadCategory getUploadCategory ()

Returns the upload category of the request.

By default, uploadCategory is null.

Returns
  • upload category of the request.

public boolean isRemoveCreatedEntityAfterUpload ()

Returns true if the created entity or media resource is removed locally from the offline store after successfully uploaded.

By default, the value is false.

Returns
  • true if the created entity or media resource is removed locally from the offline store after successfully uploaded, otherwise false.

public boolean isUnmodifiableRequest ()

Certain requests may need to be sent as is. For example, imagine an entity which needs to move from one explicit state to another such as NEW, IN PROCESS, SOLUTION PROVIDED, CONFIRMED. For such requests, set 'unmodifiableRequest' to 'true'. Such requests will be left as is (not combined with other requests) by either request queue optimization or when automatically combining requests to fix errors.

Note that a request with 'unmodifiableRequest' set to 'true' can also affect transaction building.

By default, the value is false.

Returns
  • true if the request is a unmodifiable request.

public void setCustomHeaderFormatTemplate (String customHeaderFormatTemplate)

Defines a custom header format template for a request.

Parameters
customHeaderFormatTemplate a custom header format template for a request.

public void setRemoveCreatedEntityAfterUpload (boolean removeCreatedEntityAfterUpload)

Defines true to remove the created entity or media resource locally from the offline store after successfully uploaded.

Parameters
removeCreatedEntityAfterUpload true to remove the created entity or media source locally after successfully uploaded.

public void setTransactionID (OfflineODataRequestOptions.TransactionID transactionID)

Defines the transaction ID of the request when transaction builder is enabled.

Parameters
transactionID the transaction ID.

public void setUnmodifiableRequest (boolean unmodifiableRequest)

Defines true if the request is a unmodifiable request.

Parameters
unmodifiableRequest true if the request is a unmodifiable request.

public void setUploadCategory (OfflineODataRequestOptions.UploadCategory uploadCategory)

Defines the upload category of the request.

Parameters
uploadCategory the upload category.