class sap.ui.generic.app.transaction.DraftController

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

Gives access to runtime draft handling for applications. 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 implements the transactional interaction patterns specified for OData services that support draft documents and provides methods for draft-specific actions, for example validate, prepare, activate.

Additionally, it handles transactional request processing, ensures concurrency control and correct ETag handling. It provides access to the simple interaction patterns of runtime handling for drafts according to the draft specification. These can be combined as required by client applications. Additionally, error handling is 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 draft controller instance.

new sap.ui.generic.app.transaction.DraftController(oModel, oQueue)
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


Methods Overview

Method Description
activateDraftEntity

Submits changes to the back-end and activates a draft entity in the back-end.

createEditDraftEntity

Creates an edit draft in the back-end. Additionally, possible changes that have been collected on the client are sent to the back-end.

createNewDraftEntity

Creates a new edit draft on the client and sends it to the back-end. Additionally, possible changes that have been collected on the client are sent to the back-end.

destroy

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

sap.ui.generic.app.transaction.DraftController.extend

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

getDraftContext

Returns the current draft context instance. If no instance exists, it is created lazily.

getDraftForActiveEntity

Retrieves a possibly existing draft entity for the given active entity using the binding context of the active entity from the back-end.

sap.ui.generic.app.transaction.DraftController.getMetadata

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

hasActiveEntity

Checks whether an entity has an active entity associated.

isActiveEntity

Checks whether an entity set is active. The entity set name is derived from the given binding context

prepareDraftEntity

Submits changes to the back-end and prepares an existing draft entity in the back-end for later activation by invoking the preparation action.

saveAndPrepareDraftEntity

Submits changes to the back-end and prepares a draft entity in the back-end for later activation by invoking the preparation action.

validateDraftEntity

Submits changes to the back-end and prepares an existing draft entity in the back-end for later activation by invoking the validation action.

activateDraftEntity

Submits changes to the back-end and activates a draft entity in the back-end.

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

The given binding context

bIsLenient boolean

Set to true to activate the draft even if warnings exist

sExpand string

Comma separated navigation properties which needs to be expanded with the root context of the active instance

createEditDraftEntity

Creates an edit draft in the back-end. Additionally, possible changes that have been collected on the client are sent to the back-end.

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

createNewDraftEntity

Creates a new edit draft on the client and sends it to the back-end. Additionally, possible changes that have been collected on the client are sent to the back-end.

Param Type DefaultValue Description
sEntitySet string

The name of the entity set

sPath string

Path identifying the new entity instance

vPredefinedValues array object

An array that specifies a set of properties or the entry

bCanonicalRequest boolean

information whether the canonicalRequest parameter should be set for the create request

oParameters object

parameters to be passed to the function

sRootExpand boolean

indicates whether root needs to expanded

oController object

controller object required to create ActionUtil instance

oApplicationController object

applicationController object required to create ActionUtil instance

bUseNewActionForCreate boolean

manifest entry indicating whether newAction has to be used for draft reation

fnSetBusy function

callback to set the busy indicator

destroy

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

sap.ui.generic.app.transaction.DraftController.extend

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

getDraftContext

Returns the current draft context instance. If no instance exists, it is created lazily.

getDraftForActiveEntity

Retrieves a possibly existing draft entity for the given active entity using the binding context of the active entity from the back-end.

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

The binding context of the active entity

sap.ui.generic.app.transaction.DraftController.getMetadata

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

hasActiveEntity

Checks whether an entity has an active entity associated.

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

The given binding context

isActiveEntity

Checks whether an entity set is active. The entity set name is derived from the given binding context

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

The given binding context

prepareDraftEntity

Submits changes to the back-end and prepares an existing draft entity in the back-end for later activation by invoking the preparation action.

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

The given binding context

saveAndPrepareDraftEntity

Submits changes to the back-end and prepares a draft entity in the back-end for later activation by invoking the preparation action.

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

The given binding context

mParameters Object<string,any>

Parameters to control the behavior of the request

validateDraftEntity

Submits changes to the back-end and prepares an existing draft entity in the back-end for later activation by invoking the validation action.

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

The given binding context