OfflineODataRequestOptions

open class OfflineODataRequestOptions : RequestOptions

Extend the SAPOData.RequestOptions to support Offline OData specific request options.

  • Declaration

    Swift

    override public init()
  • Specifies whether to remove the newly created entity or media resource from the offline store after the entity or media resource is successfully uploaded.

    By default, removeCreatedEntityAfterUpload is false.

    Declaration

    Swift

    open var removeCreatedEntityAfterUpload: Bool { get set }
  • 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, unmodifiableRequest is false.

    Declaration

    Swift

    open var unmodifiableRequest: Bool { get set }
  • Specifies a transaction ID for the request when OfflineODataParameters.enableTransactionBuilder is true.

    By default, transactionID is nil.

    See also

    TransactionID.

    Declaration

    Swift

    open var transactionID: TransactionID? { get set }
  • Specifies a header format for a request.

    This 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 or downloaded from the backend. When the Offline OData server component 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 real key values 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 multiple key properties. The syntax 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 WorkOrder. This backend does not allow a Document media resource to be created unless it 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=<WorkOrder(lodata_sys_eid=X'C0615B04E08D4E85874F2D2AAEE220E800000000'):ID>"
    

    By default, customHeaderFormat is nil.

    Declaration

    Swift

    open var customHeaderFormat: String? { get set }