Class sap.ui.generic.app.transaction.TransactionControllerModule: sap/ui/generic/app/transaction/TransactionController
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.
Since: 1.30.0.
Constructor Summary
new sap.ui.generic.app.transaction.TransactionController(oModel, oQueue, mParams)Constructor for a new transaction controller instance.
Method Summary
sap.ui.generic.app.transaction.TransactionController.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.generic.app.transaction.TransactionController with name
sClassName
and enriches it with the information contained in oClassInfo
.sap.ui.generic.app.transaction.TransactionController.getMetadata()Returns a metadata object for class sap.ui.generic.app.transaction.TransactionController.
deleteEntities(aEntities, mParameters)Submits changes to the backend system and deletes a group of entities in the backend system.
deleteEntity(vEntity, mParameters)Submits changes to the backend system and deletes an entity in the backend system.
resetChanges()Resets changes that have been tracked by the current instance of
sap.ui.model.odata.v2.ODatatModel
. Constructor Detail
new sap.ui.generic.app.transaction.TransactionController(oModel, oQueue, mParams)
Constructor for a new transaction controller instance.
Parameters:
{sap.ui.model.odata.ODataModel} | oModel | The OData model currently used |
{sap.ui.generic.app.util.Queue} | oQueue | Optional HTTP request queue |
{map} | mParams | Optional configuration parameters |
{boolean} | mParams.noBatchGroups | Suppresses creation of batch groups |
- Exceptions:
- {Error}
- Throws an error if no model is handed over as input parameter
Method Detail
sap.ui.generic.app.transaction.TransactionController.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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 Object.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.generic.app.transaction.TransactionController.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.generic.app.transaction.TransactionController.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
deleteEntities(aEntities, mParameters): Promise
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.
Experimental API:
Parameters:
{array} | aEntities | Binding contexts or paths (strings) which identify the entities |
{map} | mParameters | Parameters that control the behavior of the request |
- Experimental:
- Since:
- 1.38
Returns:
{Promise} | A Promise that receives an array with the responses of the delete requests |
deleteEntity(vEntity, mParameters): Promise
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.
Parameters:
{sap.ui.model.Context|string} | vEntity | Binding context or path of the entity |
{map} | mParameters | Parameters that control the behavior of the request |
Returns:
{Promise} | A Promise for asynchronous execution |
editEntity(oContext, bPreserveChanges?): Promise
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.
Parameters:
{sap.ui.model.Context} | oContext | The given binding context |
{boolean} | bPreserveChanges? | Set to true to avoid the creation of a new draft when unsaved changes exist in the back-end |
Returns:
{Promise} | A Promise for asynchronous execution |
getDraftController(): sap.ui.generic.app.transaction.DraftController
Returns the current draft controller instance.
Returns:
{sap.ui.generic.app.transaction.DraftController} | The draft controller instance |