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

Execution

pentaho.action Execution

The action.Execution class represents a certain model of action execution.

This class manages the execution of an action and enforces the multiple phases by which all actions, generically, go through, which are: "init", "will", "do", and "finally".

Synchronous or Asynchronous

The associated action can be synchronous or asynchronous, as determined by the type property, pentaho.action.Base.isSync. The execution of a synchronous action is completed synchronously. while that of an asynchronous action only completes asynchronously, due to its asynchronous "do" phase.

The execute method handles the execution of both types of actions. When the associated action is asynchronous, or it is not know if it is synchronous or asynchronous, after calling execute, obtain the value of the promise property and wait for its resolution.

Execution model

The following is a detailed description of the action execution model:

  1. When an action execution is constructed, it is in the unstarted state.

    The action's label and description properties, and any other property which defines what it ultimately does, can still be freely modified.

    In this state, the execution cannot be settled by marking it done or rejected.

  2. When the execute method is called, the execution enters the init phase:

    • the state is set to init;
    • the _onPhaseInit method is called.

    The action's label and description properties, and any other property which defines what it ultimately does, can be freely modified at this stage.

    The execution can be settled by marking it rejected in which case it transits to the finally phase.

    Otherwise, if the associated action is not valid, the execution is automatically rejected with the first reported validation error.

    Otherwise, the execution automatically transits to the will phase.

  3. In the will phase, what the associated action will do is already determined and cannot change anymore:

    • the state is set to will;
    • the associated action is frozen, using Object.freeze, and should not be modified anymore (e.g. by modifying nested objects); trying to modify direct properties of the action will throw a TypeError;
    • the _onPhaseWill method is called.

    From this point on, an execution can be canceled based on what exactly the associated action will do.

    The execution can be settled by marking it rejected, in which case it transits to the finally phase.

    Otherwise, the execution automatically transits to the do phase.

  4. In the do phase, the execution, proper, is carried out:

    • the state is set to do;
    • the _onPhaseDo method is called.
    • if after calling _onPhaseDo, the execution is not yet done or rejected, the _doDefault method is called, allowing the action execution class to clearly handle a default behaviour.

    The execution can be settled by marking it rejected or, alternatively, done.

    In either case, the execution transits to the finally phase.

  5. In the beginning of the finally phase, the execution is considered settled, with or without success.

    If this phase was entered due to a rejection, the execution is in one of the states canceled or failed, depending on the type of rejection reason, isRejected is true, and an error may be available.

    Otherwise, the execution was successful and it is in the did state. Property isDone now returns true and a result may be available.

    The _onPhaseFinally method is called.

    The finished state bit is set to on. Property isFinished now returns true.

AMD Module

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

Extends

Constructor

Name Description
new Execution()
Abstract

Creates an action execution instance for a given action and target.

Members

Name Description
__isInside :  boolean

Indicates if currently calling any of the methods: execute, executeWill, _onPhaseFinally__executePhaseFinally.

base :  function
Protected

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

Methods

Name Description
extend(source, keyArgs) : object

Extend an object with the properties of another.

Constructor Details

new Execution()
Abstract

Creates an action execution instance for a given action and target.

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

Members Details

__isInside:  boolean

Indicates if currently calling any of the methods: execute, executeWill, _onPhaseFinally__executePhaseFinally.

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

Default Value: false

See also: pentaho.action.Execution#__callInside

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

Methods Details

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 1040

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.