Package com.orchestranetworks.workflow

# Interface ProcessInstance

public interface ProcessInstance
Represents a workflow and provides related information.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Date`
  `getCreationDate()`
  Returns the creation date of this workflow.
  `UserReference`
  `getCreator()`
  Returns the user that created this workflow.
  `List<ProcessInstance>`
  `getCurrentSubWorkflows()`
  Returns the list of the current sub-workflows; if no current sub-workflows exist, returns an empty list.
  `DataContextReadOnly`
  `getDataContext()`
  Returns the data context of this workflow.
  `UserMessage`
  `getDescription()`
  Returns the description of this workflow.
  `UserMessage`
  `getLabel()`
  Returns the label of this workflow.
  `Date`
  `getLastModificationDate()`
  Returns the last modified date of this workflow.
  `ProcessInstanceKey`
  `getParentKey()`
  Returns the parent of the sub-workflow if the process instance is a sub-workflow, otherwise returns `null`.
  `Integer`
  `getPriority()`
  Returns the current priority of this workflow if defined, otherwise returns `null`.
  `Integer`
  `getPriorityOrDefaultPriority()`
  Returns the current priority of this workflow or the default priority if defined, else `null`.
  `ProcessInstanceKey`
  `getProcessInstanceKey()`
  Returns the identifier of this workflow.
  `PublishedProcessKey`
  `getPublishProcessKey()`
  Returns the identifier of the associated workflow publication.
  `String`
  `getSubWorkflowName()`
  Returns the identifier of a sub-workflow in the case of a dynamic sub-workflow invocation.
  `List<ProcessInstance>`
  `getSubWorkflows()`
  Returns the list of all the sub-workflows (past or current) of this workflow; if no sub-workflows exist, returns an empty list.
  `List<UserTask.WorkItem>`
  `getWorkItems()`
  Returns the list of the current work items if this workflow is currently executing a user task.
  `boolean`
  `isCompleted()`
  Returns `true` if this workflow is completed, returns `false` otherwise.
  `boolean`
  `isInError()`
  Returns `true` if this workflow has errors, otherwise returns `false`.
  `boolean`
  `isSubWorkflow()`
  Returns `true` if the process instance is a sub-workflow, otherwise returns `false`.

- ## Method Details

  - ### getProcessInstanceKey

    ProcessInstanceKey getProcessInstanceKey()
    Returns the identifier of this workflow.

  - ### getPublishProcessKey

    PublishedProcessKey getPublishProcessKey()
    Returns the identifier of the associated workflow publication.

    In the case of a sub-workflow, this method returns the key of the publication associated with the main workflow.

  - ### getLabel

    UserMessage getLabel()
    Returns the label of this workflow.

  - ### getDescription

    UserMessage getDescription()
    Returns the description of this workflow.

  - ### getCreator

    UserReference getCreator()
    Returns the user that created this workflow.

  - ### getCreationDate

    Date getCreationDate()
    Returns the creation date of this workflow.

  - ### getLastModificationDate

    Date getLastModificationDate()
    Returns the last modified date of this workflow.

  - ### getPriority

    Integer getPriority()
    Returns the current priority of this workflow if defined, otherwise returns `null`.

  - ### getPriorityOrDefaultPriority

    Integer getPriorityOrDefaultPriority()
    Returns the current priority of this workflow or the default priority if defined, else `null`.

  - ### isCompleted

    boolean isCompleted()
    Returns `true` if this workflow is completed, returns `false` otherwise.

  - ### isInError

    boolean isInError()
    Returns `true` if this workflow has errors, otherwise returns `false`.
    Since:
      5.4.1

  - ### getWorkItems

    List<UserTask.WorkItem> getWorkItems()
    Returns the list of the current work items if this workflow is currently executing a user task.

    If this workflow is complete, or the current step is not a user task, this method returns an empty list.

    Returns:
      a `List` of `UserTask.WorkItem`.

  - ### getDataContext

    DataContextReadOnly getDataContext()
    Returns the data context of this workflow.

  - ### getSubWorkflows

    List<ProcessInstance> getSubWorkflows()
    Returns the list of all the sub-workflows (past or current) of this workflow; if no sub-workflows exist, returns an empty list.

    The returned sub-workflows may be active or completed (@link `isCompleted()`.

    Returns:
      a `List` of `ProcessInstance`.
    Since:
      5.5.0

  - ### getCurrentSubWorkflows

    List<ProcessInstance> getCurrentSubWorkflows()
    Returns the list of the current sub-workflows; if no current sub-workflows exist, returns an empty list.

    The current sub-workflows are the sub-workflows for which the workflow is waiting; this is to say the sub-workflows matching with the current sub-workflows invocation step.

    The returned sub-workflows may be active or completed (@link `isCompleted()`.

    Returns:
      a `List` of `ProcessInstance`.
    Since:
      5.5.0

  - ### getSubWorkflowName

    String getSubWorkflowName()
    Returns the identifier of a sub-workflow in the case of a dynamic sub-workflow invocation.
    Since:
      5.5.0

  - ### getParentKey

    ProcessInstanceKey getParentKey()
    Returns the parent of the sub-workflow if the process instance is a sub-workflow, otherwise returns `null`.
    Since:
      5.5.0
    See Also:
      - `isSubWorkflow()`

  - ### isSubWorkflow

    boolean isSubWorkflow()
    Returns `true` if the process instance is a sub-workflow, otherwise returns `false`.
    Since:
      5.5.0