Package com.smartgwt.client.util.workflow

# Class Process

java.lang.Object
com.smartgwt.client.core.BaseClass
com.smartgwt.client.util.workflow.Process

All Implemented Interfaces:
  `HasHandlers`, `HasFinishedHandlers`, `HasTraceElementHandlers`

Direct Known Subclasses:
  `Tour`

public class Process extends BaseClass implements HasFinishedHandlers, HasTraceElementHandlers
A instance of Process represents a stateful process executing a series of Tasks, which may be:

- user interactions
- calls to DataSources (hence: any database or web service)
- arbitrary code
- other Processes

A Process is stateful in the sense that it maintains `state` across the different tasks that are executed. This allows you to maintain context as you walk a user through a multi-step business process in your application, which may involve multiple operations on multiple entities. Each Task that executes can use the Process state as inputs, and can output a result which is stored in the Process state - see `TaskIO`.

A Process can have multiple branches, choosing the next Task to execute based on `Criteria` - see `DecisionTask` and `MultiDecisionTask`.

Because a Process may return to a previous Task in various situations, the data model of a Process is strictly speaking a graph (a set of nodes connected by arbitary interlinks). However, most processes have sequences of several tasks in a row, and the definition format allows these to be represented as simple Arrays called "sequences", specified via `sequences`. This reduces the need to manually specify IDs and interlinks for Tasks that simply proceed to the next task in a sequence.

Processes follow all the standard rules for encoding as `ComponentXML`, however, note that the <Process> tag allows any kind of `ProcessElement` (tasks, decisions and sequences) to appear as a direct subelement of the <Process> tag without the need for an intervening <elements> or <sequences> tag. The example below demonstrates this shorthand format.

      <Process ID="processId">
          <DSRequestTask ID="dsRequestTaskId" nextElement="sequenceId" ..>
              <inputFieldList>
                  <value>order.countryName</value>
              </inputFieldList>
              <outputFieldList>
                  <value>order.countryName</value>
                  <value>order.continent</value>
              <outputFieldList>
          </DSRequestTask>
          <sequence ID="sequenceId" >
              <StateTask ../>
              <StateTask ../>
              <StateTask ../>
              <StateTask nextElement="userTaskId" ../>
          </sequence>
          <UserTask ID="userTaskId" ../>
          ...
      </Process>

NOTE: you must load the standard DataBinding module before you can use `Process`.

- ## Field Summary

  ### Fields inherited from class com.smartgwt.client.core.BaseClass

  `config, configOnly, factoryCreated, factoryProperties, id, scClassName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Process()`
  `Process(JavaScriptObject jsObj)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `HandlerRegistration`
  `addFinishedHandler(FinishedHandler handler)`
  Add a finished handler.
  `HandlerRegistration`
  `addTraceElementHandler(TraceElementHandler handler)`
  Add a traceElement handler.
  `void`
  `afterTaskCommit(Task task, Map outputs)`
  Notification hook invoked after a Task's outputs have been committed to state and history recorded, but before routing to the next element.
  `void`
  `applyStateUpdates(Map stateUpdates)`
  Apply the state updates specified by `setStateVariable()` to the process state.
  `void`
  `applyStateUpdates(Map stateUpdates, Map inputRecord)`
  See `applyStateUpdates()`
  `void`
  `applyStateUpdates(Map stateUpdates, Map inputRecord, Boolean strict)`
  Apply the state updates specified by `setStateVariable()` to the process state.
  `TaskResultModifications`
  `beforeTaskCommit(ProcessElement task, Map outputs)`
  Override point invoked after a Task completes successfully, but before any of the Task's outputs are committed to `state` and before next-task routing proceeds.
  `JavaScriptObject`
  `create()`
  `void`
  `fail(String code)`
  Programmatically signal that this Process has hit an infrastructure failure and should terminate through its `failed()` channel rather than completing normally.
  `void`
  `fail(String code, String message)`
  See `fail()`
  `void`
  `fail(String code, String message, Object cause)`
  Programmatically signal that this Process has hit an infrastructure failure and should terminate through its `failed()` channel rather than completing normally.
  `void`
  `failed(ProcessFailure failure)`
  StringMethod called when a process terminates via an infrastructure failure - for example AI engine unavailable, schema-validation mismatch on input or output, uncaught JS exception, cancellation, or an ancestor-cycle deadlock when invoking a sub-Process.
  `String[]`
  `getComponentReferences()`
  Returns a list of unique global IDs that are referenced by this process.
  `String`
  `getContainerId()`
  Identifier of canvas where UI elements created by using `inline view` property should be added using addMember.
  `ProcessElement`
  `getCurrentTask()`
  The task that is currently being executed by this process, or `null` when no task is running.
  `String`
  `getDataSources()`
  Comma-separated list of DataSource IDs to pre-load when this process runs server-side (inside an `OperationBinding.process`).
  `String`
  `getDefaultProcessConstructor()`
  Name of the default Process subclass to use when auto-constructing plain Objects that are detected as Processes (see heuristic on `defaultTaskConstructor`)
  `String`
  `getDefaultTaskConstructor()`
  Name of the default Task subclass to use when auto-constructing plain Objects found in collections that accept Tasks (for example `CoTProcess.tasks`, sequence members, etc).
  `Integer`
  `getDefaultWaitDuration()`
  When `defaultWaitFor` or task `waitFor` are set to "duration", how long should the wait be before starting the task? A task can override the default value with task `waitDuration`.
  `WaitForType`
  `getDefaultWaitFor()`
  Condition to wait for before each task is executed.
  `ProcessElement`
  `getElement(String ID)`
  Retrieve a `ProcessElement` by its ID
  `ProcessElement[]`
  `getElements()`
  Elements involved in this Process.
  `DataSource`
  `getInputDS()`
  Optional `DataSource` that constrains the input record a caller may provide to this Process.
  `String`
  `getInputDSAsString()`
  Optional `DataSource` that constrains the input record a caller may provide to this Process.
  `DataSourceField[]`
  `getInputFields()`
  Shorthand alternative to `inputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand.
  `JavaScriptObject`
  `getJsObj()`
  `Object`
  `getLastTaskOutput()`
  Returns the task output of the last task executed.
  `Object`
  `getLastTaskOutput(String taskType)`
  Returns the task output of the last task executed.
  `Boolean`
  `getMockMode()`
  Enable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action.
  `JavaScriptObject`
  `getOrCreateJsObj()`
  `static Process`
  `getOrCreateRef(JavaScriptObject jsObj)`
  `Object`
  `getOutput()`
  Returns the Process's output, computed in this priority order: The value passed to `setOutput()` if any. If `outputDS`/`outputFields` are declared: a shallow pick of those field names from `state`. Otherwise: `state` itself (back-compat).
  `DataSource`
  `getOutputDS()`
  Optional `DataSource` that describes and validates the final output this Process produces on successful completion.
  `String`
  `getOutputDSAsString()`
  Optional `DataSource` that describes and validates the final output this Process produces on successful completion.
  `DataSourceField[]`
  `getOutputFields()`
  Shorthand alternative to `outputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand.
  `static Process`
  `getProcess(String processId)`
  Get a Process instance by its ID.
  `String`
  `getProcessDescription()`
  Returns the process description as HTML.
  `ProcessElement[]`
  `getProcessElements(String attribute)`
  `Map`
  `getProcessState()`
  Returns the complete process state for persistence.
  `String`
  `getRuleScope()`
  `Canvas.ID` of the component that manages "rule context" for which this process participates.
  `ProcessSequence[]`
  `getSequences()`
  Sequences of ProcessElements.
  `String`
  `getStartElement()`
  The ID of either a `sequence` or an `element` which should be the starting point of the process.
  `Record`
  `getState()`
  Current state of a process.
  `Object`
  `getStateVariable(String stateVariablePath)`
  Returns a variable value from the `process state`.
  `Boolean`
  `getStrictPaths()`
  If set to true, the process will not allow any intermediate state to be set via `setStateVariable()` that is not explicitly defined first.
  `Map`
  `getSuspendInfo()`
  Returns information about why and where the process is suspended.
  `ProcessElement[]`
  `getTasks()`
  Convenience form of declaring a single, linear sequence of tasks for this process.
  `Map`
  `getTraceContext()`
  Context object to be passed to `Process.traceElement()` during process execution.
  `Boolean`
  `getWizard()`
  If wizard is set then current workflow will be handled as wizard.
  `boolean`
  `isCreated()`
  `Boolean`
  `isSuspended()`
  Returns true if the process is currently suspended.
  `static void`
  `loadProcess(String processId, ProcessCallback callback)`
  `protected void`
  `onInit()`
  `void`
  `passThruTaskOutput(ProcessElement task)`
  Takes the `last task output` and sets it as the `task output` for the `task`.
  `void`
  `reset()`
  Reset process to its initial state, so process can be started again.
  `void`
  `reset(Record state)`
  Reset process to its initial state, so process can be started again.
  `void`
  `restoreFromState(Map completeState)`
  Restores process state from a previously saved complete state and optionally resumes execution.
  `void`
  `restoreFromState(Map completeState, Boolean resume)`
  Restores process state from a previously saved complete state and optionally resumes execution.
  `void`
  `resume()`
  Resumes a suspended process.
  `void`
  `resume(Map taskOutput)`
  Resumes a suspended process.
  `void`
  `runTask(String taskID, RunTaskCallback callback, Map priorTaskOutputs, Map state, Map ruleContext)`
  Execute a single task in isolation for testing.
  `Process`
  `setAttribute(String attribute, ProcessElement[] value, boolean allowPostCreate)`
  `void`
  `setConfig(JavaScriptObject jsObj)`
  `Process`
  `setContainerId(String containerId)`
  Identifier of canvas where UI elements created by using `inline view` property should be added using addMember.
  `Process`
  `setCurrentTask(ProcessElement currentTask)`
  The task that is currently being executed by this process, or `null` when no task is running.
  `Process`
  `setDataSources(String dataSources)`
  Comma-separated list of DataSource IDs to pre-load when this process runs server-side (inside an `OperationBinding.process`).
  `Process`
  `setDefaultProcessConstructor(String defaultProcessConstructor)`
  Name of the default Process subclass to use when auto-constructing plain Objects that are detected as Processes (see heuristic on `defaultTaskConstructor`)
  `Process`
  `setDefaultTaskConstructor(String defaultTaskConstructor)`
  Name of the default Task subclass to use when auto-constructing plain Objects found in collections that accept Tasks (for example `CoTProcess.tasks`, sequence members, etc).
  `Process`
  `setDefaultWaitDuration(Integer defaultWaitDuration)`
  When `defaultWaitFor` or task `waitFor` are set to "duration", how long should the wait be before starting the task? A task can override the default value with task `waitDuration`.
  `Process`
  `setDefaultWaitFor(WaitForType defaultWaitFor)`
  Condition to wait for before each task is executed.
  `Process`
  `setElements(ProcessElement... elements)`
  Elements involved in this Process.
  `Process`
  `setInputDS(DataSource inputDS)`
  Optional `DataSource` that constrains the input record a caller may provide to this Process.
  `Process`
  `setInputDS(String inputDS)`
  Optional `DataSource` that constrains the input record a caller may provide to this Process.
  `Process`
  `setInputFields(DataSourceField... inputFields)`
  Shorthand alternative to `inputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand.
  `void`
  `setJavaScriptObject(JavaScriptObject jsObj)`
  `Process`
  `setMockMode(Boolean mockMode)`
  Enable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action.
  `void`
  `setNextElement()`
  Sets the task ID of the next task to execute after the current task finishes.
  `void`
  `setNextElement(String nextElement)`
  Sets the task ID of the next task to execute after the current task finishes.
  `void`
  `setOutput(Object output)`
  Explicitly set the final output this Process will deliver on successful completion, overriding the default behavior of picking output fields out of `state`.
  `Process`
  `setOutputDS(DataSource outputDS)`
  Optional `DataSource` that describes and validates the final output this Process produces on successful completion.
  `Process`
  `setOutputDS(String outputDS)`
  Optional `DataSource` that describes and validates the final output this Process produces on successful completion.
  `Process`
  `setOutputFields(DataSourceField... outputFields)`
  Shorthand alternative to `outputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand.
  `Process`
  `setRuleScope(String ruleScope)`
  `Canvas.ID` of the component that manages "rule context" for which this process participates.
  `Process`
  `setSequences(ProcessSequence... sequences)`
  Sequences of ProcessElements.
  `void`
  `setStartElement(ProcessElement startElement)`
  `Process`
  `setStartElement(String startElement)`
  The ID of either a `sequence` or an `element` which should be the starting point of the process.
  `Process`
  `setState(Record state)`
  Current state of a process.
  `void`
  `setStateVariable(String stateVariablePath, Object value)`
  Sets a `process state` variable for later reference with `getStateVariable()` or more commonly with a `TaskInputExpression` property.
  `void`
  `setStateVariable(String stateVariablePath, Object value, Boolean strict)`
  Sets a `process state` variable for later reference with `getStateVariable()` or more commonly with a `TaskInputExpression` property.
  `Process`
  `setStrictPaths(Boolean strictPaths)`
  If set to true, the process will not allow any intermediate state to be set via `setStateVariable()` that is not explicitly defined first.
  `void`
  `setTaskOutput(ProcessElement task, Object value)`
  Sets the task output of `task` in the `process state` so it can be used by later tasks with `getLastTaskOutput()` or more commonly with a `TaskInputExpression` property.
  `Process`
  `setTasks(ProcessElement... tasks)`
  Convenience form of declaring a single, linear sequence of tasks for this process.
  `Process`
  `setTraceContext(Map traceContext)`
  Context object to be passed to `Process.traceElement()` during process execution.
  `Process`
  `setWizard(Boolean wizard)`
  If wizard is set then current workflow will be handled as wizard.
  `void`
  `start()`
  Starts this task by executing the `startElement`.
  `void`
  `suspend(String reason, String taskId)`
  Suspends process execution at the current point.

  ### Methods inherited from class com.smartgwt.client.core.BaseClass

  `addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, asSGWTComponent, clearDynamicProperty, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getRef, getScClassName, getTestInstance, hasAutoAssignedID, hasDynamicProperty, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfigOnly, setFactoryCreated, setID, setProperty, setProperty, setProperty, setProperty, setScClassName`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

  `fireEvent`

- ## Constructor Details

  - ### Process

    public Process()

  - ### Process

    public Process(JavaScriptObject jsObj)

- ## Method Details

  - ### getOrCreateRef

    public static Process getOrCreateRef(JavaScriptObject jsObj)

  - ### setJavaScriptObject

    public void setJavaScriptObject(JavaScriptObject jsObj)
    Overrides:
      `setJavaScriptObject` in class `BaseClass`

  - ### create

    public JavaScriptObject create()
    Specified by:
      `create` in class `BaseClass`

  - ### isCreated

    public boolean isCreated()
    Overrides:
      `isCreated` in class `BaseClass`

  - ### getJsObj

    public JavaScriptObject getJsObj()
    Overrides:
      `getJsObj` in class `BaseClass`

  - ### getOrCreateJsObj

    public JavaScriptObject getOrCreateJsObj()
    Overrides:
      `getOrCreateJsObj` in class `BaseClass`

  - ### setContainerId

    public Process setContainerId(String containerId)
    Identifier of canvas where UI elements created by using `inline view` property should be added using addMember.
    Parameters:
      `containerId` - New containerId value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    See Also:
      - `GlobalId`

  - ### getContainerId

    public String getContainerId()
    Identifier of canvas where UI elements created by using `inline view` property should be added using addMember.
    Returns:
      Current containerId value. Default value is null
    See Also:
      - `GlobalId`

  - ### setCurrentTask

    public Process setCurrentTask(ProcessElement currentTask) throws IllegalStateException
    The task that is currently being executed by this process, or `null` when no task is running. Populated by `start()` immediately before each call to `ProcessElement.executeElement()` and remains set until either (a) the task completes synchronously and the loop advances, or (b) the task completes asynchronously and a subsequent `start()` invocation picks up the next task and overwrites the pointer. A fully-finished process clears it back to `null`.

    This is the authoritative "what is running right now" pointer for code that needs to inspect the active task from outside the execution call stack - most notably CoT prompt assembly, which uses it to resolve task-scoped prompt fragments against the correct CoTTask. Application code should treat it as read-only.

    Parameters:
      `currentTask` - New currentTask value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getCurrentTask

    public ProcessElement getCurrentTask()
    The task that is currently being executed by this process, or `null` when no task is running. Populated by `start()` immediately before each call to `ProcessElement.executeElement()` and remains set until either (a) the task completes synchronously and the loop advances, or (b) the task completes asynchronously and a subsequent `start()` invocation picks up the next task and overwrites the pointer. A fully-finished process clears it back to `null`.

    This is the authoritative "what is running right now" pointer for code that needs to inspect the active task from outside the execution call stack - most notably CoT prompt assembly, which uses it to resolve task-scoped prompt fragments against the correct CoTTask. Application code should treat it as read-only.

    Returns:
      Current currentTask value. Default value is null

  - ### setDataSources

    public Process setDataSources(String dataSources) throws IllegalStateException
    Comma-separated list of DataSource IDs to pre-load when this process runs server-side (inside an `OperationBinding.process`). The listed DataSources become available to all `ScriptTasks` in the process as DataSource instances and same-named local variables.

    This is the process-level equivalent of `OperationBinding.dataSources`; it scopes the pre-load to this process definition rather than the enclosing operationBinding. Individual ScriptTasks can list additional DataSources via `ScriptTask.dataSources`.

    DataSources already listed on the operationBinding or referenced directly in DS*Task `dataSource` attributes do not need to be listed here.

    This attribute has no effect in client-side workflows.

    Parameters:
      `dataSources` - New dataSources value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created
    See Also:
      - `OperationBinding.dataSources`
      - `ScriptTask.setDataSources(java.lang.String)`
      - `Server-Side Process Execution`

  - ### getDataSources

    public String getDataSources()
    Comma-separated list of DataSource IDs to pre-load when this process runs server-side (inside an `OperationBinding.process`). The listed DataSources become available to all `ScriptTasks` in the process as DataSource instances and same-named local variables.

    This is the process-level equivalent of `OperationBinding.dataSources`; it scopes the pre-load to this process definition rather than the enclosing operationBinding. Individual ScriptTasks can list additional DataSources via `ScriptTask.dataSources`.

    DataSources already listed on the operationBinding or referenced directly in DS*Task `dataSource` attributes do not need to be listed here.

    This attribute has no effect in client-side workflows.

    Returns:
      Current dataSources value. Default value is null
    See Also:
      - `OperationBinding.dataSources`
      - `ScriptTask.getDataSources()`
      - `Server-Side Process Execution`

  - ### setDefaultProcessConstructor

    public Process setDefaultProcessConstructor(String defaultProcessConstructor) throws IllegalStateException
    Name of the default Process subclass to use when auto-constructing plain Objects that are detected as Processes (see heuristic on `defaultTaskConstructor`)
    Parameters:
      `defaultProcessConstructor` - New defaultProcessConstructor value. Default value is "Process"
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getDefaultProcessConstructor

    public String getDefaultProcessConstructor()
    Name of the default Process subclass to use when auto-constructing plain Objects that are detected as Processes (see heuristic on `defaultTaskConstructor`)
    Returns:
      Current defaultProcessConstructor value. Default value is "Process"

  - ### setDefaultTaskConstructor

    public Process setDefaultTaskConstructor(String defaultTaskConstructor) throws IllegalStateException
    Name of the default Task subclass to use when auto-constructing plain Objects found in collections that accept Tasks (for example `CoTProcess.tasks`, sequence members, etc).

    This is consulted only when the element is a plain Object (not already constructed) and does not declare its own `_constructor`. If `defaultTaskConstructor` is unset for a given `Process`, the engine uses `ScriptTask`.

    #### Task vs nested subprocess heuristic

    Nested Processes are often used to encapsulate a sub-workflow. When auto-constructing, the engine uses a heuristic to auto-detect the developer's intent to create a nested Process, as follows:

    1. If the element is already a constructed instance (Task or StartProcessTask), use it as-is.
    2. If the element declares `_constructor`, use that class directly.
    3. If the element has a `process` property:
       1. Construct a SubProcessTask for the element itself (unless the object declares its own `_constructor` to override this). SubProcessTask is a strict superset of `StartProcessTask`: with neither `stateUpdates` nor process-level I/O schemas declared it behaves identically to StartProcessTask; with them it additionally supports CoT-style state flow, `TaskInputExpression` `$output.<fieldName>` references, and infra-failure routing via `failureElement`.
       2. If `process` is a plain Object (not already constructed), auto-instantiate it as a Process using `defaultProcessConstructor` and assign the instance to `task.process`.
       3. If `process` is already a Process instance, assign it directly to `task.process`.
    4. Otherwise, construct it as a Task using `defaultTaskConstructor` if set, otherwise `Task`.

    #### Examples

          // Plain objects default to CoTTask (AI module) unless specified otherwise.
          isc.Process.create({
            defaultTaskConstructor: "CoTTask",
            defaultProcessConstructor: "CoTProcess",
            tasks: [
              { ID:"decide",  title:"Decide Next" },   // -> CoTTask

              // Nested process via wrapper: becomes StartProcessTask; its .process is auto-created.
              { ID:"subflow",
                process: {
                  ID:"p1",
                  tasks:[ { ID:"leaf", title:"Leaf step" } ] // auto-instantiated as CoTProcess
                }
              },

              { _constructor:"MyTask", ID:"apply" }    // -> MyTask
            ]
          });

    Parameters:
      `defaultTaskConstructor` - New defaultTaskConstructor value. Default value is "ScriptTask"
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getDefaultTaskConstructor

    public String getDefaultTaskConstructor()
    Name of the default Task subclass to use when auto-constructing plain Objects found in collections that accept Tasks (for example `CoTProcess.tasks`, sequence members, etc).

    This is consulted only when the element is a plain Object (not already constructed) and does not declare its own `_constructor`. If `defaultTaskConstructor` is unset for a given `Process`, the engine uses `ScriptTask`.

    #### Task vs nested subprocess heuristic

    Nested Processes are often used to encapsulate a sub-workflow. When auto-constructing, the engine uses a heuristic to auto-detect the developer's intent to create a nested Process, as follows:

    1. If the element is already a constructed instance (Task or StartProcessTask), use it as-is.
    2. If the element declares `_constructor`, use that class directly.
    3. If the element has a `process` property:
       1. Construct a SubProcessTask for the element itself (unless the object declares its own `_constructor` to override this). SubProcessTask is a strict superset of `StartProcessTask`: with neither `stateUpdates` nor process-level I/O schemas declared it behaves identically to StartProcessTask; with them it additionally supports CoT-style state flow, `TaskInputExpression` `$output.<fieldName>` references, and infra-failure routing via `failureElement`.
       2. If `process` is a plain Object (not already constructed), auto-instantiate it as a Process using `defaultProcessConstructor` and assign the instance to `task.process`.
       3. If `process` is already a Process instance, assign it directly to `task.process`.
    4. Otherwise, construct it as a Task using `defaultTaskConstructor` if set, otherwise `Task`.

    #### Examples

          // Plain objects default to CoTTask (AI module) unless specified otherwise.
          isc.Process.create({
            defaultTaskConstructor: "CoTTask",
            defaultProcessConstructor: "CoTProcess",
            tasks: [
              { ID:"decide",  title:"Decide Next" },   // -> CoTTask

              // Nested process via wrapper: becomes StartProcessTask; its .process is auto-created.
              { ID:"subflow",
                process: {
                  ID:"p1",
                  tasks:[ { ID:"leaf", title:"Leaf step" } ] // auto-instantiated as CoTProcess
                }
              },

              { _constructor:"MyTask", ID:"apply" }    // -> MyTask
            ]
          });

    Returns:
      Current defaultTaskConstructor value. Default value is "ScriptTask"

  - ### setDefaultWaitDuration

    public Process setDefaultWaitDuration(Integer defaultWaitDuration) throws IllegalStateException
    When `defaultWaitFor` or task `waitFor` are set to "duration", how long should the wait be before starting the task? A task can override the default value with task `waitDuration`.
    Parameters:
      `defaultWaitDuration` - New defaultWaitDuration value. Default value is "300"
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getDefaultWaitDuration

    public Integer getDefaultWaitDuration()
    When `defaultWaitFor` or task `waitFor` are set to "duration", how long should the wait be before starting the task? A task can override the default value with task `waitDuration`.
    Returns:
      Current defaultWaitDuration value. Default value is "300"

  - ### setDefaultWaitFor

    public Process setDefaultWaitFor(WaitForType defaultWaitFor) throws IllegalStateException
    Condition to wait for before each task is executed. Task `waitFor` can be specified for individual tasks to override this default.

    For a value of "duration", the delay time is set by `defaultWaitDuration` and can be overridden by a task `waitDuration`.

    Note that if `defaultWaitFor` is set to "systemDone" and a task overrides it with `waitFor` "locator", the default "systemDone" is not performed. To apply both, as might be desired, use task `waitFor` "locatorAndSystemDone".

    A `defaultWaitFor` value of "locator" or "locatorAndSystemDone" is not valid.

    Parameters:
      `defaultWaitFor` - New defaultWaitFor value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getDefaultWaitFor

    public WaitForType getDefaultWaitFor()
    Condition to wait for before each task is executed. Task `waitFor` can be specified for individual tasks to override this default.

    For a value of "duration", the delay time is set by `defaultWaitDuration` and can be overridden by a task `waitDuration`.

    Note that if `defaultWaitFor` is set to "systemDone" and a task overrides it with `waitFor` "locator", the default "systemDone" is not performed. To apply both, as might be desired, use task `waitFor` "locatorAndSystemDone".

    A `defaultWaitFor` value of "locator" or "locatorAndSystemDone" is not valid.

    Returns:
      Current defaultWaitFor value. Default value is null

  - ### setElements

    public Process setElements(ProcessElement... elements) throws IllegalStateException
    Elements involved in this Process. You can also group elements into `sequences` to reduce the need to explicitly define IDs for elements and interlink them.
    Parameters:
      `elements` - New elements value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### setInputDS

    public Process setInputDS(DataSource inputDS) throws IllegalStateException
    Optional `DataSource` that constrains the input record a caller may provide to this Process. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource. Nested DataSources are permitted.

    When set, the input record is validated via `DataSource.validateData()` before the Process starts.

    See `ProcessIO`. If both `inputDS` and `inputFields` are set, `inputDS` wins.

    Parameters:
      `inputDS` - New inputDS value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getInputDS

    public DataSource getInputDS()
    Optional `DataSource` that constrains the input record a caller may provide to this Process. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource. Nested DataSources are permitted.

    When set, the input record is validated via `DataSource.validateData()` before the Process starts.

    See `ProcessIO`. If both `inputDS` and `inputFields` are set, `inputDS` wins.

    Returns:
      Current inputDS value. Default value is null

  - ### setInputDS

    public Process setInputDS(String inputDS) throws IllegalStateException
    Optional `DataSource` that constrains the input record a caller may provide to this Process. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource. Nested DataSources are permitted.

    When set, the input record is validated via `DataSource.validateData()` before the Process starts.

    See `ProcessIO`. If both `inputDS` and `inputFields` are set, `inputDS` wins.

    Parameters:
      `inputDS` - New inputDS value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created
    See Also:
      - `GlobalId`

  - ### getInputDSAsString

    public String getInputDSAsString()
    Optional `DataSource` that constrains the input record a caller may provide to this Process. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource. Nested DataSources are permitted.

    When set, the input record is validated via `DataSource.validateData()` before the Process starts.

    See `ProcessIO`. If both `inputDS` and `inputFields` are set, `inputDS` wins.

    Returns:
      Current inputDS value. Default value is null
    See Also:
      - `GlobalId`

  - ### setInputFields

    public Process setInputFields(DataSourceField... inputFields) throws IllegalStateException
    Shorthand alternative to `inputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand.

    See `ProcessIO`.

    Parameters:
      `inputFields` - New inputFields value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getInputFields

    public DataSourceField[] getInputFields()
    Shorthand alternative to `inputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand.

    See `ProcessIO`.

    Returns:
      Current inputFields value. Default value is null

  - ### setMockMode

    public Process setMockMode(Boolean mockMode)
    Enable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action. For example, a task that would normally fail outside of its target environment can take an alternative action during testing.

    mockMode can also be enabled or disabled for an individual task with `ProcessElement.mockMode`.

    Parameters:
      `mockMode` - New mockMode value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls

  - ### getMockMode

    public Boolean getMockMode()
    Enable mock mode on the workflow? By default, this setting does nothing but is available for individual tasks to trigger special action. For example, a task that would normally fail outside of its target environment can take an alternative action during testing.

    mockMode can also be enabled or disabled for an individual task with `ProcessElement.mockMode`.

    Returns:
      Current mockMode value. Default value is null

  - ### setOutputDS

    public Process setOutputDS(DataSource outputDS) throws IllegalStateException
    Optional `DataSource` that describes and validates the final output this Process produces on successful completion. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource.

    See `ProcessIO`. When set, a SubProcessTask caller references fields on this schema via `$output.<fieldName>` in CoTTask.stateUpdates.

    Parameters:
      `outputDS` - New outputDS value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getOutputDS

    public DataSource getOutputDS()
    Optional `DataSource` that describes and validates the final output this Process produces on successful completion. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource.

    See `ProcessIO`. When set, a SubProcessTask caller references fields on this schema via `$output.<fieldName>` in CoTTask.stateUpdates.

    Returns:
      Current outputDS value. Default value is null

  - ### setOutputDS

    public Process setOutputDS(String outputDS) throws IllegalStateException
    Optional `DataSource` that describes and validates the final output this Process produces on successful completion. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource.

    See `ProcessIO`. When set, a SubProcessTask caller references fields on this schema via `$output.<fieldName>` in CoTTask.stateUpdates.

    Parameters:
      `outputDS` - New outputDS value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created
    See Also:
      - `GlobalId`

  - ### getOutputDSAsString

    public String getOutputDSAsString()
    Optional `DataSource` that describes and validates the final output this Process produces on successful completion. May be a full DataSource definition, an existing instance, or the global ID of a registered DataSource.

    See `ProcessIO`. When set, a SubProcessTask caller references fields on this schema via `$output.<fieldName>` in CoTTask.stateUpdates.

    Returns:
      Current outputDS value. Default value is null
    See Also:
      - `GlobalId`

  - ### setOutputFields

    public Process setOutputFields(DataSourceField... outputFields) throws IllegalStateException
    Shorthand alternative to `outputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand. The declared field names also govern which `state` properties are picked into the Process's output value if `setOutput()` is never called.

    See `ProcessIO`.

    Parameters:
      `outputFields` - New outputFields value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getOutputFields

    public DataSourceField[] getOutputFields()
    Shorthand alternative to `outputDS`: a list of `DataSourceField` definitions the engine compiles into a temporary validation DataSource on demand. The declared field names also govern which `state` properties are picked into the Process's output value if `setOutput()` is never called.

    See `ProcessIO`.

    Returns:
      Current outputFields value. Default value is null

  - ### setRuleScope

    public Process setRuleScope(String ruleScope) throws IllegalStateException
    `Canvas.ID` of the component that manages "rule context" for which this process participates. The rule context can be used in `taskInputExpression`.
    Overrides:
      `setRuleScope` in class `BaseClass`
    Parameters:
      `ruleScope` - New ruleScope value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created
    See Also:
      - `Canvas.setRuleScope(java.lang.String)`

  - ### getRuleScope

    public String getRuleScope()
    `Canvas.ID` of the component that manages "rule context" for which this process participates. The rule context can be used in `taskInputExpression`.
    Overrides:
      `getRuleScope` in class `BaseClass`
    Returns:
      Current ruleScope value. Default value is null
    See Also:
      - `Canvas.getRuleScope()`

  - ### setSequences

    public Process setSequences(ProcessSequence... sequences) throws IllegalStateException
    Sequences of ProcessElements. By defining a sequences of elements you can make the `ProcessElement.nextElement` implicit.

    For a simple sequence of tasks, consider using `tasks` instead.

    Example of using sequences:

          Process process = new Process();
          process.setStartElement("firstSequence");
          ProcessSequence innerSequence = new ProcessSequence(incTask, add2Task, incTask);
          process.setSequences(
              new ProcessSequence("firstSequence", dsRequestTask, multiDecisionTask),
              new ProcessSequence("errorFlow", failureTask, userNotifyTask)
          );
          // standalone process elements not part of sequences
          process.setElements(new DSRequestTask(){...});
          Record state = new Record();
          state.setAttribute("someField", "someValue");
          process.setState(state);
          process.start();

    Parameters:
      `sequences` - New sequences value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getSequences

    public ProcessSequence[] getSequences()
    Sequences of ProcessElements. By defining a sequences of elements you can make the `ProcessElement.nextElement` implicit.

    For a simple sequence of tasks, consider using `tasks` instead.

    Example of using sequences:

          Process process = new Process();
          process.setStartElement("firstSequence");
          ProcessSequence innerSequence = new ProcessSequence(incTask, add2Task, incTask);
          process.setSequences(
              new ProcessSequence("firstSequence", dsRequestTask, multiDecisionTask),
              new ProcessSequence("errorFlow", failureTask, userNotifyTask)
          );
          // standalone process elements not part of sequences
          process.setElements(new DSRequestTask(){...});
          Record state = new Record();
          state.setAttribute("someField", "someValue");
          process.setState(state);
          process.start();

    Returns:
      Current sequences value. Default value is null

  - ### setStartElement

    public Process setStartElement(String startElement) throws IllegalStateException
    The ID of either a `sequence` or an `element` which should be the starting point of the process. If not specified, the first sequence is chosen, or if there are no sequences, the first element. - log a warning and do nothing if there are neither sequences or elements
    Parameters:
      `startElement` - New startElement value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getStartElement

    public String getStartElement()
    The ID of either a `sequence` or an `element` which should be the starting point of the process. If not specified, the first sequence is chosen, or if there are no sequences, the first element. - log a warning and do nothing if there are neither sequences or elements
    Returns:
      Current startElement value. Default value is null

  - ### setState

    public Process setState(Record state)
    Current state of a process. As with Records in general, any field of a Record may contain a nested Record or Array of Records, so the process state is essentially a hierarchical data structure.

    #### Transient state

    In addition to the explicit process state there is a "transient state." The transient state represents the complete output of each of the last tasks of each type within the current process execution. This allows easy reference to the previous task output with `taskInputExpressions`.
    If this method is called after the component has been drawn/initialized: Set process state for current process
    Parameters:
      `state` - the new process state. Default value is null
    Returns:
      `Process` instance, for chaining setter calls

  - ### getState

    public Record getState()
    Current state of a process. As with Records in general, any field of a Record may contain a nested Record or Array of Records, so the process state is essentially a hierarchical data structure.

    #### Transient state

    In addition to the explicit process state there is a "transient state." The transient state represents the complete output of each of the last tasks of each type within the current process execution. This allows easy reference to the previous task output with `taskInputExpressions`.
    Returns:
      Current state value. Default value is null

  - ### setStrictPaths

    public Process setStrictPaths(Boolean strictPaths)
    If set to true, the process will not allow any intermediate state to be set via `setStateVariable()` that is not explicitly defined first.
    Parameters:
      `strictPaths` - New strictPaths value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls

  - ### getStrictPaths

    public Boolean getStrictPaths()
    If set to true, the process will not allow any intermediate state to be set via `setStateVariable()` that is not explicitly defined first.
    Returns:
      Current strictPaths value. Default value is null

  - ### setTasks

    public Process setTasks(ProcessElement... tasks) throws IllegalStateException
    Convenience form of declaring a single, linear sequence of tasks for this process. Functionally equivalent to providing a one-element `sequences` Array whose first (and only) member is this list.

    If `sequences` is not provided, `process.tasks` becomes the sole sequence. If both are provided, `process.tasks` is inserted as the first sequence, followed by the declared `sequences`.

    Each entry may be:

    - A plain Object, which will be auto-instantiated as a Task or a `StartProcessTask` (wrapping a nested Process) using the heuristic documented on `defaultTaskConstructor` / `defaultProcessConstructor`.
    - An already constructed `ProcessElement` (or subclass) instance.
    Parameters:
      `tasks` - New tasks value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### setTraceContext

    public Process setTraceContext(Map traceContext)
    Context object to be passed to `Process.traceElement()` during process execution.

    Note : This is an advanced setting

    Parameters:
      `traceContext` - New traceContext value. Default value is null
    Returns:
      `Process` instance, for chaining setter calls

  - ### getTraceContext

    public Map getTraceContext()
    Context object to be passed to `Process.traceElement()` during process execution.
    Returns:
      Current traceContext value. Default value is null

  - ### setWizard

    public Process setWizard(Boolean wizard) throws IllegalStateException
    If wizard is set then current workflow will be handled as wizard. Every userTask will hide associated form after user finished step.
    Parameters:
      `wizard` - New wizard value. Default value is false
    Returns:
      `Process` instance, for chaining setter calls
    Throws:
      `IllegalStateException` - this property cannot be changed after the underlying component has been created

  - ### getWizard

    public Boolean getWizard()
    If wizard is set then current workflow will be handled as wizard. Every userTask will hide associated form after user finished step.
    Returns:
      Current wizard value. Default value is false

  - ### afterTaskCommit

    public void afterTaskCommit(Task task, Map outputs)
    Notification hook invoked after a Task's outputs have been committed to state and history recorded, but before routing to the next element. Use for ancillary effects such as logging, metrics, or scheduling background work. This hook cannot veto the commit; to inject validation or replace outputs, use `beforeTaskCommit()`.
    Parameters:
      `task` - The Task that just committed.
      `outputs` - The committed outputs (if any).

  - ### applyStateUpdates

    public void applyStateUpdates(Map stateUpdates)
    Apply the state updates specified by `setStateVariable()` to the process state.

    `stateUpdates` is a mapping from a `setterPath` to a ${TaskInputExpression} or other value.

    `stateUpdates` can declare nested structures, and `TaskInputExpressions` are allowed anywhere in the nested declaration.

                {
                        "currentDS.fields[]" : "$output"
                        "lastCreatedField" : {
                              "fromTask" : "Add Field",
                              "fieldName" : "$output.name"
                        }
                }

    In this example, the output is appended to the "currentDS.fields" array in `state` and an object called "lastCreatedField" is created in `process.state.lastCreatedField`.
    Parameters:
      `stateUpdates` - state updates to apply

  - ### applyStateUpdates

    public void applyStateUpdates(Map stateUpdates, Map inputRecord)
    See `applyStateUpdates()`

  - ### applyStateUpdates

    public void applyStateUpdates(Map stateUpdates, Map inputRecord, Boolean strict)
    Apply the state updates specified by `setStateVariable()` to the process state.

    `stateUpdates` is a mapping from a `setterPath` to a ${TaskInputExpression} or other value.

    `stateUpdates` can declare nested structures, and `TaskInputExpressions` are allowed anywhere in the nested declaration.

                {
                        "currentDS.fields[]" : "$output"
                        "lastCreatedField" : {
                              "fromTask" : "Add Field",
                              "fieldName" : "$output.name"
                        }
                }

    In this example, the output is appended to the "currentDS.fields" array in `state` and an object called "lastCreatedField" is created in `process.state.lastCreatedField`.
    Parameters:
      `stateUpdates` - state updates to apply
      `inputRecord` - record to use as the source for any $input `TaskInputExpression` properties.
      `strict` - if true, the paths must exist in the state to be set. Otherwise, the paths will be created if not existing. Defaults to `process.strictPaths` when null.

  - ### beforeTaskCommit

    public TaskResultModifications beforeTaskCommit(ProcessElement task, Map outputs)
    Override point invoked after a Task completes successfully, but before any of the Task's outputs are committed to `state` and before next-task routing proceeds. Use this to:
    - Inject global validation and force a retry by returning errors.
    - Augment or replace the Task's outputs prior to commit.
    - Apply additional declarative updates to `state`.
    Return a `TaskResultModifications` object to influence commit behavior. If you return nothing, the engine proceeds normally.
    Parameters:
      `task` - The Task or sub-Process that just completed.
      `outputs` - The Task's outputs
    Returns:
      Optional result to modify commit behavior.

  - ### fail

    public void fail(String code)
    Programmatically signal that this Process has hit an infrastructure failure and should terminate through its `failed()` channel rather than completing normally. Recoverable errors that are part of the Process's designed output schema should NOT use this path; model them as fields in `outputDS`.
    Parameters:
      `code` - short identifier, e.g. `"aiUnavailable"`. See `ProcessFailure`.

  - ### fail

    public void fail(String code, String message)
    See `fail()`

  - ### fail

    public void fail(String code, String message, Object cause)
    Programmatically signal that this Process has hit an infrastructure failure and should terminate through its `failed()` channel rather than completing normally. Recoverable errors that are part of the Process's designed output schema should NOT use this path; model them as fields in `outputDS`.
    Parameters:
      `code` - short identifier, e.g. `"aiUnavailable"`. See `ProcessFailure`.
      `message` - human-readable description
      `cause` - optional underlying exception or nested failure

  - ### failed

    public void failed(ProcessFailure failure)
    StringMethod called when a process terminates via an infrastructure failure - for example AI engine unavailable, schema-validation mismatch on input or output, uncaught JS exception, cancellation, or an ancestor-cycle deadlock when invoking a sub-Process. Recoverable errors that are part of the Process's designed output do NOT come through here; they live inside the successful `finished` result.

    See `ProcessFailure` for the shape of the argument.

    Parameters:
      `failure` - the failure record

  - ### addFinishedHandler

    public HandlerRegistration addFinishedHandler(FinishedHandler handler)
    Add a finished handler.

    StringMethod called when a process completes, meaning the process executes a ProcessElement with no next element.

    Handlers declared with a single `(state)` signature remain supported; the second argument is ignored harmlessly for such handlers. Handlers that want the schema-validated result use the two-argument form.

    Specified by:
      `addFinishedHandler` in interface `HasFinishedHandlers`
    Parameters:
      `handler` - the finished handler
    Returns:
      `HandlerRegistration` used to remove this handler

  - ### getComponentReferences

    public String[] getComponentReferences()
    Returns a list of unique global IDs that are referenced by this process.

    List is assembled by calling `ProcessElement.getComponentReferences()` for each task in the workflow and filtering the list to the unique component IDs.

    Returns:
      array of component IDs that are referenced by this process

  - ### getElement

    public ProcessElement getElement(String ID)
    Retrieve a `ProcessElement` by its ID
    Parameters:
      `ID` - id of the process element
    Returns:
      the indicated process element, or null if no such element exists

  - ### getLastTaskOutput

    public Object getLastTaskOutput()
    Returns the task output of the last task executed. More commonly a `TaskInputExpression` property is used (see `ProcessElement.getDynamicValue()`).
    Returns:
      the last task output or null if none is found

  - ### getLastTaskOutput

    public Object getLastTaskOutput(String taskType)
    Returns the task output of the last task executed. More commonly a `TaskInputExpression` property is used (see `ProcessElement.getDynamicValue()`).
    Parameters:
      `taskType` - the optional task type to lookup in last task output
    Returns:
      the last task output or null if none is found

  - ### getOutput

    public Object getOutput()
    Returns the Process's output, computed in this priority order:
    1. The value passed to `setOutput()` if any.
    2. If `outputDS`/`outputFields` are declared: a shallow pick of those field names from `state`.
    3. Otherwise: `state` itself (back-compat).
    Returns:
      the computed output

  - ### getProcessDescription

    public String getProcessDescription()
    Returns the process description as HTML.
    Returns:
      the process description as HTML

  - ### getProcessState

    public Map getProcessState()
    Returns the complete process state for persistence. This includes not just process.state, but execution position and transient data needed to resume the workflow.
    Returns:
      Complete state object with: - state: process.state variables - execution: current execution position - transientData: task outputs that feed into subsequent tasks

  - ### getStateVariable

    public Object getStateVariable(String stateVariablePath)
    Returns a variable value from the `process state`. Values can be written into the process state by `setStateVariable()`, setting `ProcessElement.bindOutput`, or various task output settings (See `TaskIO`.)
    Parameters:
      `stateVariablePath` - path to variable in process state to set. segments are separated by a decimal point (.)
    Returns:
      the value found at the path

  - ### getSuspendInfo

    public Map getSuspendInfo()
    Returns information about why and where the process is suspended.
    Returns:
      Object with reason and taskId, or null if not suspended

  - ### isSuspended

    public Boolean isSuspended()
    Returns true if the process is currently suspended.
    Returns:
      true if suspended

  - ### passThruTaskOutput

    public void passThruTaskOutput(ProcessElement task)
    Takes the `last task output` and sets it as the `task output` for the `task`.

    This method is not just a shortcut to set output of a pass-thru task, but it also records the correct schema of the passed-thru output so it can be quickly looked up.

    Parameters:
      `task` - the workflow task setting the output (i.e. this)

  - ### reset

    public void reset()
    Reset process to its initial state, so process can be started again.

  - ### reset

    public void reset(Record state)
    Reset process to its initial state, so process can be started again.
    Parameters:
      `state` - new state of the process

  - ### restoreFromState

    public void restoreFromState(Map completeState)
    Restores process state from a previously saved complete state and optionally resumes execution.
    Parameters:
      `completeState` - State object from getProcessState()

  - ### restoreFromState

    public void restoreFromState(Map completeState, Boolean resume)
    Restores process state from a previously saved complete state and optionally resumes execution.
    Parameters:
      `completeState` - State object from getProcessState()
      `resume` - If true, immediately resume execution after restore

  - ### resume

    public void resume()
    Resumes a suspended process. If the process was suspended at a HumanTask, the taskOutput should contain the result of the human task completion.

  - ### resume

    public void resume(Map taskOutput)
    Resumes a suspended process. If the process was suspended at a HumanTask, the taskOutput should contain the result of the human task completion.
    Parameters:
      `taskOutput` - Output from the completed async task

  - ### runTask

    public void runTask(String taskID, RunTaskCallback callback, Map priorTaskOutputs, Map state, Map ruleContext)
    Execute a single task in isolation for testing. The process must not already be running. This method invokes the specified task once without advancing the workflow.

    Typically used for automated tests of complex tasks, including those involving AI.

    Providing `priorTaskOutputs` means that `TaskInputExpressions` and other forms of `Task.inputs` declarative inputs will draw from the provided data. For example, $outputs.propertyName used as an expression would refer to the value under `propertyName` in the provided priorTaskOutputs object.

    If `state` is supplied, it is used as the temporary process state for this call (the original state is preserved). If `ruleScope` is supplied, it replaces the normal `ruleScope determination` for this invocation only.

    When the task completes, `callback` (a Callbacks.RunTaskCallback()) is invoked with the task, process, and any outputs the task produced (for example, a CoTTask?s `$outputs`).

    Parameters:
      `taskID` - ID of the task to execute.
      `callback` - Completion callback.
      `priorTaskOutputs` - Optional object to simulate outputs from a prior task (see behavior above).
      `state` - Optional state fixture to use for this call.
      `ruleContext` - Optional override ruleContext for expression evaluation.

  - ### setNextElement

    public void setNextElement()
    Sets the task ID of the next task to execute after the current task finishes. If the task is not found or `null` is passed as the nextElement, the current process will be terminated instead.

  - ### setNextElement

    public void setNextElement(String nextElement)
    Sets the task ID of the next task to execute after the current task finishes. If the task is not found or `null` is passed as the nextElement, the current process will be terminated instead.
    Parameters:
      `nextElement` - ID of the next task execute or null to terminate the process

  - ### setOutput

    public void setOutput(Object output)
    Explicitly set the final output this Process will deliver on successful completion, overriding the default behavior of picking output fields out of `state`. Callable from anywhere during execution; the most recent value wins.
    Parameters:
      `output` - the output value to deliver

  - ### setStateVariable

    public void setStateVariable(String stateVariablePath, Object value)
    Sets a `process state` variable for later reference with `getStateVariable()` or more commonly with a `TaskInputExpression` property.

    The path, which is one or more valid identifiers separated by periods, is used to identify the variable. By appending an empty pair of brackets ([]) the value will be placed into an existing or new array at the specified path.

    Parameters:
      `stateVariablePath` - path to the variable in the process state to set. See `SetterPath`
      `value` - the value to save

  - ### setStateVariable

    public void setStateVariable(String stateVariablePath, Object value, Boolean strict)
    Sets a `process state` variable for later reference with `getStateVariable()` or more commonly with a `TaskInputExpression` property.

    The path, which is one or more valid identifiers separated by periods, is used to identify the variable. By appending an empty pair of brackets ([]) the value will be placed into an existing or new array at the specified path.

    Parameters:
      `stateVariablePath` - path to the variable in the process state to set. See `SetterPath`
      `value` - the value to save
      `strict` - if true, the path must exist in the state to be set. Otherwise, the path will be created if it does not exist. Defaults to `process.strictPaths` when null.

  - ### setTaskOutput

    public void setTaskOutput(ProcessElement task, Object value)
    Sets the task output of `task` in the `process state` so it can be used by later tasks with `getLastTaskOutput()` or more commonly with a `TaskInputExpression` property.

    If the task sets `bindOutput` the output value is also written into that `process state` variable.

    Parameters:
      `task` - the workflow task setting the output (i.e. this)
      `value` - the output value for task

  - ### start

    public void start()
    Starts this task by executing the `startElement`. Also used by asynchronous tasks to restart the workflow.

  - ### suspend

    public void suspend(String reason, String taskId)
    Suspends process execution at the current point. The process state can be retrieved via getProcessState() for persistence.
    Parameters:
      `reason` - Reason for suspension (e.g., "HumanTask", "Timer")
      `taskId` - ID of the task where process is suspended

  - ### addTraceElementHandler

    public HandlerRegistration addTraceElementHandler(TraceElementHandler handler)
    Add a traceElement handler.

    StringMethod called during process execution before each task element is processed.

    Specified by:
      `addTraceElementHandler` in interface `HasTraceElementHandlers`
    Parameters:
      `handler` - the traceElement handler
    Returns:
      `HandlerRegistration` used to remove this handler

  - ### getProcess

    public static Process getProcess(String processId)
    Get a Process instance by its ID.

    Each process instance created that has an `ID` is cached for later lookup by that ID. If two processes have the same ID the last one is cached, overwriting the first. Note that the process instances are not affected - only the cache reference.

    Parameters:
      `processId` - process ID to retrieve. See `Identifier`
    Returns:
      the process, or null if not found
    See Also:
      - `loadProcess(java.lang.String, com.smartgwt.client.callbacks.ProcessCallback)`
      - `Identifier`

  - ### onInit

    protected void onInit()
    Overrides:
      `onInit` in class `BaseClass`

  - ### setAttribute

    public Process setAttribute(String attribute, ProcessElement[] value, boolean allowPostCreate)

  - ### setConfig

    public void setConfig(JavaScriptObject jsObj)
    Overrides:
      `setConfig` in class `BaseClass`

  - ### loadProcess

    public static void loadProcess(String processId, ProcessCallback callback)

  - ### getProcessElements

    public ProcessElement[] getProcessElements(String attribute)

  - ### getElements

    public ProcessElement[] getElements()
    Elements involved in this Process. You can also group elements into `sequences` to reduce the need to explicitly define IDs for elements and interlink them.
    Returns:
      ProcessElement

  - ### getTasks

    public ProcessElement[] getTasks()
    Convenience form of declaring a single, linear sequence of tasks for this process. Functionally equivalent to providing a one-element `sequences` Array whose first (and only) member is this list.
    Returns:
      ProcessElement

  - ### setStartElement

    public void setStartElement(ProcessElement startElement) throws IllegalStateException
    Throws:
      `IllegalStateException`
    See Also:
      - `setStartElement(String)`