Class sap.ui.generic.app.transaction.DraftContextModule: sap/ui/generic/app/transaction/DraftContext


The class provides access to information on draft handling that is available in the OData service's metadata as it interprets draft-specific annotations.


Since: 1.30.0.
Constructor Summary
new sap.ui.generic.app.transaction.DraftContext(oModel)Constructor for meta-model access class.
Method Summary
sap.ui.generic.app.transaction.DraftContext.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.generic.app.transaction.DraftContext with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.generic.app.transaction.DraftContext.getMetadata()Returns a metadata object for class sap.ui.generic.app.transaction.DraftContext.
destroy()Frees all resources claimed during the life-time of this instance.
getODataDraftFunctionImportName(oContext, sDraftFunctionImport)Returns the name of the function import to be used.
getSemanticKey(sEntitySet)Returns the semantic keys for a given entity set.
hasDraft(oContext)Checks whether an entity set is draft-enabled.
hasDraftAdministrativeData(sEntitySet)Checks whether administrative data for a given draft is available.
hasDraftPreparationAction(oContext)Checks whether an entity set has a draft preparation action.
hasDraftRoot(oContext)Checks whether an entity set is draft root.
hasDraftValidationFunction(oContext)Checks whether an entity set has a draft validation function.
hasPreserveChanges()Checks if the parameter "PreserveChanges" is supported by the edit function.
hasSiblingEntity(sEntitySet)Checks whether a sibling entity for a given entity set is available.
isDraftEnabled(sEntitySet)Checks whether a given entity set is draft-enabled.
isDraftRoot(sEntitySet)Checks whether a given entity set is a draft root.
isSemanticKey(sEntitySet, oKeys)Checks whether a given key is a semantic key.
isTechnicalKey(sEntitySet, oKeys)Checks whether a given key is a technical key.
checkUpdateOnChange(sEntitySet, sProperty)Checks whether an OData property is annotated with UpdateOnChange.
Constructor Detail
new sap.ui.generic.app.transaction.DraftContext(oModel)
Constructor for meta-model access class.
Parameters:
{sap.ui.model.odata.ODataModel}oModel The OData model currently used
Exceptions:
{Error}
If no model is handed over as input parameter
Method Detail
sap.ui.generic.app.transaction.DraftContext.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.generic.app.transaction.DraftContext 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.DraftContext.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.generic.app.transaction.DraftContext.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
destroy()
Frees all resources claimed during the life-time of this instance.
getODataDraftFunctionImportName(oContext, sDraftFunctionImport): string
Returns the name of the function import to be used.
Parameters:
{sap.ui.model.Context}oContext The given binding context
{string}sDraftFunctionImport The draft function import
Exceptions:
{Error} If no context is handed over as input parameter
Returns:
{string} The name of the function import to be used
getSemanticKey(sEntitySet): array
Returns the semantic keys for a given entity set.
Parameters:
{string}sEntitySet The given entity set
Exceptions:
{Error} If no entity set is handed over as input parameter
Returns:
{array} The semantic keys
hasDraft(oContext): boolean
Checks whether an entity set is draft-enabled. The entity set name is derived from the given binding context
Parameters:
{sap.ui.model.Context}oContext The given binding context
Exceptions:
{Error} If no context is handed over as input parameter
Returns:
{boolean}true, if a given entity set is draft-enabled, false otherwise
hasDraftAdministrativeData(sEntitySet): boolean
Checks whether administrative data for a given draft is available.
Parameters:
{string}sEntitySet The name of the entity set
Returns:
{boolean}true, if administrative data is available, false otherwise
hasDraftPreparationAction(oContext): boolean
Checks whether an entity set has a draft preparation action. The entity set name is derived from the given binding context.
Parameters:
{sap.ui.model.Context}oContext The given binding context
Exceptions:
{Error} If no context is handed over as input parameter
Returns:
{boolean}true, if a given entity set has a draft preparation action, false otherwise
hasDraftRoot(oContext): boolean
Checks whether an entity set is draft root. The entity set name is derived from the given binding context.
Parameters:
{sap.ui.model.Context}oContext The given binding context
Exceptions:
{Error} If no context is handed over as input parameter
Returns:
{boolean}true, if a given entity set is draft root, false otherwise
hasDraftValidationFunction(oContext): boolean
Checks whether an entity set has a draft validation function. The entity set name is derived from the given binding context.
Parameters:
{sap.ui.model.Context}oContext The given binding context
Exceptions:
{Error} If no context is handed over as input parameter
Returns:
{boolean}true, if a given entity set has a draft validation function, false otherwise
hasPreserveChanges(): boolean
Checks if the parameter "PreserveChanges" is supported by the edit function. If the edit action is triggered with the parameter set to true the ABAP application infrastructure will respond with HTTP response code 409 if unsaved changes (from another user) exist.
Since:
1.38
Exceptions:
{Error} If no context is handed over as input parameter
Returns:
{boolean}true, if "PreserveChanges" is supported
hasSiblingEntity(sEntitySet): boolean
Checks whether a sibling entity for a given entity set is available.
Parameters:
{string}sEntitySet The name of the entity set
Returns:
{boolean}true, if sibling entity is available, false otherwise
isDraftEnabled(sEntitySet): boolean
Checks whether a given entity set is draft-enabled.
Parameters:
{string}sEntitySet The name of the entity set
Exceptions:
{Error} If no entity set is handed over as input parameter
Returns:
{boolean}true, if a given entity set is draft-enabled, false otherwise
isDraftRoot(sEntitySet): boolean
Checks whether a given entity set is a draft root.
Parameters:
{string}sEntitySet The name of the entity set
Exceptions:
{Error} If no entity set is handed over as input parameter
Returns:
{boolean}true, if a given entity set is draft root, false otherwise
isSemanticKey(sEntitySet, oKeys): boolean
Checks whether a given key is a semantic key.
Parameters:
{string}sEntitySet The name of the entity set
{oKeys}oKeys The given key
Exceptions:
{Error} If no entity set is handed over as input parameter
Returns:
{boolean}true, if a given key is a semantic key, false otherwise
isTechnicalKey(sEntitySet, oKeys): boolean
Checks whether a given key is a technical key.
Parameters:
{string}sEntitySet The name of the entity set
{oKeys}oKeys The given key
Exceptions:
{Error} If no entity set is handed over as input parameter
Returns:
{boolean}true, if a given key is a technical key, false otherwise
checkUpdateOnChange(sEntitySet, sProperty): boolean
Checks whether an OData property is annotated with UpdateOnChange. The method is used in context of a validation success event.
Parameters:
{string}sEntitySet The name of the entity set
{string}sProperty The name of the property
Deprecated:
Since 1.32.0
Exceptions:
{Error} If no entity set is handed over as input parameter
Returns:
{boolean}true, if the property is annotated with UpdateOnChange, false otherwise