Skip to main content
Hitachi Vantara Lumada and Pentaho Documentation

GenericActionExecution

pentaho.type.action.impl.Target. GenericActionExecution

The GenericActionExecution class is an inner class of Target that assumes that that the execution target is a Target.

It provides a generic implementation of Execution which delegates to the event observers of each of the execution phases, by calling the correspondingly named methods of target: Target#_emitActionPhaseInitEvent, Target#_emitActionPhaseWillEvent Target#_emitActionPhaseDoEvent and Target#_emitActionPhaseFinallyEvent.

Extends

Constructor

Name Description
new GenericActionExecution()
Static

Members

Name Description
action :  pentaho.type.action.Base

Gets the action of the action execution.

base :  function
Protected

If a method has been overridden, then the base method provides access to the overridden method.

error :  Error | pentaho.lang.UserError

Gets the reason for a rejected action execution, or null.

isCanceled :  boolean

Gets a value that indicates if the action execution has been canceled.

isDone :  boolean

Gets a value that indicates if the action execution completed successfully.

isExecuting :  boolean

Gets a value that indicates if the action execution is executing.

isFailed :  boolean

Gets a value that indicates if the action execution has failed.

isFinished :  boolean

Gets a value that indicates if the action execution has finished.

isRejected :  boolean

Gets a value that indicates if the action execution has been rejected.

isSettled :  boolean

Gets a value that indicates if the action execution has been settled.

isUnstarted :  boolean

Gets a value that indicates if the action execution is in the unstarted state.

promise :  Promise

Gets a promise for the result (or error) of this action execution.

result :  any

Gets the result of a successful action execution, if any.

state :  pentaho.type.action.States

Gets the current action execution state.

target :  pentaho.type.action.ITarget

Gets the target of the action execution.

Methods

Name Description
_doDefault() : Promise
Protected

Performs the default "execution" for the associated action.

_onPhaseDo() : Promise
Protected

Called during the action's do phase.

_onPhaseFinally()
Protected

Called during the action's finally phase.

_onPhaseInit()
Protected

Called during the action execution's initialize phase.

_onPhaseWill()
Protected

Called during the action execution's will phase.

done(result) : pentaho.type.action.Execution

Called from an action observer to settle the action execution as being done, optionally giving a result value.

execute() : pentaho.type.action.Execution

Executes the action.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

reject(reason) : pentaho.type.action.Execution

Called to settle the action execution as rejected.

Constructor Details

new GenericActionExecution()
Static

Source: javascript/web/pentaho/type/action/impl/target.js, line 46

Members Details

action:  pentaho.type.action.Base

Gets the action of the action execution.

This property returns a clone of the action argument passed to the constructor.

Once the action execution enters the will phase, this object gets frozen and can no longer be modified.

Source: javascript/web/pentaho/type/action/Execution.js, line 252

Inherited From: pentaho.type.action.Execution#action

base:  function
Protected

If a method has been overridden, then the base method provides access to the overridden method.

Can also be called from within a constructor function.

Source: javascript/web/pentaho/lang/Base.js, line 299

Inherited From: pentaho.lang.Base#base

error:  Error | pentaho.lang.UserError

Gets the reason for a rejected action execution, or null.

This property only returns a non-null value if isRejected is true.

Source: javascript/web/pentaho/type/action/Execution.js, line 329

Inherited From: pentaho.type.action.Execution#error

isCanceled:  boolean

Gets a value that indicates if the action execution has been canceled.

An action execution is considered canceled if its state has the canceled bit on.

Source: javascript/web/pentaho/type/action/Execution.js, line 397

Inherited From: pentaho.type.action.Execution#isCanceled

See also: pentaho.type.action.Execution#isRejected

isDone:  boolean

Gets a value that indicates if the action execution completed successfully.

An action execution is considered done if its state has the did bit on.

Source: javascript/web/pentaho/type/action/Execution.js, line 446

Inherited From: pentaho.type.action.Execution#isDone

See also: pentaho.type.action.Execution#isSettled , pentaho.type.action.Execution#result

isExecuting:  boolean

Gets a value that indicates if the action execution is executing.

An action execution is considered executing if it has started but not yet finished, i.e., if its state is not the unstarted state or any of the finished states.

Source: javascript/web/pentaho/type/action/Execution.js, line 430

Inherited From: pentaho.type.action.Execution#isExecuting

See also: pentaho.type.action.Execution#isUnstarted , pentaho.type.action.Execution#isFinished

isFailed:  boolean

Gets a value that indicates if the action execution has failed.

An action execution is considered failed if its state has the failed bit on.

Source: javascript/web/pentaho/type/action/Execution.js, line 412

Inherited From: pentaho.type.action.Execution#isFailed

See also: pentaho.type.action.Execution#isRejected

isFinished:  boolean

Gets a value that indicates if the action execution has finished.

An action execution is considered finished if its state has the finished bit on.

When finished, one of the bits did, canceled or failed must also be on.

Source: javascript/web/pentaho/type/action/Execution.js, line 468

Inherited From: pentaho.type.action.Execution#isFinished

See also: pentaho.type.action.Execution#isSettled

isRejected:  boolean

Gets a value that indicates if the action execution has been rejected.

An action execution is considered rejected if its state has one of the following bits on: canceled or failed.

Source: javascript/web/pentaho/type/action/Execution.js, line 382

Inherited From: pentaho.type.action.Execution#isRejected

See also: pentaho.type.action.Execution#isCanceled , pentaho.type.action.Execution#isFailed , pentaho.type.action.Execution#isDone , pentaho.type.action.Execution#isSettled , pentaho.type.action.Execution#error

isSettled:  boolean

Gets a value that indicates if the action execution has been settled.

An action execution is considered settled if its state has one of the following bits on: did, failed or canceled.

When an execution is settled it may not yet be [finished]{@see pentaho.type.action.Execution#isFinished}.

Source: javascript/web/pentaho/type/action/Execution.js, line 362

Inherited From: pentaho.type.action.Execution#isSettled

See also: pentaho.type.action.Execution#isCanceled , pentaho.type.action.Execution#isFailed , pentaho.type.action.Execution#isDone

isUnstarted:  boolean

Gets a value that indicates if the action execution is in the unstarted state.

Source: javascript/web/pentaho/type/action/Execution.js, line 340

Inherited From: pentaho.type.action.Execution#isUnstarted

promise:  Promise

Gets a promise for the result (or error) of this action execution.

This promise can be requested anytime, before the execution has started, during execution, or after execution has finished. It can also be requested whether or not the associated action is synchronous or asynchronous.

The promise is fulfilled with the action execution's result or rejected with the action execution's error.

Source: javascript/web/pentaho/type/action/Execution.js, line 491

Inherited From: pentaho.type.action.Execution#promise

result:  any

Gets the result of a successful action execution, if any.

This property only returns a non-undefined value if isDone is true.

Source: javascript/web/pentaho/type/action/Execution.js, line 316

Inherited From: pentaho.type.action.Execution#result

state:  pentaho.type.action.States

Gets the current action execution state.

Source: javascript/web/pentaho/type/action/Execution.js, line 285

Inherited From: pentaho.type.action.Execution#state

See also: pentaho.type.action.Execution#isUnstarted , pentaho.type.action.Execution#isExecuting , pentaho.type.action.Execution#isSettled , pentaho.type.action.Execution#isDone , pentaho.type.action.Execution#isRejected , pentaho.type.action.Execution#isCanceled , pentaho.type.action.Execution#isFailed , pentaho.type.action.Execution#isFinished

target:  pentaho.type.action.ITarget

Gets the target of the action execution.

This property returns the value of the target argument passed to the constructor.

Source: javascript/web/pentaho/type/action/Execution.js, line 264

Inherited From: pentaho.type.action.Execution#target

Methods Details

_doDefault() : Promise
Protected

Performs the default "execution" for the associated action.

When the associated action is asynchronous, this method may return a promise. If the promise gets rejected, the action is rejected with the same rejection reason. However, if the promise gets fulfilled, its value is always ignored.

Source: javascript/web/pentaho/type/action/Execution.js, line 575

Inherited From: pentaho.type.action.Execution#_doDefault

Returns:
Name Description
Promise
  • A promise for the completion of the default execution of an asynchronous action, or null.
_onPhaseDo() : Promise
Protected

Called during the action's do phase.

The default implementation does nothing.

Source: javascript/web/pentaho/type/action/Execution.js, line 972

Inherited From: pentaho.type.action.Execution#_onPhaseDo

Returns:
Name Description
Promise | null

A promise to the completion of the asynchronous do listener, of an asynchronous action, or null.

_onPhaseFinally()
Protected

Called during the action's finally phase.

The default implementation does nothing.

Source: javascript/web/pentaho/type/action/Execution.js, line 983

Inherited From: pentaho.type.action.Execution#_onPhaseFinally

_onPhaseInit()
Protected

Called during the action execution's initialize phase.

The default implementation does nothing.

Source: javascript/web/pentaho/type/action/Execution.js, line 949

Inherited From: pentaho.type.action.Execution#_onPhaseInit

_onPhaseWill()
Protected

Called during the action execution's will phase.

The default implementation does nothing.

Source: javascript/web/pentaho/type/action/Execution.js, line 959

Inherited From: pentaho.type.action.Execution#_onPhaseWill

done(result) : pentaho.type.action.Execution

Called from an action observer to settle the action execution as being done, optionally giving a result value.

Source: javascript/web/pentaho/type/action/Execution.js, line 591

Inherited From: pentaho.type.action.Execution#done

Parameters:
Name Default Value Summary
result : any
Optional

The result of the action execution, if any.

Returns:
Name Description
pentaho.type.action.Execution

The value of this.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the action execution is not in the do state.

execute() : pentaho.type.action.Execution

Executes the action.

When the associated action is asynchronous, or it is not know if it is synchronous or asynchronous, upon return of this method, obtain the value of the promise property and wait for its resolution.

Source: javascript/web/pentaho/type/action/Execution.js, line 549

Inherited From: pentaho.type.action.Execution#execute

Returns:
Name Description
pentaho.type.action.Execution

The value of this.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the action execution is not in the unstarted state.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

Methods that are overridden are accessible through this.base.

This object is extended, but its class doesn't change.

Source: javascript/web/pentaho/lang/Base.js, line 1037

Inherited From: pentaho.lang.Base#extend

Parameters:
Name Default Value Summary
source : Object

The instance specification.

keyArgs : Object
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
exclude : Object
Optional

A map of property names to exclude from source.

Returns:
Name Description
Object

This object.

reject(reason) : pentaho.type.action.Execution

Called to settle the action execution as rejected.

The execution is considered failed if reason is an instance of Error (which is not an instance of UserError) or if it is an instance of RuntimeError.

Otherwise, the execution is considered canceled if reason is a string or an instance of UserError (which is not an instance of RuntimeError).

Source: javascript/web/pentaho/type/action/Execution.js, line 660

Inherited From: pentaho.type.action.Execution#reject

Parameters:
Name Default Value Summary
reason : string | Error
Optional

The reason for the rejection.

Returns:
Name Description
pentaho.type.action.Execution

The value of this.

Throws:
Name Description
pentaho.lang.OperationInvalidError

When the action execution is not in one of the states init, will or do.

See also: pentaho.type.action.Execution#isRejected , pentaho.type.action.Execution#isCanceled , pentaho.type.action.Execution#isFailed , pentaho.type.action.Execution#error

Example

define([
 "pentaho/lang/UserError",
 "pentaho/lang/RuntimeError"
], function(UserError, RuntimeError) {

 // ...

 target.on("fly", {
 will: function(event) {

 // Canceling the action execution
 // - Method 1
 event.reject("Cannot do this action now.");

 // - Method 2
 event.reject(new UserError("Cannot do this action now."));

 // Failing the action execution
 // - Method 1 (message is not adequate to be shown to the user):
 event.reject(new Error("Null Pointer Exception."));

 // - Method 2 (message is adequate to be shown to the user):
 event.reject(new RuntimeError("The server is currently unreachable."));
 }
 });

 // ...
});