com.ibm.openpages.api.workflow

## Interface IWFProcessDefinition

- All Superinterfaces:
    java.lang.Cloneable

      public interface IWFProcessDefinition
      extends java.lang.Cloneable

  Represents workflow process definition.

  Lifecycle of process definition - When a process definition is created, the state of the definition is initially on `WFProcessDefinitionState.draft`. Users are not able to start the workflow until the process definition is published by `IWorkflowService.publishProcessDefinition(Id)`. The published process definition is immutable and every published process definition is versioned. When a process definition is updated by `IWorkflowService.updateProcessDefinition(IWFProcessDefinition)`, it creates new draft version behind the scene ( or update the draft version if a draft already exists ). When you publish a process definition, the draft content of the definition becomes published one, and previous published one is marked `WFProcessDefinitionState.expired`. You can still fetch specific expired version content by `IWorkflowService.getProcessDefinitionByVersionId(Id)` and inflight workflow/process instance remains on the original version of process definition.

  The process is instantiated by an object creation ( when the type is {@link WFProcessDefinitionType#create ), or by user operation/API call against existing object, and the behavior of the process is defined here.

  Since:
    8.0.0.2

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addActivity(IWFActivity activity)` Adds an activity
    `IWFProcessDefinition` | `clone()` Returns a cloned instance.
    `java.util.List<IWFActivity>` | `getActivities()` Returns the list of activities.
    `IWFActivity` | `getActivity(Id id)` Returns the activity by the activity ID.
    `IWFActivity` | `getActivity(java.lang.String name)` Returns the activity by the activity name.
    `java.lang.Object` | `getAttribute(java.lang.String name)` Returns the process attribute by a name string.
    `java.util.Map<java.lang.String,java.lang.Object>` | `getAttributes()` Returns the map of process attributes.
    `IWFConditionEval` | `getCondition()` Returns the workflow condition.
    `java.lang.String` | `getCreatedBy()` Returns the user name who created the process definition
    `java.util.Date` | `getCreatedDate()` Returns the creation date
    `Id` | `getId()` Returns unique identifier of the process definition
    `int` | `getLatestVersionNumber()` Returns version number of the latest process definition.
    `WFProcessDefinitionState` | `getLatestVersionState()` Returns the state of the latest process definition.
    `java.lang.String` | `getModifiedBy()` Returns the user name who last modified the process definition
    `java.util.Date` | `getModifiedDate()` Returns the last modified date
    `java.lang.String` | `getName()` Returns name of the process definition
    `java.lang.String` | `getNameLabel()` Returns the localized name label of the process definition for the user session
    `java.util.List<ILabel>` | `getNameLabels()` Returns the process definition name labels for all locales
    `java.lang.String` | `getObjectType()` Returns the object type name.
    `ISchedJobDetail` | `getSchedJobDetail()`
    `IWFActivity` | `getStartActivity()` Returns the starting activity.
    `WFProcessDefinitionState` | `getState()` Returns the state of the process definition.
    `WFProcessDefinitionType` | `getType()` Returns the type of the process definition.
    `Id` | `getVersionId()` Returns version id of the process definition.
    `int` | `getVersionNumber()` Returns version number of the process definition.
    `boolean` | `isAutomated()` Returns if the workflow is automated.
    `boolean` | `isEnabled()` Returns if the process definition is enabled or not.
    `boolean` | `isExecuteAsSystem()` Returns whether the workflow should be run as a system user
    `boolean` | `isObjectInstanceReadOnly()` Returns if the process definition is read only.
    `void` | `removeActivity(java.lang.String name)` Removes an activity by name
    `void` | `setActivities(java.util.List<IWFActivity> activities)` Sets the list of activities.
    `void` | `setAttribute(java.lang.String name, java.lang.Object value)` Sets the process attribute by a name string.
    `void` | `setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)` Sets the map of process attributes.
    `void` | `setAutomated(boolean isAutomated)` Sets this as an automated workflow which can only contain automated stages.
    `void` | `setCondition(IWFConditionEval condition)` Sets the workflow condition.
    `void` | `setEnabled(boolean isEnabled)` Enables or disables the process definition.
    `void` | `setExecuteAsSystem(boolean executeAsSystem)` Sets whether the workflow should be run as a system user
    `void` | `setNameLabels(java.util.List<ILabel> nameLabels)` Sets the list of process definition name labels
    `void` | `setSchedJobDetail(ISchedJobDetail schedJobDetail)`
    `void` | `setType(WFProcessDefinitionType type)` Sets the type of the process definition.

- - ### Method Detail

    - #### getId

          Id getId()

      Returns unique identifier of the process definition
      Returns:

    - #### getVersionId

          Id getVersionId()

      Returns version id of the process definition. It is incremented when the process definition is published.
      Returns:

    - #### getVersionNumber

          int getVersionNumber()

      Returns version number of the process definition. It is incremented when the process definition is published.
      Returns:

    - #### getLatestVersionNumber

          int getLatestVersionNumber()

      Returns version number of the latest process definition.
      Returns:

    - #### getName

          java.lang.String getName()

      Returns name of the process definition
      Returns:

    - #### getNameLabel

          java.lang.String getNameLabel()

      Returns the localized name label of the process definition for the user session
      Returns:
        the localized name label as a string

    - #### getNameLabels

          java.util.List<ILabel> getNameLabels()

      Returns the process definition name labels for all locales
      Returns:
        `ILabel` the process definition name label

    - #### setNameLabels

          void setNameLabels(java.util.List<ILabel> nameLabels)

      Sets the list of process definition name labels
      Parameters:
        `nameLabels` - the list of `ILabel`

    - #### getSchedJobDetail

          ISchedJobDetail getSchedJobDetail()

    - #### setSchedJobDetail

          void setSchedJobDetail(ISchedJobDetail schedJobDetail)

    - #### getType

          WFProcessDefinitionType getType()

      Returns the type of the process definition. Refer `WFProcessDefinitionType`
      Returns:

    - #### setType

          void setType(WFProcessDefinitionType type)

      Sets the type of the process definition. Cannot be null.
      Parameters:
        `type` -

    - #### getState

          WFProcessDefinitionState getState()

      Returns the state of the process definition. Refer `WFProcessDefinitionState`
      Returns:

    - #### getLatestVersionState

          WFProcessDefinitionState getLatestVersionState()

      Returns the state of the latest process definition. Refer `WFProcessDefinitionState` Useful to understand if there's currently a Draft version.
      Returns:

    - #### getObjectType

          java.lang.String getObjectType()

      Returns the object type name.
      Returns:

    - #### getAttributes

          java.util.Map<java.lang.String,java.lang.Object> getAttributes()

      Returns the map of process attributes. The process attributes can be used by the transition/activity actions.
      Returns:

    - #### setAttributes

          void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)

      Sets the map of process attributes.
      Parameters:
        `attributes` -

    - #### getAttribute

          java.lang.Object getAttribute(java.lang.String name)

      Returns the process attribute by a name string.
      Parameters:
        `name` -
      Returns:

    - #### setAttribute

          void setAttribute(java.lang.String name,
                            java.lang.Object value)

      Sets the process attribute by a name string.
      Parameters:
        `name` -
        `value` -

    - #### getCondition

          IWFConditionEval getCondition()

      Returns the workflow condition. The condition is evaluated to determine whether to start the workflow during an object creation. It is applicable when the process definition type is `WFProcessDefinitionType.create`.
      Returns:

    - #### setCondition

          void setCondition(IWFConditionEval condition)

      Sets the workflow condition.

    - #### isAutomated

          boolean isAutomated()

      Returns if the workflow is automated.
      Returns:

    - #### setAutomated

          void setAutomated(boolean isAutomated)

      Sets this as an automated workflow which can only contain automated stages.
      Parameters:
        `isAutomated` -

    - #### isEnabled

          boolean isEnabled()

      Returns if the process definition is enabled or not. The process can be instanciated only when it is enabled.
      Returns:

    - #### setEnabled

          void setEnabled(boolean isEnabled)

      Enables or disables the process definition.
      Parameters:
        `isEnabled` -

    - #### getModifiedDate

          java.util.Date getModifiedDate()

      Returns the last modified date
      Returns:

    - #### getModifiedBy

          java.lang.String getModifiedBy()

      Returns the user name who last modified the process definition
      Returns:

    - #### getCreatedDate

          java.util.Date getCreatedDate()

      Returns the creation date
      Returns:

    - #### getCreatedBy

          java.lang.String getCreatedBy()

      Returns the user name who created the process definition
      Returns:

    - #### isExecuteAsSystem

          boolean isExecuteAsSystem()

      Returns whether the workflow should be run as a system user
      Returns:

    - #### setExecuteAsSystem

          void setExecuteAsSystem(boolean executeAsSystem)

      Sets whether the workflow should be run as a system user
      Parameters:
        `executeAsSystem` -

    - #### getActivities

          java.util.List<IWFActivity> getActivities()

      Returns the list of activities. Refer `IWFActivity`
      Returns:

    - #### setActivities

          void setActivities(java.util.List<IWFActivity> activities)

      Sets the list of activities.
      Parameters:
        `activities` -

    - #### getActivity

          IWFActivity getActivity(java.lang.String name)

      Returns the activity by the activity name. Returns null when there is no matching activity.

    - #### getActivity

          IWFActivity getActivity(Id id)

      Returns the activity by the activity ID. Returns null when there is no matching activity.
      Parameters:
        `id` -
      Returns:

    - #### getStartActivity

          IWFActivity getStartActivity()

      Returns the starting activity.
      Returns:

    - #### addActivity

          void addActivity(IWFActivity activity)

      Adds an activity
      Parameters:
        `activity` -

    - #### removeActivity

          void removeActivity(java.lang.String name)

      Removes an activity by name
      Parameters:
        `name` -

    - #### isObjectInstanceReadOnly

          boolean isObjectInstanceReadOnly()

      Returns if the process definition is read only. Use the cloned instance for updating.
      Returns:

    - #### clone

          IWFProcessDefinition clone()

      Returns a cloned instance. The `isObjectInstanceReadOnly()` of the cloned instance is always false.
      Returns:

Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2021. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.