Class sap.ui.model.odata.v2.ODataModelModule: sap/ui/model/odata/v2/ODataModel

extends Model

Model implementation for oData format

Constructor Summary
new sap.ui.model.odata.v2.ODataModel(sServiceUrl?, mParameters?)Constructor for a new ODataModel.
Event Summary
annotationsFailed(oControlEvent)The 'annotationsFailed' event is fired, when the annotations document was successfully loaded.
annotationsLoaded(oControlEvent)The 'annotationsLoaded' event is fired, when the annotations document was successfully loaded.
batchRequestCompleted(oControlEvent)The 'batchRequestCompleted' event is fired, after a request has been completed (includes receiving a response), no matter whether the request succeeded or not.
batchRequestFailed(oControlEvent)The 'batchRequestFailed' event is fired, when a batch request failed.
batchRequestSent(oControlEvent)The 'batchRequestSent' event is fired, after a request has been sent to a backend.
metadataFailed(oControlEvent)The 'metadataFailed' event is fired, when the metadata document has failed to load.
metadataLoaded(oControlEvent)The 'metadataLoaded' event is fired, when the metadata document was successfully loaded.
requestCompleted(oControlEvent)The 'requestCompleted' event is fired, after a request has been completed (includes receiving a response), no matter whether the request succeeded or not.
requestFailed(oControlEvent)The 'requestFailed' event is fired, when data retrieval from a backend failed.
requestSent(oControlEvent)The 'requestSent' event is fired, after a request has been sent to a backend.
Events borrowed from class sap.ui.model.Model
Method Summary
sap.ui.model.odata.v2.ODataModel.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.odata.v2.ODataModel with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.model.odata.v2.ODataModel.getMetadata()Returns a metadata object for class sap.ui.model.odata.v2.ODataModel.
addAnnotationUrl(vUrl)Adds (a) new URL(s) to the be parsed for OData annotations, which are then merged into the annotations object which can be retrieved by calling the getServiceAnnotations()-method.
addAnnotationXML(sXMLContent, bSuppressEvents?)Adds new xml content to be parsed for OData annotations, which are then merged into the annotations object which can be retrieved by calling the getServiceAnnotations()-method.
attachAnnotationsFailed(oData?, fnFunction, oListener?)Attach event-handler fnFunction to the 'annotationsFailed' event of this sap.ui.model.odata.v2.ODataModel.
attachAnnotationsLoaded(oData?, fnFunction, oListener?)Attach event-handler fnFunction to the 'annotationsLoaded' event of this sap.ui.model.odata.v2.ODataModel.
attachBatchRequestCompleted(oData?, fnFunction, oListener?)Attach event-handler fnFunction to the 'batchRequestCompleted' event of this sap.ui.model.odata.v2.ODataModel.
attachBatchRequestFailed(oData?, fnFunction, oListener?)Attach event-handler fnFunction to the 'batchRequestFailed' event of this sap.ui.model.odata.v2.ODataModel.
attachBatchRequestSent(oData?, fnFunction, oListener?)Attach event-handler fnFunction to the 'requestSent' event of this sap.ui.model.odata.v2.ODataModel.
attachMetadataFailed(oData?, fnFunction, oListener?)Attach event-handler fnFunction to the 'metadataFailed' event of this sap.ui.model.odata.v2.ODataModel.
attachMetadataLoaded(oData?, fnFunction, oListener?)Attach event-handler fnFunction to the 'metadataLoaded' event of this sap.ui.model.odata.v2.ODataModel.
callFunction(sFunctionName, mParameters?)Trigger a request to the function import odata service that was specified in the model constructor.
create(sPath, oData, mParameters?)Trigger a POST request to the odata service that was specified in the model constructor.
createBindingContext(sPath, oContext?, mParameters?, fnCallBack?, bReload?)Creates a binding context for the given path If the data of the context is not yet available, it can not be created, but first the entity needs to be fetched from the server asynchronously.
createEntry(sPath, mParameters)Creates a new entry object which is described by the metadata of the entity type of the specified sPath Name.
createKey(sCollection, oKeyProperties)Creates the key from the given collection name and property map.
deleteCreatedEntry(oContext)Deletes a created entry from the request queue and the model.
detachAnnotationsFailed(fnFunction, oListener)Detach event-handler fnFunction from the 'annotationsFailed' event of this sap.ui.model.odata.v2.ODataModel.
detachAnnotationsLoaded(fnFunction, oListener)Detach event-handler fnFunction from the 'annotationsLoaded' event of this sap.ui.model.odata.v2.ODataModel.
detachBatchRequestCompleted(fnFunction, oListener)Detach event-handler fnFunction from the 'batchRequestCompleted' event of this sap.ui.model.odata.v2.ODataModel.
detachBatchRequestFailed(fnFunction, oListener)Detach event-handler fnFunction from the 'batchRequestFailed' event of this sap.ui.model.odata.v2.ODataModel.
detachBatchRequestSent(fnFunction, oListener)Detach event-handler fnFunction from the 'batchRequestSent' event of this sap.ui.model.odata.v2.ODataModel.
detachMetadataFailed(fnFunction, oListener)Detach event-handler fnFunction from the 'metadataFailed' event of this sap.ui.model.odata.v2.ODataModel.
detachMetadataLoaded(fnFunction, oListener)Detach event-handler fnFunction from the 'metadataLoaded' event of this sap.ui.model.odata.v2.ODataModel.
fireAnnotationsFailed(mArguments?)Fire event annotationsFailed to attached listeners.
fireAnnotationsLoaded(mArguments?)Fire event annotationsLoaded to attached listeners.
fireBatchRequestCompleted(mArguments)Fire event batchRequestCompleted to attached listeners.
fireBatchRequestFailed(mArguments)Fire event batchRequestFailed to attached listeners.
fireBatchRequestSent(mArguments?)Fire event batchRequestSent to attached listeners.
fireMetadataFailed(mArguments?)Fire event metadataFailed to attached listeners.
fireMetadataLoaded(mArguments?)Fire event metadataLoaded to attached listeners.
forceEntityUpdate(sKey)Force the update on the server of an entity by setting its ETag to '*'.
getChangeGroups()Returns the definition of groups per EntityType for TwoWay changes
getDefaultCountMode()Returns the default count mode for retrieving the count of collections
getDeferredGroups()Returns the array of GroupIds that are set as deferred
getETag(sPath?, oContext?, oEntity?)Returns the ETag for a given binding path/context or data object
getHeaders()Returns all headers and custom headers which are stored in the OData model.
getKey(vValue)Returns the key part from the entry URI or the given context or object
getMetaModel()Returns an instance of an OData meta model which offers a unified access to both OData V2 meta data and V4 annotations.
getOriginalProperty(sPath, oContext?)Returns the original value for the property with the given path and context.
getProperty(sPath, oContext?, bIncludeExpandEntries?)Returns the value for the property with the given sPath.
getSecurityToken()Returns the current security token.
getServiceAnnotations()Return the annotation object.
getServiceMetadata()Return the parsed XML metadata as a Javascript object.
hasPendingChanges()Checks if there exist pending changes in the model created by the setProperty method.
hasPendingRequests()Checks if there are pending requests, either ongoing or sequential
isMetadataLoadingFailed()Checks whether metadata loading has failed in the past.
metadataLoaded()Returns a promise for the loaded state of the metadata.
read(sPath, mParameters?)Trigger a GET request to the odata service that was specified in the model constructor.
refresh(bForceUpdate?, bRemoveData?, sGroupId?)Refresh the model.
refreshMetadata()Refreshes the metadata for model, e.g.
refreshSecurityToken(fnSuccess?, fnError?)refresh XSRF token by performing a GET request against the service root URL.
remove(sPath, mParameters?)Trigger a DELETE request to the odata service that was specified in the model constructor.
resetChanges(aPath?)Resets the collected changes by the setProperty method.
securityTokenAvailable()Returns a promise, which will resolve with the security token as soon as it is available
setChangeGroups(mGroups)Definition of groups per EntityType for "TwoWay" changes
setDefaultCountMode(sCountMode)Sets the default way to retrieve the count of collections in this model.
setDeferredGroups(aGroupIds)Setting request groups as deferred.
setHeaders(mHeaders)Set custom headers which are provided in a key/value map.
setProperty(sPath, oValue, oContext?, bAsyncUpdate?)Sets a new value for the given property sPropertyName in the model.
setRefreshAfterChange(bRefreshAfterChange)Enable/Disable automatic updates of all Bindings after change operations
setTokenHandlingEnabled(bTokenHandling?)Enable/Disable XCSRF-Token handling
setUseBatch(bUseBatch?)
submitChanges(mParameters?)Submits the collected changes which were collected by the setProperty method.
update(sPath, oData, mParameters?)Trigger a PUT/MERGE request to the odata service that was specified in the model constructor.
updateBindings(bForceUpdate?)update all bindings
getChangeBatchGroups()Returns the definition of batchGroups per EntityType for TwoWay changes
getData(sPath, oContext?, bIncludeExpandEntries?)Return requested data as object if the data has already been loaded and stored in the model.
getDeferredBatchGroups()Returns the array of batchGroupIds that are set as deferred
setChangeBatchGroups(mGroups)Definition of batchGroups per EntityType for "TwoWay" changes
setDeferredBatchGroups(aGroupIds)Setting batch groups as deferred.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.v2.ODataModel(sServiceUrl?, mParameters?)
Constructor for a new ODataModel.
Parameters:
{string}sServiceUrl? base uri of the service to request data from; additional URL parameters appended here will be appended to every request can be passed with the mParameters object as well: [mParameters.serviceUrl] A serviceURl is required!
{object}mParameters? (optional) a map which contains the following parameter properties:
{boolean}mParameters.json? if set true request payloads will be JSON, XML for false (default = true),
{string}mParameters.user? user for the service,
{string}mParameters.password? password for service,
{map}mParameters.headers? a map of custom headers like {"myHeader":"myHeaderValue",...},
{boolean}mParameters.tokenHandling? enable/disable XCSRF-Token handling (default = true),
{boolean}mParameters.withCredentials? experimental - true when user credentials are to be included in a cross-origin request. Please note that this works only if all requests are asynchronous.
mParameters.maxDataServiceVersion? (default = '2.0') please use the following string format e.g. '2.0' or '3.0'. OData version supported by the ODataModel: '2.0',
{boolean}mParameters.useBatch? when true all requests will be sent in batch requests (default = true),
{boolean}mParameters.refreshAfterChange? enable/disable automatic refresh after change operations: default = true,
{string|string[]}mParameters.annotationURI? The URL (or an array of URLs) from which the annotation metadata should be loaded,
{boolean}mParameters.loadAnnotationsJoined? Whether or not to fire the metadataLoaded-event only after annotations have been loaded as well,
{map}mParameters.serviceUrlParams? map of URL parameters - these parameters will be attached to all requests,
{map}mParameters.metadataUrlParams? map of URL parameters for metadata requests - only attached to $metadata request.
{string}mParameters.defaultBindingMode? sets the default binding mode for the model. If not set, sap.ui.model.BindingMode.OneWay is used.
{string}mParameters.defaultCountMode? sets the default count mode for the model. If not set, sap.ui.model.odata.CountMode.Request is used.
{string}mParameters.defaultOperationMode? sets the default operation mode for the model. If not set, sap.ui.model.odata.OperationMode.Server is used.
{string}mParameters.defaultUpdateMethod? sets the default update method which is used for all update requests. If not set, sap.ui.model.odata.UpdateMethod.Merge is used.
{map}mParameters.metadataNamespaces? a map of namespaces (name => URI) used for parsing the service metadata.
{boolean}mParameters.skipMetadataAnnotationParsing? Whether to skip the automated loading of annotations from the metadata document. Loading annotations from metadata does not have any effects (except the lost performance by invoking the parser) if there are not annotations inside the metadata document
{boolean}mParameters.disableHeadRequestForToken? Set this flag to true if your service does not support HEAD requests for fetching the service document (and thus the CSRF-token) to avoid sending a HEAD-request before falling back to GET
{boolean}mParameters.sequentializeRequests? Whether to sequentialize all requests, needed in case the service cannot handle parallel requests
{boolean}mParameters.disableSoftStateHeader? Set this flag to true if donĀ“t want to start a new soft state session with context id (SID) through header mechanism. This useful if you want to share a SID between different browser windows.
Event Detail
annotationsFailed(oControlEvent)
The 'annotationsFailed' event is fired, when the annotations document was successfully loaded.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{Error[]}oControlEvent.getParameters.result An array of Errors
annotationsLoaded(oControlEvent)
The 'annotationsLoaded' event is fired, when the annotations document was successfully loaded.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{sap.ui.model.odata.v2.ODataAnnotations~Source[]}oControlEvent.getParameters.result One or several annotation source(s)
batchRequestCompleted(oControlEvent)
The 'batchRequestCompleted' event is fired, after a request has been completed (includes receiving a response), no matter whether the request succeeded or not.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.ID The request ID
{string}oControlEvent.getParameters.url The url which is sent to the backend
{string}oControlEvent.getParameters.method The HTTP method
{map}oControlEvent.getParameters.headers The request headers
{boolean}oControlEvent.getParameters.success Request was successful or not
{boolean}oControlEvent.getParameters.async If the request is synchronous or asynchronous (if available)
{array}oControlEvent.getParameters.requests Array of embedded requests ($batch) Each request object within the array contains the following properties: url, method, headers, response object
{object}oControlEvent.getParameters.response The response object - empty object if no response: The response object contains the following properties: message, success, headers, statusCode, statusText, responseText
batchRequestFailed(oControlEvent)
The 'batchRequestFailed' event is fired, when a batch request failed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.ID The request ID
{string}oControlEvent.getParameters.url The url which is sent to the backend
{string}oControlEvent.getParameters.method The HTTP method
{map}oControlEvent.getParameters.headers The request headers
{boolean}oControlEvent.getParameters.async If the request is synchronous or asynchronous (if available)
{boolean}oControlEvent.getParameters.success Request was successful or not
{object}oControlEvent.getParameters.response The response object - empty object if no response The response object contains the following properties: message, success, headers, statusCode, statusText, responseText
{array}oControlEvent.getParameters.requests Array of embedded requests ($batch) Each request object within the array contains the following properties: url, method, headers, response object
batchRequestSent(oControlEvent)
The 'batchRequestSent' event is fired, after a request has been sent to a backend.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.url The url which is sent to the backend
{string}oControlEvent.getParameters.type? The type of the request (if available)
{boolean}oControlEvent.getParameters.async? If the request is synchronous or asynchronous (if available)
{array}oControlEvent.getParameters.requests Array of embedded requests ($batch) Each request object within the array contains the following properties: url, method, headers
metadataFailed(oControlEvent)
The 'metadataFailed' event is fired, when the metadata document has failed to load.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.metadata The parsed metadata
{string}oControlEvent.getParameters.message A text that describes the failure.
{string}oControlEvent.getParameters.statusCode HTTP status code returned by the request (if available)
{string}oControlEvent.getParameters.statusText The status as a text, details not specified, intended only for diagnosis output
{string}oControlEvent.getParameters.responseText Response that has been received for the request, as a text string
{object}oControlEvent.getParameters.response The response object - empty object if no response
metadataLoaded(oControlEvent)
The 'metadataLoaded' event is fired, when the metadata document was successfully loaded.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.metadata The parsed metadata
requestCompleted(oControlEvent)
The 'requestCompleted' event is fired, after a request has been completed (includes receiving a response), no matter whether the request succeeded or not.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.ID The request ID
{string}oControlEvent.getParameters.url The url which is sent to the backend
{string}oControlEvent.getParameters.method The HTTP method
{map}oControlEvent.getParameters.headers The request headers
{boolean}oControlEvent.getParameters.success Request was successful or not
{boolean}oControlEvent.getParameters.async If the request is synchronous or asynchronous (if available)
{object}oControlEvent.getParameters.response The response object - empty object if no response: The response object contains the following properties: message, success, headers, statusCode, statusText, responseText
requestFailed(oControlEvent)
The 'requestFailed' event is fired, when data retrieval from a backend failed.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.ID The request ID
{string}oControlEvent.getParameters.url The url which is sent to the backend
{string}oControlEvent.getParameters.method The HTTP method
{map}oControlEvent.getParameters.headers The request headers
{boolean}oControlEvent.getParameters.async If the request is synchronous or asynchronous (if available)
{boolean}oControlEvent.getParameters.success Request was successful or not
{object}oControlEvent.getParameters.response The response object - empty object if no response The response object contains the following properties: message, success, headers, statusCode, statusText, responseText
requestSent(oControlEvent)
The 'requestSent' event is fired, after a request has been sent to a backend.

Note: Subclasses might add additional parameters to the event object. Optional parameters can be omitted.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.ID The request ID
{string}oControlEvent.getParameters.url The url which is sent to the backend
{string}oControlEvent.getParameters.method The HTTP method
{map}oControlEvent.getParameters.headers The request headers
{boolean}oControlEvent.getParameters.async If the request is synchronous or asynchronous (if available)
Method Detail
sap.ui.model.odata.v2.ODataModel.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.odata.v2.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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.model.odata.v2.ODataModel.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.odata.v2.ODataModel.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addAnnotationUrl(vUrl): Promise
Adds (a) new URL(s) to the be parsed for OData annotations, which are then merged into the annotations object which can be retrieved by calling the getServiceAnnotations()-method. If a $metadata url is passed the data will also be merged into the metadata object, which can be reached by calling the getServiceMetadata() method.
Parameters:
{string|sting[]}vUrl Either one URL as string or an array or URL strings
Returns:
{Promise} The Promise to load the given URL(s), resolved if all URLs have been loaded, rejected if at least one fails to load. If this promise resolves it returns the following parameters: annotations: The annotation object entitySets: An array of EntitySet objects containing the newly merged EntitySets from a $metadata requests. the structure is the same as in the metadata object reached by the getServiceMetadata() method. For non $metadata requests the array will be empty.
addAnnotationXML(sXMLContent, bSuppressEvents?): Promise
Adds new xml content to be parsed for OData annotations, which are then merged into the annotations object which can be retrieved by calling the getServiceAnnotations()-method.
Parameters:
{string}sXMLContent The string that should be parsed as annotation XML
{boolean}bSuppressEvents? Whether not to fire annotationsLoaded event on the annotationParser
Returns:
{Promise} The Promise to parse the given XML-String, resolved if parsed without errors, rejected if errors occur
attachAnnotationsFailed(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataModel
Attach event-handler fnFunction to the 'annotationsFailed' event of this sap.ui.model.odata.v2.ODataModel.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'.
{object}oListener? Object on which to call the given function. If empty, the global context (window) is used.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
attachAnnotationsLoaded(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataModel
Attach event-handler fnFunction to the 'annotationsLoaded' event of this sap.ui.model.odata.v2.ODataModel.

Experimental API:The API is NOT stable yet. Use at your own risk.

Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'.
{object}oListener? Object on which to call the given function. If empty, the global context (window) is used.
Experimental:
The API is NOT stable yet. Use at your own risk.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
attachBatchRequestCompleted(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataModel
Attach event-handler fnFunction to the 'batchRequestCompleted' event of this sap.ui.model.odata.v2.ODataModel.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'.
{object}oListener? Object on which to call the given function. If empty, the global context (window) is used.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
attachBatchRequestFailed(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataModel
Attach event-handler fnFunction to the 'batchRequestFailed' event of this sap.ui.model.odata.v2.ODataModel.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'.
{object}oListener? Object on which to call the given function. If empty, this Model is used.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
attachBatchRequestSent(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataModel
Attach event-handler fnFunction to the 'requestSent' event of this sap.ui.model.odata.v2.ODataModel.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'.
{object}oListener? Object on which to call the given function. If empty, the global context (window) is used.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
attachMetadataFailed(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataModel
Attach event-handler fnFunction to the 'metadataFailed' event of this sap.ui.model.odata.v2.ODataModel.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'.
{object}oListener? Object on which to call the given function. If empty, the global context (window) is used.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
attachMetadataLoaded(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataModel
Attach event-handler fnFunction to the 'metadataLoaded' event of this sap.ui.model.odata.v2.ODataModel.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'.
{object}oListener? Object on which to call the given function. If empty, the global context (window) is used.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
callFunction(sFunctionName, mParameters?): object
Trigger a request to the function import odata service that was specified in the model constructor.

If the ReturnType of the function import is either an EntityType or a collection of EntityType the changes are reflected in the model, otherwise they are ignored, and the response can be processed in the successHandler.

Parameters:
{string}sFunctionName A string containing the name of the function to call. The name is concatenated to the sServiceUrl which was specified in the model constructor.
{map}mParameters? Optional parameter map containing any of the following properties:
{string}mParameters.method? A string containing the type of method to call this function with
{map}mParameters.urlParameters? A map containing the parameters that will be passed as query strings
{function}mParameters.success? a callback function which is called when the data has been successfully retrieved. The handler can have the following parameters: oData and response.
{function}mParameters.error? a callback function which is called when the request failed. The handler can have the parameter: oError which contains additional error information.
{string}mParameters.batchGroupId? Deprecated - use groupId instead
{string}mParameters.groupId? groupId for this request. Requests belonging to the same groupId will be bundled in one batch request.
{string}mParameters.eTag? If the functionImport changes an entity, the eTag for this entity could be passed with this parameter
{string}mParameters.changeSetId? changeSetId for this request
Returns:
{object} oRequestHandle An object which has an abort function to abort the current request.
create(sPath, oData, mParameters?): object
Trigger a POST request to the odata service that was specified in the model constructor. Please note that deep creates are not supported and may not work.
Parameters:
{string}sPath A string containing the path to the collection where an entry should be created. The path is concatenated to the sServiceUrl which was specified in the model constructor.
{object}oData data of the entry that should be created.
{map}mParameters? Optional parameter map containing any of the following properties:
{object}mParameters.context? If specified the sPath has to be relative to the path given with the context.
{function}mParameters.success? a callback function which is called when the data has been successfully retrieved. The handler can have the following parameters: oData and response.
{function}mParameters.error? a callback function which is called when the request failed. The handler can have the parameter oError which contains additional error information.
{map}mParameters.urlParameters? A map containing the parameters that will be passed as query strings
{map}mParameters.headers? A map of headers for this request
{string}mParameters.batchGroupId? Deprecated - use groupId instead
{string}mParameters.groupId? groupId for this request. Requests belonging to the same groupId will be bundled in one batch request.
{string}mParameters.changeSetId? changeSetId for this request
Returns:
{object} an object which has an abort function to abort the current request.
createBindingContext(sPath, oContext?, mParameters?, fnCallBack?, bReload?)
Creates a binding context for the given path If the data of the context is not yet available, it can not be created, but first the entity needs to be fetched from the server asynchronously. In case no callback function is provided, the request will not be triggered.
Parameters:
{string}sPath binding path
{object}oContext? bindingContext
{map}mParameters? a map which contains additional parameters for the binding
{string}mParameters.expand? Standing for OData $expand query option which should be included in the request
{string}mParameters.select? Standing for OData $select query option parameter which should be included in the request
{map}mParameters.custom? an optional map of custom query parameters. Custom parameters must not start with $.
{function}fnCallBack? function called when context is created
{boolean}bReload? reload of data
See:
sap.ui.model.Model.prototype.createBindingContext
createEntry(sPath, mParameters): sap.ui.model.Context
Creates a new entry object which is described by the metadata of the entity type of the specified sPath Name. A context object is returned which can be used to bind against the newly created object.

For each created entry a request is created and stored in a request queue. The request queue can be submitted by calling submitChanges. To delete a created entry from the request queue call deleteCreateEntry.

The optional properties parameter can be used as follows:

- properties could be an array containing the property names which should be included in the new entry. Other properties defined in the entity type are not included. - properties could be an object which includes the desired properties and the values which should be used for the created entry.

If properties is not specified, all properties in the entity type will be included in the created entry.

If there are no values specified the properties will have undefined values.

Please note that deep creates (including data defined by navigationproperties) are not supported

Parameters:
{String}sPath Name of the path to the EntitySet
{map}mParameters A map of the following parameters:
{array|object}mParameters.properties? An array that specifies a set of properties or the entry
{string}mParameters.batchGroupId? Deprecated - use groupId instead
{string}mParameters.groupId? The groupId. Requests belonging to the same groupId will be bundled in one batch request.
{string}mParameters.changeSetId? The changeSetId
{sap.ui.model.Context}mParameters.context? The binding context
{function}mParameters.success? The success callback function
{function}mParameters.error? The error callback function
{map}mParameters.headers? A map of headers
{map}mParameters.urlParameters? A map of url parameters
Returns:
{sap.ui.model.Context} oContext A Context object that point to the new created entry.
createKey(sCollection, oKeyProperties): string
Creates the key from the given collection name and property map. Please make sure that the metadata document is loaded before using this function.
Parameters:
{string}sCollection The name of the collection
{object}oKeyProperties The object containing at least all the key properties of the entity type
Returns:
{string} [sKey] key of the entry
deleteCreatedEntry(oContext)
Deletes a created entry from the request queue and the model.
Parameters:
{sap.ui.model.Context}oContext The context object pointing to the created entry
destroy()
See:
sap.ui.model.Model.prototype.destroy
detachAnnotationsFailed(fnFunction, oListener): sap.ui.model.odata.v2.ODataModel
Detach event-handler fnFunction from the 'annotationsFailed' event of this sap.ui.model.odata.v2.ODataModel.

The passed function and listener object must match the ones previously used for event registration.

Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener Object on which the given function had to be called.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
detachAnnotationsLoaded(fnFunction, oListener): sap.ui.model.odata.v2.ODataModel
Detach event-handler fnFunction from the 'annotationsLoaded' event of this sap.ui.model.odata.v2.ODataModel.

Experimental API:The API is NOT stable yet. Use at your own risk.

Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener Object on which the given function had to be called.
Experimental:
The API is NOT stable yet. Use at your own risk.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
detachBatchRequestCompleted(fnFunction, oListener): sap.ui.model.odata.v2.ODataModel
Detach event-handler fnFunction from the 'batchRequestCompleted' event of this sap.ui.model.odata.v2.ODataModel.

The passed function and listener object must match the ones previously used for event registration.

Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener Object on which the given function had to be called.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
detachBatchRequestFailed(fnFunction, oListener): sap.ui.model.odata.v2.ODataModel
Detach event-handler fnFunction from the 'batchRequestFailed' event of this sap.ui.model.odata.v2.ODataModel.

The passed function and listener object must match the ones previously used for event registration.

Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener Object on which the given function had to be called.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
detachBatchRequestSent(fnFunction, oListener): sap.ui.model.odata.v2.ODataModel
Detach event-handler fnFunction from the 'batchRequestSent' event of this sap.ui.model.odata.v2.ODataModel.

The passed function and listener object must match the ones previously used for event registration.

Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener Object on which the given function had to be called.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
detachMetadataFailed(fnFunction, oListener): sap.ui.model.odata.v2.ODataModel
Detach event-handler fnFunction from the 'metadataFailed' event of this sap.ui.model.odata.v2.ODataModel.

The passed function and listener object must match the ones previously used for event registration.

Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener Object on which the given function had to be called.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
detachMetadataLoaded(fnFunction, oListener): sap.ui.model.odata.v2.ODataModel
Detach event-handler fnFunction from the 'metadataLoaded' event of this sap.ui.model.odata.v2.ODataModel.

The passed function and listener object must match the ones previously used for event registration.

Parameters:
{function}fnFunction The function to call, when the event occurs.
{object}oListener Object on which the given function had to be called.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
fireAnnotationsFailed(mArguments?): sap.ui.model.odata.v2.ODataModel
Fire event annotationsFailed to attached listeners.
Parameters:
{object}mArguments? the arguments to pass along with the event.
{string}mArguments.message? A text that describes the failure.
{string}mArguments.statusCode? HTTP status code returned by the request (if available)
{string}mArguments.statusText? The status as a text, details not specified, intended only for diagnosis output
{string}mArguments.responseText? Response that has been received for the request ,as a text string
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
fireAnnotationsLoaded(mArguments?): sap.ui.model.odata.v2.ODataModel
Fire event annotationsLoaded to attached listeners.
Parameters:
{object}mArguments? the arguments to pass along with the event.
{sap.ui.model.odata.v2.ODataAnnotations}mArguments.annotations? the annotations object.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
fireBatchRequestCompleted(mArguments): sap.ui.model.odata.v2.ODataModel
Fire event batchRequestCompleted to attached listeners.
Parameters:
{object}mArguments parameters to add to the fired event
{string}mArguments.ID The request ID
{string}mArguments.url The url which is sent to the backend
{string}mArguments.method The HTTP method
{map}mArguments.headers The request headers
{boolean}mArguments.success Request was successful or not
{boolean}mArguments.async If the request is synchronous or asynchronous (if available)
{array}mArguments.requests Array of embedded requests ($batch) - empty array for non batch requests. Each request object within the array contains the following properties: url, method, headers, response object
{object}mArguments.response The response object - empty object if no response: The response object contains the following properties: message, success, headers, statusCode, statusText, responseText
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
fireBatchRequestFailed(mArguments): sap.ui.model.odata.v2.ODataModel
Fire event batchRequestFailed to attached listeners.
Parameters:
{object}mArguments the arguments to pass along with the event.
{string}mArguments.ID The request ID
{string}mArguments.url The url which is sent to the backend
{string}mArguments.method The HTTP method
{map}mArguments.headers The request headers
{boolean}mArguments.async If the request is synchronous or asynchronous (if available)
{boolean}mArguments.success Request was successful or not
{object}mArguments.response The response object - empty object if no response The response object contains the following properties: message, success, headers, statusCode, statusText, responseText
{array}mArguments.requests Array of embedded requests ($batch) Each request object within the array contains the following properties: url, method, headers, response object
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
fireBatchRequestSent(mArguments?): sap.ui.model.odata.v2.ODataModel
Fire event batchRequestSent to attached listeners.
Parameters:
{object}mArguments? the arguments to pass along with the event.
{string}mArguments.url? The url which is sent to the backend.
{string}mArguments.type? The type of the request (if available)
{boolean}mArguments.async? If the request is synchronous or asynchronous (if available)
{array}mArguments.requests Array of embedded requests ($batch) Each request object within the array contains the following properties: url, method, headers
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
fireMetadataFailed(mArguments?): sap.ui.model.odata.v2.ODataModel
Fire event metadataFailed to attached listeners.
Parameters:
{object}mArguments? the arguments to pass along with the event.
{string}mArguments.message? A text that describes the failure.
{string}mArguments.statusCode? HTTP status code returned by the request (if available)
{string}mArguments.statusText? The status as a text, details not specified, intended only for diagnosis output
{string}mArguments.responseText? Response that has been received for the request ,as a text string
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
fireMetadataLoaded(mArguments?): sap.ui.model.odata.v2.ODataModel
Fire event metadataLoaded to attached listeners.
Parameters:
{object}mArguments? the arguments to pass along with the event.
{sap.ui.model.odata.ODataMetadata}mArguments.metadata? the metadata object.
Returns:
{sap.ui.model.odata.v2.ODataModel}this to allow method chaining
forceEntityUpdate(sKey)
Force the update on the server of an entity by setting its ETag to '*'. ETag handling must be active so the force update will work.
Parameters:
{string}sKey The key to an Entity e.g.: Customer(4711)
getChangeGroups(): map
Returns the definition of groups per EntityType for TwoWay changes
Returns:
{map} mChangeGroups Definition of Groups for "TwoWay" changes
getDefaultCountMode(): sap.ui.model.odata.CountMode
Returns the default count mode for retrieving the count of collections
Since:
1.20
Returns:
{sap.ui.model.odata.CountMode} sCountMode returns defaultCountMode
getDeferredGroups(): array
Returns the array of GroupIds that are set as deferred
Returns:
{array} aGroupIds The array of deferred GroupIds
getETag(sPath?, oContext?, oEntity?): string
Returns the ETag for a given binding path/context or data object
Parameters:
{string}sPath? The binding path
{sap.ui.model.Context}oContext? The binding context
{object}oEntity? The entity data
Returns:
{string} The found ETag (or null if none could be found)
getHeaders(): object
Returns all headers and custom headers which are stored in the OData model.
Returns:
{object} the header map
getKey(vValue): string
Returns the key part from the entry URI or the given context or object
Parameters:
{string|object|sap.ui.model.Context}vValue A string representation of an URI, the context or entry object
Returns:
{string} [sKey] key of the entry
Returns an instance of an OData meta model which offers a unified access to both OData V2 meta data and V4 annotations. It uses the existing sap.ui.model.odata.ODataMetadata as a foundation and merges V4 annotations from the existing sap.ui.model.odata.v2.ODataAnnotations directly into the corresponding model element.

BEWARE: Access to this OData meta model will fail before the promise returned by loaded has been resolved!

Returns:
{sap.ui.model.odata.ODataMetaModel} The meta model for this ODataModel
getOriginalProperty(sPath, oContext?): any
Returns the original value for the property with the given path and context. The original value is the value that was last responded by the server.
Parameters:
{string}sPath the path/name of the property
{object}oContext? the context if available to access the property value
Returns:
{any} vValue the value of the property
getProperty(sPath, oContext?, bIncludeExpandEntries?): any
Returns the value for the property with the given sPath. If the path points to a navigation property which has been loaded via $expand then the bIncludeExpandEntries parameter determines if the navigation property should be included in the returned value or not. Please note that this currently works for 1..1 navigation properties only.
Parameters:
{string}sPath the path/name of the property
{object}oContext? the context if available to access the property value
{boolean}bIncludeExpandEntries? This parameter should be set when a URI or custom parameter with a $expand System Query Option was used to retrieve associated entries embedded/inline. If true then the getProperty function returns a desired property value/entry and includes the associated expand entries (if any). If false the associated/expanded entry properties are removed and not included in the desired entry as properties at all. This is useful for performing updates on the base entry only. Note: A copy and not a reference of the entry will be returned.
Returns:
{any} vValue the value of the property
getSecurityToken(): string
Returns the current security token. If the token has not been requested from the server it will be requested first.
Returns:
{string} the CSRF security token
getServiceAnnotations(): Object
Return the annotation object. Please note that the metadata is loaded asynchronously and this function might return undefined because the metadata has not been loaded yet. In this case attach to the annotationsLoaded event to get notified when the annotations are available and then call this function.

Experimental API:This feature has not been tested due to the lack of OData testing infrastructure. The API is NOT stable yet. Use at your own risk.

Experimental:
This feature has not been tested due to the lack of OData testing infrastructure. The API is NOT stable yet. Use at your own risk.
Returns:
{Object} metdata object
getServiceMetadata(): Object
Return the parsed XML metadata as a Javascript object. Please note that the metadata is loaded asynchronously and this function might return undefined because the metadata has not been loaded yet. In this case attach to the metadataLoaded event to get notified when the metadata is available and then call this function.
Returns:
{Object} metdata object
hasPendingChanges(): boolean
Checks if there exist pending changes in the model created by the setProperty method.
Returns:
{boolean} true/false
hasPendingRequests(): boolean
Checks if there are pending requests, either ongoing or sequential
Returns:
{boolean} true/false
isMetadataLoadingFailed(): boolean
Checks whether metadata loading has failed in the past.
Since:
1.38
Returns:
{boolean} returns whether metadata request has failed
metadataLoaded(): Promise
Returns a promise for the loaded state of the metadata. The promise won't get rejected in case the metadata loading failed but is only resolved if the metadata is loaded successfully. If refreshMetadata function is called after this promise is already resolved you should rely on the promise returned by refreshMetadata to get information about the refreshed metadata loaded state.
Since:
1.30
Returns:
{Promise} returns a promise on metadata loaded state
read(sPath, mParameters?): object
Trigger a GET request to the odata service that was specified in the model constructor. The data will be stored in the model. The requested data is returned with the response.
Parameters:
{string}sPath A string containing the path to the data which should be retrieved. The path is concatenated to the sServiceUrl which was specified in the model constructor.
{map}mParameters? Optional parameter map containing any of the following properties:
{object}mParameters.context? If specified the sPath has to be is relative to the path given with the context.
{map}mParameters.urlParameters? A map containing the parameters that will be passed as query strings
{array}mParameters.filters? an array of sap.ui.model.Filter to be included in the request URL
{array}mParameters.sorters? an array of sap.ui.model.Sorter to be included in the request URL
{function}mParameters.success? a callback function which is called when the data has been successfully retrieved. The handler can have the following parameters: oData and response.
{function}mParameters.error? a callback function which is called when the request failed. The handler can have the parameter: oError which contains additional error information.
{string}mParameters.batchGroupId? Deprecated - use groupId instead
{string}mParameters.groupId? groupId for this request. Requests belonging to the same groupId will be bundled in one batch request.
Returns:
{object} an object which has an abort function to abort the current request.
refresh(bForceUpdate?, bRemoveData?, sGroupId?)
Refresh the model. This will check all bindings for updated data and update the controls if data has been changed.
Parameters:
{boolean}bForceUpdate? Force update of controls
{boolean}bRemoveData? If set to true then the model data will be removed/cleared. Please note that the data might not be there when calling e.g. getProperty too early before the refresh call returned.
{string}sGroupId? The groupId. Requests belonging to the same groupId will be bundled in one batch request.
refreshMetadata(): Promise
Refreshes the metadata for model, e.g. in case the request for metadata has failed. Returns a new promise which can be resolved or rejected depending on the metadata loading state.
Returns:
{Promise} returns a promise on metadata loaded state or null if metadata is not initialized or currently refreshed.
refreshSecurityToken(fnSuccess?, fnError?): object
refresh XSRF token by performing a GET request against the service root URL.
Parameters:
{function}fnSuccess? a callback function which is called when the data has been successfully retrieved.
{function}fnError? a callback function which is called when the request failed. The handler can have the parameter: oError which contains additional error information.
Returns:
{object} an object which has an abort function to abort the current request.
remove(sPath, mParameters?): object
Trigger a DELETE request to the odata service that was specified in the model constructor.
Parameters:
{string}sPath A string containing the path to the data that should be removed. The path is concatenated to the sServiceUrl which was specified in the model constructor.
{object}mParameters? Optional, can contain the following attributes:
{object}mParameters.context? If specified the sPath has to be relative to the path given with the context.
{function}mParameters.success? a callback function which is called when the data has been successfully retrieved. The handler can have the following parameters: oData and response.
{function}mParameters.error? a callback function which is called when the request failed. The handler can have the parameter: oError which contains additional error information.
{string}mParameters.eTag? If specified, the If-Match-Header will be set to this Etag.
{map}mParameters.urlParameters? A map containing the parameters that will be passed as query strings
{string}mParameters.batchGroupId? Deprecated - use groupId instead
{string}mParameters.groupId? groupId for this request. Requests belonging to the same groupId will be bundled in one batch request.
{string}mParameters.changeSetId? changeSetId for this request
Returns:
{object} an object which has an abort function to abort the current request.
resetChanges(aPath?)

Resets the collected changes by the setProperty method.

Parameters:
{array}aPath? Array of paths that should be resetted. If no array is passed all changes will be resetted.
securityTokenAvailable(): Promise
Returns a promise, which will resolve with the security token as soon as it is available
Returns:
{Promise} the CSRF security token
setChangeGroups(mGroups)
Definition of groups per EntityType for "TwoWay" changes
Parameters:
{map}mGroups A map containing the definition of bacthGroups for TwoWay changes. The Map has the following format: { "EntityTypeName": { groupId: "ID", [changeSetId: "ID",] [single: true/false,] } } GroupId: Defines the Group for changes of the defined EntityTypeName changeSetId: Defines a changeSetId wich bundles the changes for the EntityType. single: Defines if every change will get an own changeSet (true)
setDefaultCountMode(sCountMode)
Sets the default way to retrieve the count of collections in this model. Count can be determined either by sending a separate $count request, including $inlinecount=allpages in data requests, both of them or not at all.
Parameters:
{sap.ui.model.odata.CountMode}sCountMode sets default count mode
Since:
1.20
setDeferredGroups(aGroupIds)
Setting request groups as deferred. Requests that belongs to a deferred group will be sent manually via a submitChanges call.
Parameters:
{array}aGroupIds Array of GroupIds that should be set as deferred
setHeaders(mHeaders)
Set custom headers which are provided in a key/value map. These headers are used for requests against the OData backend. Private headers which are set in the ODataModel cannot be modified. These private headers are: accept, accept-language, x-csrf-token, MaxDataServiceVersion, DataServiceVersion.

To remove these headers simply set the mCustomHeaders parameter to null. Please also note that when calling this method again all previous custom headers are removed unless they are specified again in the mCustomHeaders parameter.

Parameters:
{object}mHeaders the header name/value map.
setProperty(sPath, oValue, oContext?, bAsyncUpdate?): boolean
Sets a new value for the given property sPropertyName in the model.

If the changeBatchGroup for the changed EntityType is set to deferred changes could be submitted with submitChanges. Otherwise the change will be submitted directly.

Parameters:
{string}sPath path of the property to set
{any}oValue value to set the property to
{object}oContext? the context which will be used to set the property
{boolean}bAsyncUpdate? whether to update other bindings dependent on this property asynchronously
Returns:
{boolean} true if the value was set correctly and false if errors occurred like the entry was not found or another entry was already updated.
setRefreshAfterChange(bRefreshAfterChange)
Enable/Disable automatic updates of all Bindings after change operations
Parameters:
{boolean}bRefreshAfterChange Refresh after change
Since:
1.16.3
setTokenHandlingEnabled(bTokenHandling?)
Enable/Disable XCSRF-Token handling
Parameters:
{boolean}bTokenHandling?, Default: true whether to use token handling or not
setUseBatch(bUseBatch?)
Parameters:
{boolean}bUseBatch? whether the requests should be encapsulated in a batch request
submitChanges(mParameters?): object
Submits the collected changes which were collected by the setProperty method. The update method is defined by the global defaultUpdateMethod parameter which is sap.ui.model.odata.UpdateMethod.Merge by default. In case of a sap.ui.model.odata.UpdateMethod.Merge request only the changed properties will be updated. If a URI with a $expand System Query Option was used then the expand entries will be removed from the collected changes. Changes to this entries should be done on the entry itself. So no deep updates are supported.

Important: The success/error handler will only be called if batch support is enabled. If multiple batchGroups are submitted the handlers will be called for every batchGroup.

Parameters:
{object}mParameters? a map which contains the following parameter properties:
{string}mParameters.batchGroupId? Deprecated - use groupId instead
{string}mParameters.groupId? defines the group that should be submitted. If not specified all deferred groups will be submitted. Requests belonging to the same groupId will be bundled in one batch request.
{function}mParameters.success? a callback function which is called when the data has been successfully updated. The handler can have the following parameters: oData. oData contains the parsed response data as a Javascript object. The batch response is in the __batchResponses property which may contain further __changeResponses in an array depending on the amount of changes and changesets of the actual batch request which was sent to the backend. The changeResponses contain the actual response of that changeset in the response property. For each changeset there is also a __changeResponse property.
{function}mParameters.error? a callback function which is called when the request failed. The handler can have the parameter: oError which contains additional error information
{string}mParameters.eTag? an ETag which can be used for concurrency control. If it is specified, it will be used in an If-Match-Header in the request to the server for this entry
Returns:
{object} an object which has an abort function to abort the current request or requests
update(sPath, oData, mParameters?): object
Trigger a PUT/MERGE request to the odata service that was specified in the model constructor. The update method used is defined by the global defaultUpdateMethod parameter which is sap.ui.model.odata.UpdateMethod.Merge by default. Please note that deep updates are not supported and may not work. These should be done seperate on the entry directly.
Parameters:
{string}sPath A string containing the path to the data that should be updated. The path is concatenated to the sServiceUrl which was specified in the model constructor.
{object}oData data of the entry that should be updated.
{map}mParameters? Optional, can contain the following attributes:
{object}mParameters.context? If specified the sPath has to be is relative to the path given with the context.
{function}mParameters.success? a callback function which is called when the data has been successfully updated.
{function}mParameters.error? a callback function which is called when the request failed. The handler can have the parameter oError which contains additional error information.
{string}mParameters.eTag? If specified, the If-Match-Header will be set to this Etag. Please be advised that this feature is officially unsupported as using asynchronous requests can lead to data inconsistencies if the application does not make sure that the request was completed before continuing to work with the data.
{map}mParameters.urlParameters? A map containing the parameters that will be passed as query strings
{map}mParameters.headers? A map of headers for this request
{string}mParameters.batchGroupId? Deprecated - use groupId instead
{string}mParameters.groupId? groupId for this request. Requests belonging to the same groupId will be bundled in one batch request.
{string}mParameters.changeSetId? changeSetId for this request
Returns:
{object} an object which has an abort function to abort the current request.
updateBindings(bForceUpdate?)
update all bindings
Parameters:
{boolean}bForceUpdate? If set to false an update will only be done when the value of a binding changed.
getChangeBatchGroups(): map
Returns the definition of batchGroups per EntityType for TwoWay changes
Deprecated:
Since 1.36 use getChangeGroups instead
Returns:
{map} mChangeBatchGroups Definition of bactchGRoups for "TwoWay" changes
getData(sPath, oContext?, bIncludeExpandEntries?): object
Return requested data as object if the data has already been loaded and stored in the model.
Parameters:
{string}sPath A string containing the path to the data object that should be returned.
{object}oContext? the optional context which is used with the sPath to retrieve the requested data.
{boolean}bIncludeExpandEntries? This parameter should be set when a URI or custom parameter with a $expand System Query Option was used to retrieve associated entries embedded/inline. If true then the getProperty function returns a desired property value/entry and includes the associated expand entries (if any). If false the associated/expanded entry properties are removed and not included in the desired entry as properties at all. This is useful for performing updates on the base entry only. Note: A copy and not a reference of the entry will be returned.
Deprecated:
please use getProperty instead
Returns:
{object} oData Object containing the requested data if the path is valid.
getDeferredBatchGroups(): array
Returns the array of batchGroupIds that are set as deferred
Deprecated:
Since 1.32 use getDeferredGroups instead
Returns:
{array} aGroupIds The array of deferred batchGroupIds
setChangeBatchGroups(mGroups)
Definition of batchGroups per EntityType for "TwoWay" changes
Parameters:
{map}mGroups A map containing the definition of bacthGroups for TwoWay changes. The Map has the following format: { "EntityTypeName": { batchGroupId: "ID", [changeSetId: "ID",] [single: true/false,] } } bacthGroupId: Defines the bacthGroup for changes of the defined EntityTypeName changeSetId: Defines a changeSetId wich bundles the changes for the EntityType. single: Defines if every change will get an own changeSet (true)
Deprecated:
Since 1.32 use setChangesGroups instead
setDeferredBatchGroups(aGroupIds)
Setting batch groups as deferred. Requests that belongs to a deferred batch group will be sent manually via a submitChanges call.
Parameters:
{array}aGroupIds Array of batchGroupIds that should be set as deferred
Deprecated:
Since 1.32 use setDeferredGroups instead