Skip to main content
Hitachi Vantara Lumada and Pentaho Documentation

Transaction

pentaho.type.changes. 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 this.context.transaction.

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/Transaction"], function(Transaction) { /* code goes here */ });

Implements

Constructor

Name Description
new Transaction(context)

Creates a Transaction for a given context.

Members

Name Description
context :  pentaho.type.Context

Gets the associated context.

isCurrent :  boolean

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

isProposed :  boolean

Gets a value that indicates if the transaction is in a proposed state, that is, it has not been committed or rejected.

isReadOnly :  boolean

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

result :  pentaho.lang.ActionResult

Gets an action result of the final state of the transaction; or null, if the transaction is still in a proposed state.

version :  number

Gets the current transaction version.

Methods

Name Description
ensureChangeset(owner) : pentaho.type.changes.Changeset

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

enter() : pentaho.type.changes.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.changes.Changeset

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

Constructor Details

new Transaction(context)

Creates a Transaction for a given context.

Source: javascript/web/pentaho/type/changes/Transaction.js, line 67

Parameters:
Name Default Value Summary
context : pentaho.type.Context

The context of the transaction.

Members Details

context:  pentaho.type.Context

Gets the associated context.

Source: javascript/web/pentaho/type/changes/Transaction.js, line 70

isCurrent:  boolean

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

Source: javascript/web/pentaho/type/changes/Transaction.js, line 360

isProposed:  boolean

Gets a value that indicates if the transaction is in a proposed state, that is, it has not been committed or rejected.

Source: javascript/web/pentaho/type/changes/Transaction.js, line 188

See also: pentaho.type.changes.Transaction#result

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/changes/Transaction.js, line 200

result:  pentaho.lang.ActionResult

Gets an action result of the final state of the transaction; or null, if the transaction is still in a proposed state.

Source: javascript/web/pentaho/type/changes/Transaction.js, line 213

See also: pentaho.type.changes.Transaction#isProposed

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.changes.Change#transactionVersion.

Source: javascript/web/pentaho/type/changes/Transaction.js, line 174

Methods Details

ensureChangeset(owner) : pentaho.type.changes.Changeset

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

Source: javascript/web/pentaho/type/changes/Transaction.js, line 290

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

The changeset owner container.

Returns:
Name Description
pentaho.type.changes.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.changes.Changeset#__onChildChangesetCreated

enter() : pentaho.type.changes.TransactionScope

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

Source: javascript/web/pentaho/type/changes/Transaction.js, line 374

Returns:
Name Description
pentaho.type.changes.TransactionScope

The new transaction scope.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the transaction is resolved.

pentaho.type.changes.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/changes/Transaction.js, line 273

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.changes.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/changes/Transaction.js, line 228

Parameters:
Name Default Value Summary
uid : string

The unique identifier of the instance.

Returns:
Name Description
pentaho.type.changes.Changeset

The changeset, or null.