org.camunda.bpm.engine.impl.cmmn.execution
Interface CmmnActivityExecution

All Superinterfaces:
BaseDelegateExecution, CmmnModelExecutionContext, DelegateCaseExecution, ProcessEngineServicesAware, VariableScope
All Known Subinterfaces:
CmmnCaseInstance
All Known Implementing Classes:
CaseExecutionEntity, CaseExecutionImpl, CmmnExecution

public interface CmmnActivityExecution
extends DelegateCaseExecution

Author:
Roman Smirnov

Method Summary
 void close()
          Transition to CaseExecutionState.CLOSED state when no further work or modifications should be allowed for this case instance.
 void complete()
          Transition to CaseExecutionState.COMPLETED state.
 List<CmmnExecution> createChildExecutions(List<CmmnActivity> activities)
          Creates new child case executions for each given CmmnActivity.
 void createSentryParts()
          Creates for each defined PlanItemOnPart and IfPart inside the specified Sentries a CmmnSentryPart.
 CmmnCaseInstance createSubCaseInstance(CmmnCaseDefinition caseDefinition)
          Creates a new sub case instance.
 CmmnCaseInstance createSubCaseInstance(CmmnCaseDefinition caseDefinition, String businessKey)
          Creates a new sub case instance.
 PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition)
          Creates a new sub process instance.
 PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey)
          Creates a new sub process instance.
 PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey, String caseInstanceId)
          Creates a new sub process instance.
 Task createTask(TaskDecorator taskDecorator)
          Creates a new task.
 void disable()
          Transition to state.
 void enable()
          Transition to CaseExecutionState.ENABLED state.
 void exit()
          Transition to CaseExecutionState.TERMINATING_ON_EXIT state.
 CmmnActivity getActivity()
          Returns the activity which is associated with this case execution.
 List<? extends CmmnExecution> getCaseExecutions()
          Returns a List of child case executions.
 CaseExecutionState getCurrentState()
          Returns the current state of this case execution.
 CmmnActivityExecution getParent()
          Returns the parent of this case execution, or null if there is no parent.
 CaseExecutionState getPreviousState()
          Returns the previous state of this case execution.
 boolean isCaseInstanceExecution()
          Returns true if this case execution is a case instance.
 boolean isNew()
          Returns true iff:
getCurrentState() == CaseExecutionState.NEW
 boolean isRequired()
          Returns to true, if this case execution is required.
 boolean isSentrySatisfied(String sentryId)
          Returns true, if each CmmnSentryPart of the given sentryId is satisfied.
 boolean isSuspending()
          Returns true iff:
getCurrentState() == CaseExecutionState.SUSPENDING_ON_SUSPENSION || getCurrentState() == CaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION
 boolean isTerminating()
          Returns true iff:
getCurrentState() == CaseExecutionState.TERMINATING_ON_TERMINATION || getCurrentState() == CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION || getCurrentState() == CaseExecutionState.TERMINATING_ON_EXIT
 void manualComplete()
          Transition to CaseExecutionState.COMPLETED state.
 void manualStart()
          Transition to CaseExecutionState.ACTIVE state.
 void occur()
          Transition to CaseExecutionState.COMPLETED state.
 void parentResume()
          Transition to the previous state (CaseExecutionState.AVAILABLE, CaseExecutionState.ENABLED, CaseExecutionState.DISABLED or CaseExecutionState.ACTIVE) when the parent Stage transitions out of CaseExecutionState.SUSPENDED.
 void parentSuspend()
          Transition to CaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION state.
 void parentTerminate()
          Transition to CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION state.
 void performExit()
          Transition to CaseExecutionState.TERMINATED state.
 void performParentSuspension()
          Transition to CaseExecutionState.SUSPENDED state.
 void performParentTerminate()
          Transition to CaseExecutionState.TERMINATED state.
 void performSuspension()
          Transition to CaseExecutionState.SUSPENDED state.
 void performTerminate()
          Transition to CaseExecutionState.TERMINATED state.
 void reactivate()
          Transition to CaseExecutionState.ACTIVE state.
 void reenable()
          Transition to CaseExecutionState.ENABLED state.
 void remove()
          Removes this case execution from the parent case execution.
 void resume()
          Transition to either to CaseExecutionState.ACTIVE state, if this case execution is associated with a Stage or Task, or to CaseExecutionState#AVAILABE, if this case execution is associated with a EventListener or Milestone.
 void setCurrentState(CaseExecutionState currentState)
          Sets the given state as the current state of this case execution.
 void setRequired(boolean required)
          Sets this case execution as required or not required.
 void start()
          Transition to CaseExecutionState.ACTIVE state.
 void suspend()
          Transition to CaseExecutionState.SUSPENDING_ON_SUSPENSION state.
 void terminate()
          Transition to CaseExecutionState.TERMINATING_ON_TERMINATION state.
 void triggerChildExecutionsLifecycle(List<CmmnExecution> children)
          This method triggers for each given case execution the lifecycle.
 
Methods inherited from interface org.camunda.bpm.engine.delegate.DelegateCaseExecution
getActivityId, getActivityName, getCaseBusinessKey, getCaseDefinitionId, getCaseInstanceId, getEventName, getId, getParentId, isActive, isAvailable, isClosed, isCompleted, isDisabled, isEnabled, isFailed, isSuspended, isTerminated
 
Methods inherited from interface org.camunda.bpm.engine.delegate.BaseDelegateExecution
getBusinessKey
 
Methods inherited from interface org.camunda.bpm.engine.delegate.VariableScope
getVariable, getVariableLocal, getVariableLocalTyped, getVariableLocalTyped, getVariableNames, getVariableNamesLocal, getVariables, getVariableScopeKey, getVariablesLocal, getVariablesLocalTyped, getVariablesLocalTyped, getVariablesTyped, getVariablesTyped, getVariableTyped, getVariableTyped, hasVariable, hasVariableLocal, hasVariables, hasVariablesLocal, removeVariable, removeVariableLocal, removeVariables, removeVariables, removeVariablesLocal, removeVariablesLocal, setVariable, setVariableLocal, setVariables, setVariablesLocal
 
Methods inherited from interface org.camunda.bpm.engine.delegate.ProcessEngineServicesAware
getProcessEngineServices
 
Methods inherited from interface org.camunda.bpm.engine.delegate.CmmnModelExecutionContext
getCmmnModelElementInstance, getCmmnModelInstance
 

Method Detail

getParent

CmmnActivityExecution getParent()

Returns the parent of this case execution, or null if there is no parent.

Returns:
a parent or null.

isCaseInstanceExecution

boolean isCaseInstanceExecution()

Returns true if this case execution is a case instance. If this case execution is not a case instance then false will be returned.

Returns:
whether this case execution is a case instance or not.

getCurrentState

CaseExecutionState getCurrentState()

Returns the current state of this case execution.

Returns:
the current state

setCurrentState

void setCurrentState(CaseExecutionState currentState)

Sets the given state as the current state of this case execution.

Parameters:
currentState - the current state to set

getPreviousState

CaseExecutionState getPreviousState()

Returns the previous state of this case execution.

Returns:
the previous state

isNew

boolean isNew()

Returns true iff:
getCurrentState() == CaseExecutionState.NEW

Returns:
whether this case execution has as current state CaseExecutionState.NEW

isTerminating

boolean isTerminating()

Returns true iff:
getCurrentState() == CaseExecutionState.TERMINATING_ON_TERMINATION || getCurrentState() == CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION || getCurrentState() == CaseExecutionState.TERMINATING_ON_EXIT

Returns:
whether this case execution has as current state CaseExecutionState.TERMINATING_ON_TERMINATION, CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION or CaseExecutionState.TERMINATING_ON_EXIT

isSuspending

boolean isSuspending()

Returns true iff:
getCurrentState() == CaseExecutionState.SUSPENDING_ON_SUSPENSION || getCurrentState() == CaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION

Returns:
whether this case execution has as current state CaseExecutionState.SUSPENDING_ON_SUSPENSION or CaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION

getActivity

CmmnActivity getActivity()

Returns the activity which is associated with this case execution.

Returns:
the associated activity

createChildExecutions

List<CmmnExecution> createChildExecutions(List<CmmnActivity> activities)

Creates new child case executions for each given CmmnActivity.

Afterwards the method triggerChildExecutionsLifecycle(List) must be called to execute each created case executions (ie. the create listener will be notified etc.).

According to the CMMN 1.0 specification:
This method can be called when this case execution (which represents a Stage) transitions to ACTIVE state. The passed collection of activities are the planned items that should be executed in this Stage. So that for each given CmmnActivity a new case execution will be instantiated. Furthermore for each created child execution there happens a transition to the initial state AVAILABLE.

Parameters:
activities - a collection of activities of planned items to execute inside this case execution

triggerChildExecutionsLifecycle

void triggerChildExecutionsLifecycle(List<CmmnExecution> children)

This method triggers for each given case execution the lifecycle.

This method must be called after createChildExecutions(List).

Parameters:
children - a collection of case execution to trigger for each given case execution the lifecycle

enable

void enable()

Transition to CaseExecutionState.ENABLED state.

This case execution must be in CaseExecutionState.AVAILABLE state to be able to do this transition.

It is only possible to enable a case execution which is associated with a Stage or Task.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.AVAILABLE.
ProcessEngineException - when an internal exception happens during the execution of the command.

disable

void disable()

Transition to state.

This case execution must be in CaseExecutionState.ENABLED state to be able to do this transition.

It is only possible to disable a case execution which is associated with a Stage or Task.

If this case execution has a parent case execution, that parent case execution will be notified that this case execution has been disabled. This can lead to a completion of the parent case execution, for more details when the parent case execution can be completed see complete().

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.ENABLED.
ProcessEngineException - when an internal exception happens during the execution of the command.

reenable

void reenable()

Transition to CaseExecutionState.ENABLED state.

This case execution must be in CaseExecutionState.DISABLED state to be able to do this transition.

It is only possible to re-enable a case execution which is associated with a Stage or Task.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.DISABLED.
ProcessEngineException - when an internal exception happens during the execution of the command.

manualStart

void manualStart()

Transition to CaseExecutionState.ACTIVE state.

This case execution must be in CaseExecutionState.ENABLED state to be able to do this transition.

It is only possible to start a case execution manually which is associated with a Stage or Task.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.ENABLED.
ProcessEngineException - when an internal exception happens during the execution of the command.

start

void start()

Transition to CaseExecutionState.ACTIVE state.

This case execution must be in CaseExecutionState.AVAILABLE state to be able to do this transition.

It is only possible to start a case execution which is associated with a Stage or Task.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.AVAILABLE.
ProcessEngineException - when an internal exception happens during the execution of the command.

complete

void complete()

Transition to CaseExecutionState.COMPLETED state.

This case execution must be in CaseExecutionState.ACTIVE state to be able to do this transition.

It is only possible to complete a case execution which is associated with a Stage or Task.

If this case execution has a parent case execution, that parent case execution will be notified that this case execution has been completed. This can lead to a completion of the parent case execution, for more details when the parent case execution can be completed see complete().

In case of a Stage the completion can only be performed when the following criteria are fulfilled:

For a Task instance, this means its purpose has been accomplished:

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.ACTIVE or when the case execution cannot be completed.
ProcessEngineException - when an internal exception happens during the execution of the command.

manualComplete

void manualComplete()

Transition to CaseExecutionState.COMPLETED state.

This case execution must be in CaseExecutionState.ACTIVE state to be able to do this transition.

It is only possible to complete a case execution manually which is associated with a Stage or Task.

If this case execution has a parent case execution, that parent case execution will be notified that this case execution has been completed. This can lead to a completion of the parent case execution, for more details when the parent case execution can be completed see complete().

In case of a Stage the completion can only be performed when the following criteria are fulfilled:

For a Task instance, this means its purpose has been accomplished:

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.ACTIVE or when the case execution cannot be completed.
ProcessEngineException - when an internal exception happens during the execution of the command.

occur

void occur()

Transition to CaseExecutionState.COMPLETED state.

This case execution must be in CaseExecutionState.AVAILABLE state to be able to do this transition.

For event listener transitions when the event being listened by the event listener instance does occur. For a user event listener instance this transition happens when a human decides to raise the event.

For Milestone instance transitions when one of the achieving sentries (entry criteria) is satisfied.

If this case execution has a parent case execution, that parent case execution will be notified that this case execution has been completed (ie.the event or milestone occured). This can lead to a completion of the parent case execution, for more details when the parent case execution can be completed see complete().

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not CaseExecutionState.AVAILABLE.
ProcessEngineException - when an internal exception happens during the execution of the command.

terminate

void terminate()

Transition to CaseExecutionState.TERMINATING_ON_TERMINATION state.

If this case execution is associated with a Stage or Task, then this case execution must be in CaseExecutionState.ACTIVE state to be able to do this transition.
And if this case execution is association with EventListener or a Milestone, then this case execution must be in CaseExecutionState.AVAILABLE state to be able to do this transition.

For a Stage instance the termination of this case execution will be propagated down to all its contained EventListener, Milestone, Stage, and Task instances.

In case of a Stage this corresponding case execution stays in this state until all children notified this case execution, that they terminated successfully. Afterwards the method performTerminate() must be called to complete the transition into the state CaseExecutionState.TERMINATED.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

performTerminate

void performTerminate()

Transition to CaseExecutionState.TERMINATED state.

If this case execution has a parent case execution, that parent case execution will be notified that this case execution has been terminated. This can lead to a completion of the parent case execution, for more details when the parent case execution can be completed see complete().

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

parentTerminate

void parentTerminate()

Transition to CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION state.

This case execution must be in CaseExecutionState.AVAILABLE or CaseExecutionState.SUSPENDED state to be able to do this transition.

It is only possible to execute a parent termination on a case execution which is associated with a EventListener or Milestone.

Afterwards the method performParentTerminate() must be called to complete the transition into the state CaseExecutionState.TERMINATED.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

performParentTerminate

void performParentTerminate()

Transition to CaseExecutionState.TERMINATED state.

This case execution must be in CaseExecutionState.AVAILABLE or CaseExecutionState.SUSPENDED state to be able to do this transition.

It is only possible to execute a parent termination on a case execution which is associated with a EventListener or Milestone.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

exit

void exit()

Transition to CaseExecutionState.TERMINATING_ON_EXIT state.

This case execution must be in one of the following state to be able to do this transition:

It is only possible to execute an exit on a case execution which is associated with a Stage or Task.

Afterwards the method performExit() must be called to complete the transition into the state CaseExecutionState.TERMINATED.

If this transition is triggered by a fulfilled exit criteria and if this case execution has a parent case execution, that parent case execution will be notified that this case execution has been terminated. This can lead to a completion of the parent case execution, for more details when the parent case execution can be completed see complete().

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

performExit

void performExit()

Transition to CaseExecutionState.TERMINATED state.

This can lead to a completion of the parent case execution, for more details when the parent case execution can be completed see complete().

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

suspend

void suspend()

Transition to CaseExecutionState.SUSPENDING_ON_SUSPENSION state.

If this case execution is associated with a Stage or Task, then this case execution must be in CaseExecutionState.ACTIVE state to be able to do this transition.
And if this case execution is association with EventListener or a Milestone, then this case execution must be in CaseExecutionState.AVAILABLE state to be able to do this transition.

For a Stage instance the suspension of this case execution will be propagated down to all its contained EventListener, Milestone, Stage, and Task instances.

Afterwards the method performSuspension() must be called to complete the transition into the state CaseExecutionState.SUSPENDED.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

performSuspension

void performSuspension()

Transition to CaseExecutionState.SUSPENDED state.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

parentSuspend

void parentSuspend()

Transition to CaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION state.

This case execution must be in one of the following state to be able to do this transition:

It is only possible to execute a parent suspension on a case execution which is associated with a Stage or Task.

Afterwards the method performParentSuspension() must be called to complete the transition into the state CaseExecutionState.SUSPENDED.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

performParentSuspension

void performParentSuspension()

Transition to CaseExecutionState.SUSPENDED state.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

resume

void resume()

Transition to either to CaseExecutionState.ACTIVE state, if this case execution is associated with a Stage or Task, or to CaseExecutionState#AVAILABE, if this case execution is associated with a EventListener or Milestone.

This case execution must be in CaseExecutionState.SUSPENDED state to be able to do this transition.

For a Stage instance the resume of this case execution will be propagated down to all its contained EventListener, Milestone, Stage, and Task instances.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

parentResume

void parentResume()

Transition to the previous state (CaseExecutionState.AVAILABLE, CaseExecutionState.ENABLED, CaseExecutionState.DISABLED or CaseExecutionState.ACTIVE) when the parent Stage transitions out of CaseExecutionState.SUSPENDED.

This case execution must be in CaseExecutionState.SUSPENDED state to be able to do this transition.

It is only possible to execute a parent resume on a case execution which is associated with a Stage or Task.

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

reactivate

void reactivate()

Transition to CaseExecutionState.ACTIVE state.

If this case execution is associated with a Stage or Task and is not a case instance, then this case execution must be in CaseExecutionState.FAILED state to be able to do this transition.
And if this case execution is a case instance, then this case instance must be in one of the following state to perform this transition:

In case of a case instance the transition out of CaseExecutionState.SUSPENDED state the resume will be propagated down to all its contained EventListener, Milestone, Stage, and Task instances, see resume() and parentResume().

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

close

void close()

Transition to CaseExecutionState.CLOSED state when no further work or modifications should be allowed for this case instance.

It is only possible to close a case instance which is in one of the following states:

Throws:
CaseIllegalStateTransitionException - will be thrown, if this case execution is not in the expected state.
ProcessEngineException - when an internal exception happens during the execution of the command.

isRequired

boolean isRequired()

Returns to true, if this case execution is required.

Returns:
true if this case execution is required.

setRequired

void setRequired(boolean required)

Sets this case execution as required or not required.

Parameters:
required - a boolean value whether this case execution is required or not required.

remove

void remove()

Removes this case execution from the parent case execution.


getCaseExecutions

List<? extends CmmnExecution> getCaseExecutions()

Returns a List of child case executions. If this case execution has no child case executions an empty List will be returned.

Returns:
a List of child case executions.

createTask

Task createTask(TaskDecorator taskDecorator)

Creates a new task.

This

case execution will be the case execution of the created task.

Parameters:
taskDecorator - the task decorator used to create task

createSubProcessInstance

PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition)

Creates a new sub process instance.

This case execution will be the super case execution of the created sub process instance.

Parameters:
processDefinition - The PvmProcessDefinition of the subprocess.

createSubProcessInstance

PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition,
                                            String businessKey)

Creates a new sub process instance.

This case execution will be the super case execution of the created sub process instance.

Parameters:
processDefinition - The PvmProcessDefinition of the subprocess.
businessKey - The businessKey to be set on sub process instance.

createSubProcessInstance

PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition,
                                            String businessKey,
                                            String caseInstanceId)

Creates a new sub process instance.

This case execution will be the super case execution of the created sub process instance.

Parameters:
processDefinition - The PvmProcessDefinition of the subprocess.
businessKey - The businessKey to be set on sub process instance.
caseInstanceId - The caseInstanceId to be set on sub process instance.

createSubCaseInstance

CmmnCaseInstance createSubCaseInstance(CmmnCaseDefinition caseDefinition)

Creates a new sub case instance.

This case execution will be the super case execution of the created sub case instance.

Parameters:
caseDefinition - The CmmnCaseDefinition of the subprocess.

createSubCaseInstance

CmmnCaseInstance createSubCaseInstance(CmmnCaseDefinition caseDefinition,
                                       String businessKey)

Creates a new sub case instance.

This case execution will be the super case execution of the created sub case instance.

Parameters:
caseDefinition - The CmmnCaseDefinition of the subprocess.
businessKey - The businessKey to be set on sub case instance.

createSentryParts

void createSentryParts()

Creates for each defined PlanItemOnPart and IfPart inside the specified Sentries a CmmnSentryPart.


isSentrySatisfied

boolean isSentrySatisfied(String sentryId)

Returns true, if each CmmnSentryPart of the given sentryId is satisfied.

Parameters:
sentryId - the id of the sentry to check
Returns:
true if the sentry is satisfied.


Copyright © 2014 camunda services GmbH. All rights reserved.