class sap.ui.generic.app.transaction.TransactionController

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/generic/app/transaction/TransactionController
Application Component: CA-UI5-ST

Assuming state-less communication, each single data modification request (or change set in an OData $batch request) is a "mini-transaction", which saves data to the database. The class allows you to submit changes, invoke actions, OData CRUD operations in general, and trigger client-side validations. It ensures concurrency control and correct ETag handling.

The class gives access to runtime draft handling for applications. Additionally error handling capabilities are provided to notify client implementations of error situations. The event fatalError is thrown, if fatal errors occur during execution of OData requests.


Constructor

Constructor for a new transaction controller instance.

new sap.ui.generic.app.transaction.TransactionController(oModel, oQueue, mParams)
Param Type Default Value Description
oModel sap.ui.model.odata.ODataModel

The OData model currently used

oQueue sap.ui.generic.app.util.Queue

Optional HTTP request queue

mParams Object<string,any>

Optional configuration parameters

noBatchGroups boolean

Suppresses creation of batch groups


Methods Overview

Method Description
deleteEntities

Submits changes to the backend system and deletes a group of entities in the backend system. These entities can be both draft or active entities.

deleteEntity

Submits changes to the backend system and deletes an entity in the backend system. This entity can be either a draft or an active entity.

destroy

Frees all resources claimed during the life-time of this instance.

editEntity

Prepares an entity for editing. If the entity is active and draft enabled, a new draft document is created. If not, the control is automatically returned to the caller of the method by returning a resolved promise.

sap.ui.generic.app.transaction.TransactionController.extend

Creates a new subclass of class sap.ui.generic.app.transaction.TransactionController 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.generic.app.transaction.BaseController.extend.

getDraftController

Returns the current draft controller instance.

sap.ui.generic.app.transaction.TransactionController.getMetadata

Returns a metadata object for class sap.ui.generic.app.transaction.TransactionController.

resetChanges

Resets changes that have been tracked by the current instance of sap.ui.model.odata.v2.ODatatModel. These changes have been created by invoking the setProperty method of sap.ui.model.odata.v2.ODatatModel.

deleteEntities

Submits changes to the backend system and deletes a group of entities in the backend system. These entities can be both draft or active entities.

Param Type DefaultValue Description
aEntities array

Binding contexts or paths (strings) which identify the entities

mParameters Object<string,any>

Parameters that control the behavior of the request

deleteEntity

Submits changes to the backend system and deletes an entity in the backend system. This entity can be either a draft or an active entity.

Param Type DefaultValue Description
vEntity sap.ui.model.Context string

Binding context or path of the entity

mParameters Object<string,any>

Parameters that control the behavior of the request

destroy

Frees all resources claimed during the life-time of this instance.

editEntity

Prepares an entity for editing. If the entity is active and draft enabled, a new draft document is created. If not, the control is automatically returned to the caller of the method by returning a resolved promise.

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

The given binding context

bPreserveChanges boolean

Set to true to avoid the creation of a new draft when unsaved changes exist in the back-end

sRootExpand string

indicates whether root needs to expanded

sap.ui.generic.app.transaction.TransactionController.extend

Creates a new subclass of class sap.ui.generic.app.transaction.TransactionController 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.generic.app.transaction.BaseController.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

getDraftController

Returns the current draft controller instance.

sap.ui.generic.app.transaction.TransactionController.getMetadata

Returns a metadata object for class sap.ui.generic.app.transaction.TransactionController.

resetChanges

Resets changes that have been tracked by the current instance of sap.ui.model.odata.v2.ODatatModel. These changes have been created by invoking the setProperty method of sap.ui.model.odata.v2.ODatatModel.