Package org.flowable.engine.runtime

# Interface ChangeActivityStateBuilder

public interface ChangeActivityStateBuilder
Helper for changing the state of a process instance. An instance can be obtained through `RuntimeService.createChangeActivityStateBuilder()`.

Author:
  Tijs Rademakers

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `changeState()`
  Start the process instance
  `ChangeActivityStateBuilder`
  `enableEventSubProcessStartEvent(String eventSubProcessStartEventId)`
  Enables a new start event in an event sub process.
  `ChangeActivityStateBuilder`
  `localVariable(String startActivityId, String localVariableName, Object localVariableValue)`
  Sets a local scope variable for a start activity id
  `ChangeActivityStateBuilder`
  `localVariables(String startActivityId, Map<String,Object> localVariables)`
  Sets multiple local scope variables for a start activity id
  `ChangeActivityStateBuilder`
  `moveActivityIdsToSingleActivityId(List<String> currentActivityIds, String newActivityId)`
  Set the activity ids that should be changed to a single activity id.
  `ChangeActivityStateBuilder`
  `moveActivityIdTo(String currentActivityId, String newActivityId)`
  Moves the execution with the current activity id to the provided new activity id
  `ChangeActivityStateBuilder`
  `moveActivityIdToParentActivityId(String currentActivityId, String newActivityId)`
  Moves the execution with the current activity id to an activity id in the parent process instance.
  `ChangeActivityStateBuilder`
  `moveActivityIdToSubProcessInstanceActivityId(String currentActivityId, String newActivityId, String callActivityId)`
  Moves the execution with the current activity id to an activity id in a new sub process instance for the provided call activity id.
  `ChangeActivityStateBuilder`
  `moveActivityIdToSubProcessInstanceActivityId(String currentActivityId, String newActivityId, String callActivityId, Integer subProcessDefinitionVersion)`
  Moves the execution with the current activity id to an activity id in a new sub process instance of the specific definition version for the provided call activity id.
  `ChangeActivityStateBuilder`
  `moveExecutionsToSingleActivityId(List<String> executionIds, String activityId)`
  Set the ids of the executions which should be changed to a single execution with the provided activity id.
  `ChangeActivityStateBuilder`
  `moveExecutionToActivityId(String executionId, String activityId)`
  Set the id of the execution for which the activity should be changed
  `ChangeActivityStateBuilder`
  `moveSingleActivityIdToActivityIds(String currentActivityId, List<String> newActivityIds)`
  Set the activity id that should be changed to multiple activity ids.
  `ChangeActivityStateBuilder`
  `moveSingleExecutionToActivityIds(String executionId, List<String> activityId)`
  Set the id of an execution which should be changed to multiple executions with the provided activity ids.
  `ChangeActivityStateBuilder`
  `processInstanceId(String processInstanceId)`
  Set the id of the process instance
  `ChangeActivityStateBuilder`
  `processVariable(String processVariableName, Object processVariableValue)`
  Sets a process scope variable
  `ChangeActivityStateBuilder`
  `processVariables(Map<String,Object> processVariables)`
  Sets multiple process scope variables

- ## Method Details

  - ### processInstanceId

    ChangeActivityStateBuilder processInstanceId(String processInstanceId)
    Set the id of the process instance

  - ### moveExecutionToActivityId

    ChangeActivityStateBuilder moveExecutionToActivityId(String executionId, String activityId)
    Set the id of the execution for which the activity should be changed

  - ### moveExecutionsToSingleActivityId

    ChangeActivityStateBuilder moveExecutionsToSingleActivityId(List<String> executionIds, String activityId)
    Set the ids of the executions which should be changed to a single execution with the provided activity id. This can be used for parallel execution like parallel/inclusive gateways, multiinstance, event sub processes etc.

  - ### moveSingleExecutionToActivityIds

    ChangeActivityStateBuilder moveSingleExecutionToActivityIds(String executionId, List<String> activityId)
    Set the id of an execution which should be changed to multiple executions with the provided activity ids. This can be used for parallel execution like parallel/inclusive gateways, multiinstance, event sub processes etc.

  - ### moveActivityIdTo

    ChangeActivityStateBuilder moveActivityIdTo(String currentActivityId, String newActivityId)
    Moves the execution with the current activity id to the provided new activity id

  - ### moveActivityIdsToSingleActivityId

    ChangeActivityStateBuilder moveActivityIdsToSingleActivityId(List<String> currentActivityIds, String newActivityId)
    Set the activity ids that should be changed to a single activity id. This can be used for parallel execution like parallel/inclusive gateways, multiinstance, event sub processes etc.

  - ### moveSingleActivityIdToActivityIds

    ChangeActivityStateBuilder moveSingleActivityIdToActivityIds(String currentActivityId, List<String> newActivityIds)
    Set the activity id that should be changed to multiple activity ids. This can be used for parallel execution like parallel/inclusive gateways, multiinstance, event sub processes etc.

  - ### moveActivityIdToParentActivityId

    ChangeActivityStateBuilder moveActivityIdToParentActivityId(String currentActivityId, String newActivityId)
    Moves the execution with the current activity id to an activity id in the parent process instance. The sub process instance will be terminated, so all sub process instance executions need to be moved.

  - ### moveActivityIdToSubProcessInstanceActivityId

    ChangeActivityStateBuilder moveActivityIdToSubProcessInstanceActivityId(String currentActivityId, String newActivityId, String callActivityId)
    Moves the execution with the current activity id to an activity id in a new sub process instance for the provided call activity id.

  - ### moveActivityIdToSubProcessInstanceActivityId

    ChangeActivityStateBuilder moveActivityIdToSubProcessInstanceActivityId(String currentActivityId, String newActivityId, String callActivityId, Integer subProcessDefinitionVersion)
    Moves the execution with the current activity id to an activity id in a new sub process instance of the specific definition version for the provided call activity id.

  - ### enableEventSubProcessStartEvent

    ChangeActivityStateBuilder enableEventSubProcessStartEvent(String eventSubProcessStartEventId)
    Enables a new start event in an event sub process.

  - ### processVariable

    ChangeActivityStateBuilder processVariable(String processVariableName, Object processVariableValue)
    Sets a process scope variable

  - ### processVariables

    ChangeActivityStateBuilder processVariables(Map<String,Object> processVariables)
    Sets multiple process scope variables

  - ### localVariable

    ChangeActivityStateBuilder localVariable(String startActivityId, String localVariableName, Object localVariableValue)
    Sets a local scope variable for a start activity id

  - ### localVariables

    ChangeActivityStateBuilder localVariables(String startActivityId, Map<String,Object> localVariables)
    Sets multiple local scope variables for a start activity id

  - ### changeState

    void changeState()
    Start the process instance
    Throws:
      `FlowableObjectNotFoundException` - when no process instance is found
      `FlowableException` - activity could not be canceled or started