namespace sap.ui.model.odata.v4.ODataUtils

Visiblity: public
Available since: N/A
Module: sap/ui/model/odata/v4/ODataUtils
Application Component: CA-UI5-COR

A collection of methods which help to consume OData V4 services.


Nodes Overview

Node Description

Methods Overview

Method Description
sap.ui.model.odata.v4.ODataUtils.compare

Compares the given OData values.

sap.ui.model.odata.v4.ODataUtils.deserializeBatchResponse

Deserializes a batch response body using the batch boundary from the given value of the "Content-Type" header.

sap.ui.model.odata.v4.ODataUtils.formatLiteral

Formats the given OData value into a literal suitable for usage in data binding paths and URLs.

sap.ui.model.odata.v4.ODataUtils.parseDate

Parses an "Edm.Date" value and returns the corresponding JavaScript Date value (UTC with a time value of "00:00:00").

sap.ui.model.odata.v4.ODataUtils.parseDateTimeOffset

Parses an "Edm.DateTimeOffset" value and returns the corresponding JavaScript Date value.

sap.ui.model.odata.v4.ODataUtils.parseTimeOfDay

Parses an "Edm.TimeOfDay" value and returns the corresponding JavaScript Date value (UTC with a date value of "1970-01-01").

sap.ui.model.odata.v4.ODataUtils.serializeBatchRequest

Serializes an array of requests to an object containing the batch request body and mandatory headers for the batch request.

sap.ui.model.odata.v4.ODataUtils.compare

Compares the given OData values.

Param Type DefaultValue Description
vValue1 any

The first value to compare

vValue2 any

The second value to compare

vEdmType boolean string

If true or "Decimal", the string values vValue1 and vValue2 are assumed to be valid "Edm.Decimal" or "Edm.Int64" values and are compared as a decimal number (only sign, integer and fraction digits; no exponential format). If "DateTime", the string values vValue1 and vValue2 are assumed to be valid "Edm.DateTimeOffset" values and are compared based on the corresponding number of milliseconds since 1 January, 1970 UTC. Otherwise the values are compared with the JavaScript operators === and >.

sap.ui.model.odata.v4.ODataUtils.deserializeBatchResponse

Deserializes a batch response body using the batch boundary from the given value of the "Content-Type" header.

Param Type DefaultValue Description
sContentType string

The value of the "Content-Type" header from the batch response, for example "multipart/mixed; boundary=batch_123456"

sResponseBody string

A batch response body

sap.ui.model.odata.v4.ODataUtils.formatLiteral

Formats the given OData value into a literal suitable for usage in data binding paths and URLs.

Param Type DefaultValue Description
vValue any

The value according to "OData JSON Format Version 4.0" section "7.1 Primitive Value"

sType string

The OData primitive type, for example "Edm.String"

sap.ui.model.odata.v4.ODataUtils.parseDate

Parses an "Edm.Date" value and returns the corresponding JavaScript Date value (UTC with a time value of "00:00:00").

Param Type DefaultValue Description
sDate string

The "Edm.Date" value to parse

sap.ui.model.odata.v4.ODataUtils.parseDateTimeOffset

Parses an "Edm.DateTimeOffset" value and returns the corresponding JavaScript Date value.

Param Type DefaultValue Description
sDateTimeOffset string

The "Edm.DateTimeOffset" value to parse

sap.ui.model.odata.v4.ODataUtils.parseTimeOfDay

Parses an "Edm.TimeOfDay" value and returns the corresponding JavaScript Date value (UTC with a date value of "1970-01-01").

Param Type DefaultValue Description
sTimeOfDay string

The "Edm.TimeOfDay" value to parse

sap.ui.model.odata.v4.ODataUtils.serializeBatchRequest

Serializes an array of requests to an object containing the batch request body and mandatory headers for the batch request.

Param Type DefaultValue Description
aRequests object[]

An array consisting of request objects or arrays of request objects, in case requests need to be sent in scope of a change set. See example below. Change set requests are annotated with a property $ContentID containing the corresponding "Content-ID" header from the serialized batch request body.

sEpilogue string

A string that will be included in the epilogue (which acts like a comment)