class sap.ui.model.odata.v4.ODataModel

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

Model implementation for OData V4.

This model is not prepared to be inherited from.

Every resource path (relative to the service root URL, no query options) according to "4 Resource Path" in specification "OData Version 4.0 Part 2: URL Conventions" is a valid data binding path within this model if a leading slash is added; for example "/" + "SalesOrderList('A%2FB%26C')" to access an entity instance with key "A/B&C". Note that appropriate URI encoding is necessary, see the example of sap.ui.model.odata.v4.ODataUtils.formatLiteral. "4.5.1 Addressing Actions" needs an operation binding, see sap.ui.model.odata.v4.ODataContextBinding.

Note that the OData V4 model has its own sap.ui.model.odata.v4.Context class. Bindings which are relative to such a V4 context depend on their corresponding parent binding and do not access data with their own service requests unless parameters are provided.

Group IDs control the model's use of batch requests. Valid group IDs are:


Constructor

Constructor for a new ODataModel.

new sap.ui.model.odata.v4.ODataModel(mParameters)
Param Type Default Value Description
mParameters object

The parameters

annotationURI? string string[]

The URL (or an array of URLs) from which the annotation metadata are loaded. The annotation files are merged into the service metadata in the given order (last one wins). The same annotations are overwritten; if an annotation file contains other elements (like a type definition) that are already merged, an error is thrown. Supported since 1.41.0

autoExpandSelect? boolean

Whether the OData model's bindings automatically generate $select and $expand system query options from the binding hierarchy. Note: Dynamic changes to the binding hierarchy are not supported. This parameter is supported since 1.47.0, and since 1.75.0 it also enables property paths containing navigation properties in $select.

earlyRequests? boolean

Whether the following is requested at the earliest convenience:

  • root $metadata document and annotation files;
  • the security token.
Note: The root $metadata document and annotation files are just requested but not yet converted from XML to JSON unless really needed. Supported since 1.53.0. BEWARE: The default value may change to true in later releases. You may also set Manifest Model Preload in order to further speed up the start of a UI5 component.

groupId? string "$auto"

Controls the model's use of batch requests: '$auto' bundles requests from the model in a batch request which is sent automatically before rendering; '$direct' sends requests directly without batch; other values result in an error

groupProperties? object

Controls the use of batch requests for application groups. A map of application group IDs having an object with exactly one property submit. Valid values are 'API', 'Auto', 'Direct' see sap.ui.model.odata.v4.SubmitMode. Supported since 1.51.0

httpHeaders? object

Map of HTTP header names to their values, see #changeHttpHeaders

metadataUrlParams? object

Additional map of URL parameters used specifically for $metadata requests. Note that "sap-context-token" applies only to the service's root $metadata, but not to "cross-service references". Supported since 1.81.0

odataVersion? string "4.0"

The version of the OData service. Supported values are "2.0" and "4.0".

operationMode? sap.ui.model.odata.OperationMode

The operation mode for filtering and sorting. Since 1.39.0, the operation mode sap.ui.model.odata.OperationMode.Server is supported. All other operation modes including undefined lead to an error if 'vFilters' or 'vSorters' are given or if sap.ui.model.odata.v4.ODataListBinding#filter or sap.ui.model.odata.v4.ODataListBinding#sort is called.

serviceUrl string

Root URL of the service to request data from. The path part of the URL must end with a forward slash according to OData V4 specification ABNF, rule "serviceRoot". You may append OData custom query options to the service root URL separated with a "?", for example "/MyService/?custom=foo". See specification "OData Version 4.0 Part 2: URL Conventions", "5.2 Custom Query Options". OData system query options and OData parameter aliases lead to an error.

sharedRequests? boolean

Whether all list bindings for the same resource path share their data, so that it is requested only once; only the value true is allowed; see parameter "$$sharedRequest" of #bindList. Additionally, sap.ui.model.BindingMode.OneWay becomes the default binding mode and sap.ui.model.BindingMode.TwoWay is forbidden. Note: This makes all bindings read-only, so it may be especially useful for value list models. Supported since 1.80.0

supportReferences? boolean true

Whether <edmx:Reference> and <edmx:Include> directives are supported in order to load schemas on demand from other $metadata documents and include them into the current service ("cross-service references").

synchronizationMode string

Controls synchronization between different bindings which refer to the same data for the case data changes in one binding. Must be set to 'None' which means bindings are not synchronized at all; all other values are not supported and lead to an error.

updateGroupId? string

The group ID that is used for update requests. If no update group ID is specified, mParameters.groupId is used. Valid update group IDs are undefined, '$auto', '$direct' or an application group ID.


Events Overview

Event Description
parseError

The 'parseError' event is not supported by this model.

Since: 1.37.0.

propertyChange

The 'propertyChange' event is not supported by this model.

Since: 1.37.0.

requestCompleted

The 'requestCompleted' event is not supported by this model.

Since: 1.37.0.

requestFailed

The 'requestFailed' event is not supported by this model.

Since: 1.37.0.

requestSent

The 'requestSent' event is not supported by this model.

Since: 1.37.0.

sessionTimeout

The 'sessionTimeout' event is fired when the server has created a session for the model and this session ran into a timeout due to inactivity.

Since: 1.66.0.

parseError

The 'parseError' event is not supported by this model.

Since: 1.37.0.

propertyChange

The 'propertyChange' event is not supported by this model.

Since: 1.37.0.

requestCompleted

The 'requestCompleted' event is not supported by this model.

Since: 1.37.0.

requestFailed

The 'requestFailed' event is not supported by this model.

Since: 1.37.0.

requestSent

The 'requestSent' event is not supported by this model.

Since: 1.37.0.

sessionTimeout

The 'sessionTimeout' event is fired when the server has created a session for the model and this session ran into a timeout due to inactivity.

Since: 1.66.0.


Methods Overview

Method Description
attachEvent

See sap.ui.base.EventProvider#attachEvent

References:

  • sap.ui.base.EventProvider#attachEvent

attachSessionTimeout

Attach event handler fnFunction to the 'sessionTimeout' event of this model.

bindContext

Creates a new context binding for the given path, context and parameters.

References:

  • sap.ui.model.Model#bindContext

bindList

Creates a new list binding for the given path and optional context which must resolve to an absolute OData path for an entity set.

References:

  • sap.ui.model.Model#bindList

bindProperty

Creates a new property binding for the given path. This binding is inactive and will not know the property value initially. You have to call sap.ui.model.Binding#initialize to get it updated asynchronously and register a change listener at the binding to be informed when the value is available.

It is possible to create a property binding pointing to metadata. A '##' in the binding's path is recognized as a separator and splits it into two parts. The part before the separator is resolved with the binding's context and the result is transformed into a metadata context (see sap.ui.model.odata.v4.ODataMetaModel#getMetaContext). The part following the separator is then interpreted relative to this metadata context, even if it starts with a '/'; see sap.ui.model.odata.v4.ODataMetaModel#requestObject for more details.

If the target type specified in the corresponding control property's binding info is "any" and the binding is relative or points to metadata, the binding may have an object value; in this case and unless the binding refers to an action advertisement the binding's mode must be sap.ui.model.BindingMode.OneTime.

References:

  • sap.ui.base.ManagedObject#bindProperty
  • sap.ui.model.Model#bindProperty
  • sap.ui.model.PropertyBinding#setType

bindTree

Method not supported

References:

  • sap.ui.model.Model#bindTree

changeHttpHeaders

Changes the HTTP headers used for data and metadata requests sent by this model.

If batch requests are used, the headers will be set for the batch itself, as well as for the individual requests within the batch. The headers are changed according to the given map of headers: Headers with an undefined value are removed, the other headers are set, and missing headers remain unchanged. The following headers must not be used:

  • OData V4 requests headers as specified in "8.1 Common Headers" and "8.2 Request Headers" of the specification "OData Version 4.0 Part 1: Protocol"
  • OData V2 request headers as specified in "2.2.5 HTTP Header Fields" of the specification "OData Version 2 v10.1"
  • The headers "Content-Id" and "Content-Transfer-Encoding"
  • The header "SAP-ContextId"
Note: The "X-CSRF-Token" header will not be used for metadata requests.

If not undefined, a header value must conform to the following rules:

  • It must be a non-empty string.
  • It must be completely in the US-ASCII character set.
  • It must not contain control characters.


References:
  • #getHttpHeaders

createBindingContext

Creates a binding context for the given path. A relative path can only be resolved if a context is provided. Note: The parameters mParameters, fnCallBack, and bReload from sap.ui.model.Model#createBindingContext are not supported.

It is possible to create binding contexts pointing to metadata. A '##' is recognized as separator in the resolved path and splits it into two parts; note that '#' may also be used as separator but is deprecated since 1.51. The part before the separator is transformed into a metadata context (see sap.ui.model.odata.v4.ODataMetaModel#getMetaContext). The part following the separator is then interpreted relative to this metadata context, even if it starts with a '/'; a trailing '/' is allowed here, see sap.ui.model.odata.v4.ODataMetaModel#requestObject for the effect it has.

A binding path may also point to an operation advertisement which is addressed with '#.' and is part of the data payload, not the metadata. The metadata of an operation can be addressed via '##' as described above.

Examples:

  • /Products('42')/Name##@com.sap.vocabularies.Common.v1.Label points to the "Label" annotation of the "Name" property of the entity set "Products".
  • /##Products/Name@com.sap.vocabularies.Common.v1.Label has no data path part and thus starts at the metadata root. It also points to the "Label" annotation of the "Name" property of the entity set "Products".
  • /Products##/ points to the entity type (note the trailing '/') of the entity set "Products".
  • /EMPLOYEES('1')/##com.sap.Action points to the metadata of an action bound to the entity set "EMPLOYEES".
  • /EMPLOYEES('1')/#com.sap.Action does not point to metadata, but to the action advertisement.


References:
  • sap.ui.model.Model#createBindingContext

destroy

Destroys this model, its requestor and its meta model.

References:

  • sap.ui.model.Model#destroy

destroyBindingContext

Method not supported

detachSessionTimeout

Detach event handler fnFunction from the 'sessionTimeout' event of this model.

sap.ui.model.odata.v4.ODataModel.extend

Creates a new subclass of class sap.ui.model.odata.v4.ODataModel with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.model.Model.extend.

getAllBindings

Returns the model's bindings.

getGroupId

Returns the model's group ID.

References:

  • sap.ui.model.odata.v4.ODataModel#constructor

getHttpHeaders

Returns a map of HTTP headers used for data and metadata requests. While the "X-CSRF-Token" header is not used for metadata requests, it is still included here if available. The "SAP-ContextId" header is only included if requested explicitly (@since 1.86.0).

References:

  • #changeHttpHeaders

getMessages

Returns messages of this model associated with the given context, that is messages belonging to the object referred to by this context or a child object of that object. The messages are sorted by their type according to the type's severity in a way that messages with highest severity come first.

References:

  • sap.ui.model.Model#getMessages

sap.ui.model.odata.v4.ODataModel.getMetadata

Returns a metadata object for class sap.ui.model.odata.v4.ODataModel.

getMetaModel

Returns the meta model for this ODataModel.

getObject

Method not supported

getODataVersion

Returns the version of the OData service.

getOriginalProperty

Method not supported

getProperty

Method not supported

References:

  • sap.ui.model.Model#getProperty

getUpdateGroupId

Returns the model's update group ID.

References:

  • sap.ui.model.odata.v4.ODataModel#constructor

hasPendingChanges

Returns true if there are pending changes, meaning updates or created entities (see sap.ui.model.odata.v4.ODataListBinding#create) that have not yet been successfully sent to the server.

refresh

Refreshes the model by calling refresh on all bindings which have a change event handler attached.

Note: When calling #refresh multiple times, the result of the request triggered by the last call determines the model's data; it is independent of the order of calls to #submitBatch with the given group ID.

If there are pending changes, an error is thrown. Use #hasPendingChanges to check if there are pending changes. If there are changes, call #submitBatch to submit the changes or #resetChanges to reset the changes before calling #refresh.

References:

  • sap.ui.model.Model#refresh
  • sap.ui.model.odata.v4.ODataContextBinding#refresh
  • sap.ui.model.odata.v4.ODataListBinding#refresh
  • sap.ui.model.odata.v4.ODataPropertyBinding#refresh

requestCanonicalPath

Returns a promise for the "canonical path" of the entity for the given context. According to "4.3.1 Canonical URL" of the specification "OData Version 4.0 Part 2: URL Conventions", this is the "name of the entity set associated with the entity followed by the key predicate identifying the entity within the collection". Use the canonical path in sap.ui.core.Element#bindElement to create an element binding.

Since 1.39.0 Use {@link sap.ui.model.odata.v4.Context#requestCanonicalPath} instead.
resetChanges

Resets all property changes and created entities associated with the given group ID which have not been successfully submitted via #submitBatch. Resets also invalid user input for the same group ID. This function does not reset the deletion of entities (see sap.ui.model.odata.v4.Context#delete) and the execution of OData operations (see sap.ui.model.odata.v4.ODataContextBinding#execute).

References:

  • sap.ui.model.odata.v4.ODataModel#constructor.

setLegacySyntax

Method not supported

submitBatch

Submits the requests associated with the given group ID in one batch request. Requests from subsequent calls to this method for the same group ID may be combined in one batch request using separate change sets. For group IDs with sap.ui.model.odata.v4.SubmitMode.Auto, only a single change set is used; this method is useful to repeat failed updates or creates (see sap.ui.model.odata.v4.ODataListBinding#create) together with all other requests for the given group ID in one batch request.

toString

Returns a string representation of this object including the service URL.

attachEvent

See sap.ui.base.EventProvider#attachEvent

References:

Param Type DefaultValue Description
sEventId string

The identifier of the event to listen for

_oData object
_fnFunction function
_oListener object

attachSessionTimeout

Attach event handler fnFunction to the 'sessionTimeout' event of this model.

Param Type DefaultValue Description
fnFunction function

The function to call when the event occurs

oListener object

Object on which to call the given function

bindContext

Creates a new context binding for the given path, context and parameters.

References:

Param Type DefaultValue Description
sPath string

The binding path in the model; must not end with a slash

oContext sap.ui.model.odata.v4.Context

The context which is required as base for a relative path

mParameters object

Map of binding parameters which can be OData query options as specified in "OData Version 4.0 Part 2: URL Conventions" or the binding-specific parameters as specified below. Note: The binding creates its own data service request if it is absolute or if it has any parameters or if it is relative and has a context created via #createBindingContext. The following OData query options are allowed:

  • All "5.2 Custom Query Options" except for those with a name starting with "sap-" (unless starting with "sap-valid-")
  • The $count, $expand, $filter, $levels, $orderby, $search and $select "5.1 System Query Options"; OData V4 only allows $count, $filter, $levels, $orderby and $search inside resource paths that identify a collection. In our case here, this means you can only use them inside $expand.
All other query options lead to an error. Query options specified for the binding overwrite model query options.

$$canonicalPath boolean

Whether a binding relative to a sap.ui.model.odata.v4.Context uses the canonical path computed from its context's path for data service requests; only the value true is allowed.

$$groupId string

The group ID to be used for read requests triggered by this binding; if not specified, either the parent binding's group ID (if the binding is relative) or the model's group ID is used, see sap.ui.model.odata.v4.ODataModel#constructor. Valid values are undefined, '$auto', '$auto.*', '$direct' or application group IDs as specified in sap.ui.model.odata.v4.ODataModel.

$$inheritExpandSelect boolean

For operation bindings only: Whether $expand and $select from the parent binding are used in the request sent on #execute. If set to true, the binding must not set the $expand itself, the operation must be bound, and the return value and the binding parameter must belong to the same entity set.

$$ownRequest boolean

Whether the binding always uses an own service request to read its data; only the value true is allowed.

$$patchWithoutSideEffects boolean

Whether implicit loading of side effects via PATCH requests is switched off; only the value true is allowed. This sets the preference "return=minimal" and requires the service to return an ETag header for "204 No Content" responses. If not specified, the value of the parent binding is used.

$$updateGroupId string

The group ID to be used for update requests triggered by this binding; if not specified, either the parent binding's update group ID (if the binding is relative) or the model's update group ID is used, see sap.ui.model.odata.v4.ODataModel#constructor. For valid values, see parameter "$$groupId".

bindList

Creates a new list binding for the given path and optional context which must resolve to an absolute OData path for an entity set.

References:

Param Type DefaultValue Description
sPath string

The binding path in the model; must not end with a slash

oContext sap.ui.model.Context

The context which is required as base for a relative path

vSorters sap.ui.model.Sorter sap.ui.model.Sorter[]

The dynamic sorters to be used initially. Call sap.ui.model.odata.v4.ODataListBinding#sort to replace them. Static sorters, as defined in the '$orderby' binding parameter, are always executed after the dynamic sorters. Supported since 1.39.0.

vFilters sap.ui.model.Filter sap.ui.model.Filter[]

The dynamic application filters to be used initially. Call sap.ui.model.odata.v4.ODataListBinding#filter to replace them. Static filters, as defined in the '$filter' binding parameter, are always combined with the dynamic filters using a logical AND. Supported since 1.39.0.

mParameters object

Map of binding parameters which can be OData query options as specified in "OData Version 4.0 Part 2: URL Conventions" or binding-specific parameters as specified below. Note: The binding creates its own data service request if it is absolute or if it has any parameters or if it is relative and has a context created via #createBindingContext or if it has sorters or filters. The following OData query options are allowed:

  • All "5.2 Custom Query Options" except for those with a name starting with "sap-" (unless starting with "sap-valid-")
  • The $apply, $count, $expand, $filter, $levels, $orderby, $search, and $select "5.1 System Query Options"
All other query options lead to an error. Query options specified for the binding overwrite model query options.

$$aggregation object

An object holding the information needed for data aggregation, see sap.ui.model.odata.v4.ODataListBinding#setAggregation for details.

$$canonicalPath boolean

Whether a binding relative to a sap.ui.model.odata.v4.Context uses the canonical path computed from its context's path for data service requests; only the value true is allowed.

$$groupId string

The group ID to be used for read requests triggered by this binding; if not specified, either the parent binding's group ID (if the binding is relative) or the model's group ID is used, see sap.ui.model.odata.v4.ODataModel#constructor. Valid values are undefined, '$auto', '$auto.*', '$direct' or application group IDs as specified in sap.ui.model.odata.v4.ODataModel.

$$operationMode sap.ui.model.odata.OperationMode

The operation mode for filtering and sorting with the model's operation mode as default. Since 1.39.0, the operation mode sap.ui.model.odata.OperationMode.Server is supported. All other operation modes including undefined lead to an error if 'vFilters' or 'vSorters' are given or if sap.ui.model.odata.v4.ODataListBinding#filter or sap.ui.model.odata.v4.ODataListBinding#sort is called.

$$patchWithoutSideEffects boolean

Whether implicit loading of side effects via PATCH requests is switched off; only the value true is allowed. This sets the preference "return=minimal" and requires the service to return an ETag header for "204 No Content" responses. If not specified, the value of the parent binding is used.

$$ownRequest boolean

Whether the binding always uses an own service request to read its data; only the value true is allowed.

$$sharedRequest boolean

Whether multiple bindings for the same resource path share the data, so that it is requested only once; only the value true is allowed. This parameter can be inherited from the model's parameter "sharedRequests", see sap.ui.model.odata.v4.ODataModel#constructor. Supported since 1.80.0 Note: These bindings are read-only, so they may be especially useful for value lists; the following APIs are not allowed

$$updateGroupId string

The group ID to be used for update requests triggered by this binding; if not specified, either the parent binding's update group ID (if the binding is relative) or the model's update group ID is used, see sap.ui.model.odata.v4.ODataModel#constructor. For valid values, see parameter "$$groupId".

bindProperty

Creates a new property binding for the given path. This binding is inactive and will not know the property value initially. You have to call sap.ui.model.Binding#initialize to get it updated asynchronously and register a change listener at the binding to be informed when the value is available.

It is possible to create a property binding pointing to metadata. A '##' in the binding's path is recognized as a separator and splits it into two parts. The part before the separator is resolved with the binding's context and the result is transformed into a metadata context (see sap.ui.model.odata.v4.ODataMetaModel#getMetaContext). The part following the separator is then interpreted relative to this metadata context, even if it starts with a '/'; see sap.ui.model.odata.v4.ODataMetaModel#requestObject for more details.

If the target type specified in the corresponding control property's binding info is "any" and the binding is relative or points to metadata, the binding may have an object value; in this case and unless the binding refers to an action advertisement the binding's mode must be sap.ui.model.BindingMode.OneTime.

References:

Param Type DefaultValue Description
sPath string

The binding path in the model; must not end with a slash

oContext sap.ui.model.Context

The context which is required as base for a relative path

mParameters object

Map of binding parameters which can be OData query options as specified in "OData Version 4.0 Part 2: URL Conventions" or the binding-specific parameters as specified below. The following OData query options are allowed:

  • All "5.2 Custom Query Options" except for those with a name starting with "sap-" (unless starting with "sap-valid-")
  • The $apply, $filter, and $search "5.1 System Query Options" if the path ends with a "$count" segment.
All other query options lead to an error. Query options specified for the binding overwrite model query options. Note: The binding only creates its own data service request if it is absolute or if it is relative to a context created via #createBindingContext. The binding parameters are ignored in case the binding creates no own data service request or in case the binding points to metadata.

$$groupId string

The group ID to be used for read requests triggered by this binding; if not specified, either the parent binding's group ID (if the binding is relative) or the model's group ID is used, see sap.ui.model.odata.v4.ODataModel#constructor. Valid values are undefined, '$auto', '$auto.*', '$direct' or application group IDs as specified in sap.ui.model.odata.v4.ODataModel.

$$ignoreMessages boolean

Whether this binding does not propagate model messages to the control; supported since 1.82.0. Some composite types like sap.ui.model.odata.type.Currency or sap.ui.model.odata.type.Unit automatically ignore messages for some of their parts depending on their format options; setting this parameter to true or false overrules the automatism of the type.

For example, a binding for a currency code is used in a composite binding for rendering the proper number of decimals, but the currency code is not displayed in the attached control. In that case, messages for the currency code shall not be displayed at that control, only messages for the amount.

$$noPatch boolean

Whether changing the value of this property binding is not causing a PATCH request; only the value true is allowed.

bindTree

Method not supported

References:

Param Type DefaultValue Description
_sPath string
_oContext sap.ui.model.Context
_aFilters sap.ui.model.Filter[]
_mParameters object
_aSorters sap.ui.model.Sorter[]

changeHttpHeaders

Changes the HTTP headers used for data and metadata requests sent by this model.

If batch requests are used, the headers will be set for the batch itself, as well as for the individual requests within the batch. The headers are changed according to the given map of headers: Headers with an undefined value are removed, the other headers are set, and missing headers remain unchanged. The following headers must not be used:

Note: The "X-CSRF-Token" header will not be used for metadata requests.

If not undefined, a header value must conform to the following rules:



References:

Param Type DefaultValue Description
mHeaders object

Map of HTTP header names to their values

createBindingContext

Creates a binding context for the given path. A relative path can only be resolved if a context is provided. Note: The parameters mParameters, fnCallBack, and bReload from sap.ui.model.Model#createBindingContext are not supported.

It is possible to create binding contexts pointing to metadata. A '##' is recognized as separator in the resolved path and splits it into two parts; note that '#' may also be used as separator but is deprecated since 1.51. The part before the separator is transformed into a metadata context (see sap.ui.model.odata.v4.ODataMetaModel#getMetaContext). The part following the separator is then interpreted relative to this metadata context, even if it starts with a '/'; a trailing '/' is allowed here, see sap.ui.model.odata.v4.ODataMetaModel#requestObject for the effect it has.

A binding path may also point to an operation advertisement which is addressed with '#.' and is part of the data payload, not the metadata. The metadata of an operation can be addressed via '##' as described above.

Examples:



References:

Param Type DefaultValue Description
sPath string

The binding path, may be relative to the provided context

oContext sap.ui.model.Context

The context which is required as base for a relative path

destroy

Destroys this model, its requestor and its meta model.

References:

destroyBindingContext

Method not supported

detachSessionTimeout

Detach event handler fnFunction from the 'sessionTimeout' event of this model.

Param Type DefaultValue Description
fnFunction function

The function to call when the event occurs

oListener object

Object on which to call the given function

sap.ui.model.odata.v4.ODataModel.extend

Creates a new subclass of class sap.ui.model.odata.v4.ODataModel with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.model.Model.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getAllBindings

Returns the model's bindings.

getGroupId

Returns the model's group ID.

References:

getHttpHeaders

Returns a map of HTTP headers used for data and metadata requests. While the "X-CSRF-Token" header is not used for metadata requests, it is still included here if available. The "SAP-ContextId" header is only included if requested explicitly (@since 1.86.0).

References:

Param Type DefaultValue Description
bIncludeContextId boolean

Whether to include the "SAP-ContextId" header (@since 1.86.0)

getMessages

Returns messages of this model associated with the given context, that is messages belonging to the object referred to by this context or a child object of that object. The messages are sorted by their type according to the type's severity in a way that messages with highest severity come first.

References:

Param Type DefaultValue Description
oContext sap.ui.model.Context

The context to retrieve messages for

sap.ui.model.odata.v4.ODataModel.getMetadata

Returns a metadata object for class sap.ui.model.odata.v4.ODataModel.

getMetaModel

Returns the meta model for this ODataModel.

getObject

Method not supported

getODataVersion

Returns the version of the OData service.

getOriginalProperty

Method not supported

getProperty

Method not supported

References:

getUpdateGroupId

Returns the model's update group ID.

References:

hasPendingChanges

Returns true if there are pending changes, meaning updates or created entities (see sap.ui.model.odata.v4.ODataListBinding#create) that have not yet been successfully sent to the server.

Param Type DefaultValue Description
sGroupId string

A group ID as specified in sap.ui.model.odata.v4.ODataModel, except group IDs having sap.ui.model.odata.v4.SubmitMode.Direct; if specified, only pending changes related to that group ID are considered (since 1.70.0)

refresh

Refreshes the model by calling refresh on all bindings which have a change event handler attached.

Note: When calling #refresh multiple times, the result of the request triggered by the last call determines the model's data; it is independent of the order of calls to #submitBatch with the given group ID.

If there are pending changes, an error is thrown. Use #hasPendingChanges to check if there are pending changes. If there are changes, call #submitBatch to submit the changes or #resetChanges to reset the changes before calling #refresh.

References:

Param Type DefaultValue Description
sGroupId string boolean

The group ID to be used for refresh; valid values are undefined, '$auto', '$auto.*', '$direct' or application group IDs as specified in sap.ui.model.odata.v4.ODataModel. It is ignored for suspended bindings, because resume uses the binding's group ID. A value of type boolean is not accepted and an error will be thrown (a forced refresh is not supported).

requestCanonicalPath

Returns a promise for the "canonical path" of the entity for the given context. According to "4.3.1 Canonical URL" of the specification "OData Version 4.0 Part 2: URL Conventions", this is the "name of the entity set associated with the entity followed by the key predicate identifying the entity within the collection". Use the canonical path in sap.ui.core.Element#bindElement to create an element binding.

Since 1.39.0 Use {@link sap.ui.model.odata.v4.Context#requestCanonicalPath} instead.
Param Type DefaultValue Description
oEntityContext sap.ui.model.odata.v4.Context

A context in this model which must point to a non-contained OData entity

resetChanges

Resets all property changes and created entities associated with the given group ID which have not been successfully submitted via #submitBatch. Resets also invalid user input for the same group ID. This function does not reset the deletion of entities (see sap.ui.model.odata.v4.Context#delete) and the execution of OData operations (see sap.ui.model.odata.v4.ODataContextBinding#execute).

References:

Param Type DefaultValue Description
sGroupId string

A valid group ID as specified in sap.ui.model.odata.v4.ODataModel. If it is undefined, the model's updateGroupId is used. Note that the default updateGroupId is '$auto', which is valid here since 1.67.0.

setLegacySyntax

Method not supported

submitBatch

Submits the requests associated with the given group ID in one batch request. Requests from subsequent calls to this method for the same group ID may be combined in one batch request using separate change sets. For group IDs with sap.ui.model.odata.v4.SubmitMode.Auto, only a single change set is used; this method is useful to repeat failed updates or creates (see sap.ui.model.odata.v4.ODataListBinding#create) together with all other requests for the given group ID in one batch request.

Param Type DefaultValue Description
sGroupId string

A valid group ID as specified in sap.ui.model.odata.v4.ODataModel.

toString

Returns a string representation of this object including the service URL.