Skip to main content

Pentaho+ documentation is moving!

The new product documentation portal is here. Check it out now at docs.hitachivantara.com

 

Hitachi Vantara Lumada and Pentaho Documentation

Transaction

pentaho.type.action Transaction

A Transaction object stores information about changes performed to instances.

When a transaction is the ambient transaction, it stores the changes performed to any instances. All of the changes performed are temporary and no change events are emitted, until the transaction is committed.

The ambient transaction is accessible through Transaction.current.

All of the changes are immediately visible, through any read operations of the modified instances, while the transaction is the ambient transaction.

If a transaction ceases to be the ambient transaction, then all of the changes that it captured suddenly become inaccessible.

If a transaction is later committed, and is successful, every change becomes permanent. Otherwise, if the transaction is simply disposed of, all the changes it captured are lost.

Managing the ambient transaction is best handled implicitly, by delegating to a TransactionScope object.

AMD Module

require(["pentaho/type/action/Transaction"], function(Transaction) { /* code goes here */ });

Extends

Implements

Constructor

Name Description
new Transaction()

Creates a Transaction.

Members

Name Description
current : pentaho.type.action.Transaction
Static

Gets the ambient transaction, if any, or null.

action
isCurrent : boolean

Gets a value that indicates if this transaction is the current transaction.

isReadOnly : boolean

Gets a value that indicates if the transaction is in a read-only state.

isSync
target : pentaho.type.mixins.Container

Gets the target of the action execution.

version : number

Gets the current transaction version.

Methods

Name Description
enter() : pentaho.type.action.TransactionScope
Static

Enters a scope of change.

enterCommitted() : pentaho.type.action.CommittedScope
Static

Enters a read-committed scope.

getChangesetsPending(container) : Array.<pentaho.type.action.Changeset>
Static

Gets any changesets still being delivered through notifications in the commit phase of transactions.

_lockAction()
_onPhaseDo()
_onPhaseFinally()
_onPhaseInit()
_onPhaseWill()
_validate()
ensureChangeset(target) : pentaho.type.action.Changeset

Called to obtain a changeset for a given container in this transaction.

enter() : pentaho.type.action.TransactionScope

Enters the transaction and returns a new transaction scope to control the transaction.

getAmbientReferences(container) : pentaho.type.ReferenceList

Gets the ambient references of a given container, if any.

getChangeset(uid) : pentaho.type.action.Changeset

Gets the changeset of an instance, given its unique identifier.

Constructor Details

new Transaction()

Creates a Transaction.

Source: javascript/web/pentaho/type/action/Transaction.js, line 87

Members Details

current: pentaho.type.action.Transaction
Static

Gets the ambient transaction, if any, or null.

Source: javascript/web/pentaho/type/action/Transaction.js, line 835

action:

Source: javascript/web/pentaho/type/action/Transaction.js, line 211

isCurrent: boolean

Gets a value that indicates if this transaction is the current transaction.

Source: javascript/web/pentaho/type/action/Transaction.js, line 379

isReadOnly: boolean

Gets a value that indicates if the transaction is in a read-only state.

A transaction becomes read-only when it is previewed, committed or rejected.

Source: javascript/web/pentaho/type/action/Transaction.js, line 204

isSync:

Source: javascript/web/pentaho/type/action/Transaction.js, line 221

target: pentaho.type.mixins.Container

Gets the target of the action execution.

Source: javascript/web/pentaho/type/action/Transaction.js, line 232

version: number

Gets the current transaction version.

Beware, this version number is not the same as that of pentaho.type.mixins.Container#$version.

Initially, a transaction has version 0. This number is then incremented per each individual made change. Each change indicates the version it caused the transaction to assume: pentaho.type.action.Change#transactionVersion.

Source: javascript/web/pentaho/type/action/Transaction.js, line 191

Methods Details

enter() : pentaho.type.action.TransactionScope
Static

Enters a scope of change.

To mark the changes in the scope as error, call its reject method.

To end the scope of change successfully, dispose the returned transaction scope, by calling its dispose method.

If the scope initiated a transaction, then that transaction is committed. Otherwise, if an ambient transaction already existed when the change scope was created, that transaction is left uncommitted.

To end the scope with an error, call its reject method.

Source: javascript/web/pentaho/type/action/Transaction.js, line 860

Returns:
Name Description
pentaho.type.action.TransactionScope

The new transaction scope.

enterCommitted() : pentaho.type.action.CommittedScope
Static

Enters a read-committed scope.

Within this scope there is no current transaction and reading the properties of instances obtains their committed values.

Source: javascript/web/pentaho/type/action/Transaction.js, line 873

Returns:
Name Description
pentaho.type.action.CommittedScope

The read-committed scope.

getChangesetsPending(container) : Array.<pentaho.type.action.Changeset>
Static

Gets any changesets still being delivered through notifications in the commit phase of transactions.

If a transaction is started and committed from within the change:finally listener of another, then multiple changesets may be returned.

Source: javascript/web/pentaho/type/action/Transaction.js, line 889

Parameters:
Name Default Value Summary
container : pentaho.type.mixins.Container

The container.

Returns:
Name Description
Array.<pentaho.type.action.Changeset>

An array of changesets, if any changeset exists; null otherwise.

_lockAction()

Source: javascript/web/pentaho/type/action/Transaction.js, line 747

_onPhaseDo()

Source: javascript/web/pentaho/type/action/Transaction.js, line 778

_onPhaseFinally()

Source: javascript/web/pentaho/type/action/Transaction.js, line 795

_onPhaseInit()

Source: javascript/web/pentaho/type/action/Transaction.js, line 519

_onPhaseWill()

Source: javascript/web/pentaho/type/action/Transaction.js, line 757

_validate()

Source: javascript/web/pentaho/type/action/Transaction.js, line 727

ensureChangeset(target) : pentaho.type.action.Changeset

Called to obtain a changeset for a given container in this transaction.

Source: javascript/web/pentaho/type/action/Transaction.js, line 309

Parameters:
Name Default Value Summary
target : pentaho.type.mixins.Container

The changeset target container.

Returns:
Name Description
pentaho.type.action.Changeset

The existing or created changeset.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the transaction has already been previewed, committed or rejected, and thus can no longer be changed.

See also: pentaho.type.action.Changeset#__onChildChangesetCreated

enter() : pentaho.type.action.TransactionScope

Enters the transaction and returns a new transaction scope to control the transaction.

Source: javascript/web/pentaho/type/action/Transaction.js, line 393

Returns:
Name Description
pentaho.type.action.TransactionScope

The new transaction scope.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the transaction is resolved.

pentaho.type.action.TransactionRejectedError

When entering the root scope of the transaction and the transaction is automatically rejected due to a concurrency error.

getAmbientReferences(container) : pentaho.type.ReferenceList

Gets the ambient references of a given container, if any.

Source: javascript/web/pentaho/type/action/Transaction.js, line 292

Parameters:
Name Default Value Summary
container : pentaho.type.mixins.Container

The container.

Returns:
Name Description
pentaho.type.ReferenceList

The reference list, or null.

getChangeset(uid) : pentaho.type.action.Changeset

Gets the changeset of an instance, given its unique identifier.

If no changeset has been added for the specified instance, null is returned.

Source: javascript/web/pentaho/type/action/Transaction.js, line 247

Parameters:
Name Default Value Summary
uid : string

The unique identifier of the instance.

Returns:
Name Description
pentaho.type.action.Changeset

The changeset, or null.