Class CmmnExecution
- java.lang.Object
-
- org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope
-
- org.camunda.bpm.engine.impl.core.instance.CoreExecution
-
- org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution
-
- All Implemented Interfaces:
Serializable
,BaseDelegateExecution
,CmmnModelExecutionContext
,DelegateCaseExecution
,ProcessEngineServicesAware
,VariableScope
,CmmnActivityExecution
,CmmnCaseInstance
,VariableEventDispatcher
- Direct Known Subclasses:
CaseExecutionEntity
,CaseExecutionImpl
public abstract class CmmnExecution extends CoreExecution implements CmmnCaseInstance
- Author:
- Roman Smirnov
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CmmnActivity
activity
current activityprotected CmmnCaseDefinition
caseDefinition
protected int
currentState
protected boolean
entryCriterionSatisfied
This property will be used ifthis
CmmnExecution
is in stateCaseExecutionState.NEW
to note that an entry criterion is satisfied.protected static CmmnBehaviorLogger
LOG
protected int
previousState
protected boolean
required
protected TaskEntity
task
protected Queue<VariableEvent>
variableEventsQueue
-
Fields inherited from class org.camunda.bpm.engine.impl.core.instance.CoreExecution
businessKey, businessKeyWithoutCascade, eventName, eventSource, id, listenerIndex, skipCustomListeners, skipIoMapping, skipSubprocesses, tenantId
-
Fields inherited from class org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope
cachedElContext
-
-
Constructor Summary
Constructors Constructor Description CmmnExecution()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addIdIfNotSatisfied(List<String> affectedSentries, CmmnSentryPart sentryPart)
protected abstract void
addSentryPart(CmmnSentryPart sentryPart)
protected void
checkAndFireEntryCriteria(List<String> satisfiedSentries)
protected void
checkAndFireExitCriteria(List<String> satisfiedSentries)
void
close()
Transition toCaseExecutionState.CLOSED
state when no further work or modifications should be allowed for this case instance.protected List<String>
collectAffectedSentries(CmmnExecution child, String transition)
protected List<String>
collectAffectedSentriesWithVariableOnParts(String variableName, String variableEvent, List<CmmnSentryPart> sentryParts)
protected Map<String,List<CmmnSentryPart>>
collectAllSentries()
protected void
collectCaseExecutionsInExecutionTree(List<CmmnExecution> children)
protected List<CmmnSentryPart>
collectSentryParts(Map<String,List<CmmnSentryPart>> sentries)
void
complete()
Transition toCaseExecutionState.COMPLETED
state.protected boolean
containsIfPartAndExecutionActive(String sentryId, Map<String,List<CmmnSentryPart>> sentries)
void
create()
This
case instance transitions toACTIVE
state.void
create(Map<String,Object> variables)
This
case instance transitions toACTIVE
state.protected abstract CmmnExecution
createCaseExecution(CmmnActivity activity)
List<CmmnExecution>
createChildExecutions(List<CmmnActivity> activities)
Creates new child case executions for each givenCmmnActivity
.protected CmmnSentryPart
createIfPart(CmmnSentryDeclaration sentryDeclaration, CmmnIfPartDeclaration ifPartDeclaration)
protected CmmnSentryPart
createOnPart(CmmnSentryDeclaration sentryDeclaration, CmmnOnPartDeclaration onPartDeclaration)
protected CmmnSentryPart
createSentryPart(CmmnSentryDeclaration sentryDeclaration, String type)
void
createSentryParts()
abstract CmmnExecution
createSubCaseInstance(CmmnCaseDefinition caseDefinition)
Creates a new sub case instance.abstract CmmnExecution
createSubCaseInstance(CmmnCaseDefinition caseDefinition, String businessKey)
Creates a new sub case instance.abstract PvmExecutionImpl
createSubProcessInstance(PvmProcessDefinition processDefinition)
Creates a new sub process instance.abstract PvmExecutionImpl
createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey)
Creates a new sub process instance.abstract PvmExecutionImpl
createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey, String caseInstanceId)
Creates a new sub process instance.TaskEntity
createTask(TaskDecorator taskDecorator)
Creates a new task.protected CmmnSentryPart
createVariableOnPart(CmmnSentryDeclaration sentryDeclaration, CmmnVariableOnPartDeclaration variableOnPartDeclaration)
void
deleteCascade()
void
disable()
Transition to state.void
dispatchEvent(VariableEvent variableEvent)
void
enable()
Transition toCaseExecutionState.ENABLED
state.void
exit()
Transition toCaseExecutionState.TERMINATING_ON_EXIT
state.CmmnExecution
findCaseExecution(String activityId)
Find a case execution by the givenactivityId
.protected abstract List<? extends CmmnSentryPart>
findSentry(String sentryId)
void
fireEntryCriteria()
void
fireExitCriteria()
void
fireIfOnlySentryParts()
Fire sentries that consist only out of ifPart, are not satisfied yet, but do satisfy condition.protected void
fireSentries(List<String> satisfiedSentries)
protected void
forceUpdateOnCaseSentryParts(List<CmmnSentryPart> sentryParts)
protected void
forceUpdateOnSentries(List<String> sentryIds)
CmmnActivity
getActivity()
ensures initialization and returns the activityprotected List<CmmnSentryPart>
getAffectedSentryParts(Map<String,List<CmmnSentryPart>> allSentries, List<String> affectedSentries)
String
getBusinessKey()
The business key for the root execution (e.g.String
getCaseBusinessKey()
CmmnCaseDefinition
getCaseDefinition()
abstract List<? extends CmmnExecution>
getCaseExecutions()
Returns aList
of child case executions.protected abstract List<? extends CmmnExecution>
getCaseExecutionsInternal()
abstract CmmnExecution
getCaseInstance()
ensures initialization and returns the process instance.String
getCaseInstanceId()
ensures initialization and returns the process instance.abstract List<? extends CmmnSentryPart>
getCaseSentryParts()
CaseExecutionState
getCurrentState()
Returns thecurrent state
ofthis
case execution.abstract CmmnExecution
getParent()
ensures initialization and returns the parentAbstractVariableScope
getParentVariableScope()
int
getPrevious()
CaseExecutionState
getPreviousState()
Returns theprevious state
ofthis
case execution.protected List<String>
getSatisfiedSentries(List<String> sentryIds)
Checks for each given sentry id whether the corresponding sentry is satisfied.protected List<String>
getSatisfiedSentriesInExecutionTree(List<String> sentryIds, Map<String,List<CmmnSentryPart>> allSentries)
Checks for each given sentry id in the execution tree whether the corresponding sentry is satisfied.protected abstract Map<String,List<CmmnSentryPart>>
getSentries()
int
getState()
abstract CmmnExecution
getSubCaseInstance()
abstract PvmExecutionImpl
getSubProcessInstance()
abstract CmmnExecution
getSuperCaseExecution()
abstract PvmExecutionImpl
getSuperExecution()
TaskEntity
getTask()
protected String
getToStringIdentity()
protected Queue<VariableEvent>
getVariableEventQueue()
String
getVariableScopeKey()
void
handleChildTransition(CmmnExecution child, String transition)
void
handleVariableTransition(String variableName, String transition)
protected boolean
hasVariableWithSameNameInParent(CmmnExecution execution, String variableName)
protected void
invokeVariableListeners(boolean includeCustomerListeners)
boolean
isActive()
boolean
isAvailable()
boolean
isCaseInstanceExecution()
Returnstrue
ifthis
case execution is a case instance.boolean
isClosed()
boolean
isCompleted()
boolean
isDisabled()
boolean
isEnabled()
boolean
isEntryCriterionSatisfied()
The flagentryCriterionSatisfied
will only be set totrue
, whenthis
CmmnActivityExecution
stays in stateCaseExecutionState.NEW
.boolean
isFailed()
boolean
isNew()
protected boolean
isNotSatisfiedIfPartOnly(CmmnSentryPart sentryPart)
boolean
isRequired()
Returns true, ifthis
case execution is required.protected boolean
isSentryPartsSatisfied(String sentryId, List<? extends CmmnSentryPart> sentryParts)
boolean
isSentrySatisfied(String sentryId)
boolean
isSuspended()
boolean
isSuspending()
boolean
isTerminated()
boolean
isTerminating()
void
manualComplete()
Transition toCaseExecutionState.COMPLETED
state.void
manualStart()
Transition toCaseExecutionState.ACTIVE
state.protected abstract CmmnExecution
newCaseExecution()
protected abstract CmmnSentryPart
newSentryPart()
void
occur()
Transition toCaseExecutionState.COMPLETED
state.void
parentComplete()
Transition toCaseExecutionState.TERMINATED
state.void
parentResume()
Transition to the previous state (CaseExecutionState.AVAILABLE
,CaseExecutionState.ENABLED
,CaseExecutionState.DISABLED
orCaseExecutionState.ACTIVE
) when the parentStage
transitions out ofCaseExecutionState.SUSPENDED
.void
parentSuspend()
Transition toCaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION
state.void
parentTerminate()
Transition toCaseExecutionState.TERMINATING_ON_PARENT_TERMINATION
state.void
performExit()
Transition toCaseExecutionState.TERMINATED
state.void
performParentSuspension()
Transition toCaseExecutionState.SUSPENDED
state.void
performParentTerminate()
Transition toCaseExecutionState.TERMINATED
state.void
performSuspension()
Transition toCaseExecutionState.SUSPENDED
state.void
performTerminate()
Transition toCaseExecutionState.TERMINATED
state.protected void
queueVariableEvent(VariableEvent variableEvent, boolean includeCustomerListeners)
void
reactivate()
Transition toCaseExecutionState.ACTIVE
state.void
reenable()
Transition toCaseExecutionState.ENABLED
state.void
remove()
Removesthis
case execution from the parent case execution.protected void
resetSentries(List<String> sentries)
protected void
resetSentryParts(List<CmmnSentryPart> parts)
void
resume()
Transition to either toCaseExecutionState.ACTIVE
state, ifthis
case execution is associated with aStage
orTask
, or toCaseExecutionState#AVAILABE
, ifthis
case execution is associated with aEventListener
orMilestone
.void
setActivity(CmmnActivity activity)
void
setCaseDefinition(CmmnCaseDefinition caseDefinition)
abstract void
setCaseInstance(CmmnExecution caseInstance)
void
setCurrentState(CaseExecutionState currentState)
Sets the givenstate
as the current state ofthis
case execution.abstract void
setParent(CmmnExecution parent)
void
setPrevious(int previous)
void
setRequired(boolean required)
Setsthis
case execution as required or not required.void
setState(int state)
abstract void
setSubCaseInstance(CmmnExecution subCaseInstance)
abstract void
setSubProcessInstance(PvmExecutionImpl subProcessInstance)
abstract void
setSuperCaseExecution(CmmnExecution superCaseExecution)
abstract void
setSuperExecution(PvmExecutionImpl superExecution)
void
setTask(Task task)
void
start()
Transition toCaseExecutionState.ACTIVE
state.void
suspend()
Transition toCaseExecutionState.SUSPENDING_ON_SUSPENSION
state.void
terminate()
Transition toCaseExecutionState.TERMINATING_ON_TERMINATION
state.String
toString()
void
triggerChildExecutionsLifecycle(List<CmmnExecution> children)
This method triggers for each given case execution the lifecycle.-
Methods inherited from class org.camunda.bpm.engine.impl.core.instance.CoreExecution
getBusinessKeyWithoutCascade, getEventName, getEventSource, getId, getListenerIndex, getTenantId, hasFailedOnEndListeners, invokeListener, isSkipCustomListeners, isSkipIoMappings, isSkipSubprocesses, performOperation, performOperationSync, setBusinessKey, setEventName, setEventSource, setId, setListenerIndex, setSkipCustomListeners, setSkipIoMappings, setSkipSubprocesseses, setTenantId
-
Methods inherited from class org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope
collectVariableNames, collectVariables, getCachedElContext, getSourceActivityVariableScope, getValueFromVariableInstance, getVariable, getVariable, getVariableInstance, getVariableInstanceFactory, getVariableInstanceLifecycleListeners, getVariableInstanceLocal, getVariableInstancesLocal, getVariableInstancesLocal, getVariableLocal, getVariableLocal, getVariableLocalTyped, getVariableLocalTyped, getVariableNames, getVariableNamesLocal, getVariables, getVariablesLocal, getVariablesLocalTyped, getVariablesLocalTyped, getVariableStore, getVariablesTyped, getVariablesTyped, getVariableTyped, getVariableTyped, hasVariable, hasVariableLocal, hasVariables, hasVariablesLocal, initializeVariableStore, invokeVariableLifecycleListenersCreate, invokeVariableLifecycleListenersCreate, invokeVariableLifecycleListenersDelete, invokeVariableLifecycleListenersDelete, invokeVariableLifecycleListenersUpdate, invokeVariableLifecycleListenersUpdate, removeVariable, removeVariable, removeVariableLocal, removeVariableLocal, removeVariables, removeVariables, removeVariablesLocal, removeVariablesLocal, setCachedElContext, setVariable, setVariable, setVariable, setVariable, setVariableLocal, setVariableLocal, setVariableLocal, setVariables, setVariables, setVariablesLocal, setVariablesLocal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.camunda.bpm.engine.delegate.CmmnModelExecutionContext
getCmmnModelElementInstance, getCmmnModelInstance
-
Methods inherited from interface org.camunda.bpm.engine.delegate.DelegateCaseExecution
getActivityId, getActivityName, getCaseDefinitionId, getEventName, getId, getParentId, getTenantId
-
Methods inherited from interface org.camunda.bpm.engine.delegate.ProcessEngineServicesAware
getProcessEngine, getProcessEngineServices
-
Methods inherited from interface org.camunda.bpm.engine.delegate.VariableScope
getVariable, getVariableLocal, getVariableLocalTyped, getVariableLocalTyped, getVariableNames, getVariableNamesLocal, getVariables, getVariablesLocal, getVariablesLocalTyped, getVariablesLocalTyped, getVariablesTyped, getVariablesTyped, getVariableTyped, getVariableTyped, hasVariable, hasVariableLocal, hasVariables, hasVariablesLocal, removeVariable, removeVariableLocal, removeVariables, removeVariables, removeVariablesLocal, removeVariablesLocal, setVariable, setVariableLocal, setVariables, setVariablesLocal
-
-
-
-
Field Detail
-
LOG
protected static final CmmnBehaviorLogger LOG
-
caseDefinition
protected transient CmmnCaseDefinition caseDefinition
-
activity
protected transient CmmnActivity activity
current activity
-
required
protected boolean required
-
previousState
protected int previousState
-
currentState
protected int currentState
-
variableEventsQueue
protected Queue<VariableEvent> variableEventsQueue
-
task
protected transient TaskEntity task
-
entryCriterionSatisfied
protected boolean entryCriterionSatisfied
This property will be used ifthis
CmmnExecution
is in stateCaseExecutionState.NEW
to note that an entry criterion is satisfied.
-
-
Method Detail
-
getCaseExecutions
public abstract List<? extends CmmnExecution> getCaseExecutions()
Description copied from interface:CmmnActivityExecution
Returns a
List
of child case executions. Ifthis
case execution has no child case executions an emptyList
will be returned.- Specified by:
getCaseExecutions
in interfaceCmmnActivityExecution
- Returns:
- a
List
of child case executions.
-
getCaseExecutionsInternal
protected abstract List<? extends CmmnExecution> getCaseExecutionsInternal()
-
findCaseExecution
public CmmnExecution findCaseExecution(String activityId)
Description copied from interface:CmmnCaseInstance
Find a case execution by the given
activityId
.- Specified by:
findCaseExecution
in interfaceCmmnCaseInstance
- Parameters:
activityId
- the id of theactivity
to which a case execution is associated.- Returns:
- returns a case execution or null if a case execution could not be found.
-
getTask
public TaskEntity getTask()
-
setTask
public void setTask(Task task)
-
createTask
public TaskEntity createTask(TaskDecorator taskDecorator)
Description copied from interface:CmmnActivityExecution
Creates a new task.
case execution will be the case execution of the created task.This
- Specified by:
createTask
in interfaceCmmnActivityExecution
- Parameters:
taskDecorator
- the task decorator used to create task
-
getSuperExecution
public abstract PvmExecutionImpl getSuperExecution()
-
setSuperExecution
public abstract void setSuperExecution(PvmExecutionImpl superExecution)
-
getSubProcessInstance
public abstract PvmExecutionImpl getSubProcessInstance()
-
setSubProcessInstance
public abstract void setSubProcessInstance(PvmExecutionImpl subProcessInstance)
-
createSubProcessInstance
public abstract PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition)
Description copied from interface:CmmnActivityExecution
Creates a new sub process instance.
This
case execution will be the super case execution of the created sub process instance.- Specified by:
createSubProcessInstance
in interfaceCmmnActivityExecution
- Parameters:
processDefinition
- ThePvmProcessDefinition
of the subprocess.
-
createSubProcessInstance
public abstract PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey)
Description copied from interface:CmmnActivityExecution
Creates a new sub process instance.
This
case execution will be the super case execution of the created sub process instance.- Specified by:
createSubProcessInstance
in interfaceCmmnActivityExecution
- Parameters:
processDefinition
- ThePvmProcessDefinition
of the subprocess.businessKey
- The businessKey to be set on sub process instance.
-
createSubProcessInstance
public abstract PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey, String caseInstanceId)
Description copied from interface:CmmnActivityExecution
Creates a new sub process instance.
This
case execution will be the super case execution of the created sub process instance.- Specified by:
createSubProcessInstance
in interfaceCmmnActivityExecution
- Parameters:
processDefinition
- ThePvmProcessDefinition
of the subprocess.businessKey
- The businessKey to be set on sub process instance.caseInstanceId
- The caseInstanceId to be set on sub process instance.
-
getSubCaseInstance
public abstract CmmnExecution getSubCaseInstance()
-
setSubCaseInstance
public abstract void setSubCaseInstance(CmmnExecution subCaseInstance)
-
createSubCaseInstance
public abstract CmmnExecution createSubCaseInstance(CmmnCaseDefinition caseDefinition)
Description copied from interface:CmmnActivityExecution
Creates a new sub case instance.
This
case execution will be the super case execution of the created sub case instance.- Specified by:
createSubCaseInstance
in interfaceCmmnActivityExecution
- Parameters:
caseDefinition
- TheCmmnCaseDefinition
of the sub case instance.
-
createSubCaseInstance
public abstract CmmnExecution createSubCaseInstance(CmmnCaseDefinition caseDefinition, String businessKey)
Description copied from interface:CmmnActivityExecution
Creates a new sub case instance.
This
case execution will be the super case execution of the created sub case instance.- Specified by:
createSubCaseInstance
in interfaceCmmnActivityExecution
- Parameters:
caseDefinition
- TheCmmnCaseDefinition
of the sub case instance.businessKey
- The businessKey to be set on sub case instance.
-
getSuperCaseExecution
public abstract CmmnExecution getSuperCaseExecution()
-
setSuperCaseExecution
public abstract void setSuperCaseExecution(CmmnExecution superCaseExecution)
-
newSentryPart
protected abstract CmmnSentryPart newSentryPart()
-
addSentryPart
protected abstract void addSentryPart(CmmnSentryPart sentryPart)
-
createSentryParts
public void createSentryParts()
Description copied from interface:CmmnActivityExecution
Creates for each defined
PlanItemOnPart
andIfPart
inside the specifiedSentries
aCmmnSentryPart
.- Specified by:
createSentryParts
in interfaceCmmnActivityExecution
-
createOnPart
protected CmmnSentryPart createOnPart(CmmnSentryDeclaration sentryDeclaration, CmmnOnPartDeclaration onPartDeclaration)
-
createIfPart
protected CmmnSentryPart createIfPart(CmmnSentryDeclaration sentryDeclaration, CmmnIfPartDeclaration ifPartDeclaration)
-
createVariableOnPart
protected CmmnSentryPart createVariableOnPart(CmmnSentryDeclaration sentryDeclaration, CmmnVariableOnPartDeclaration variableOnPartDeclaration)
-
createSentryPart
protected CmmnSentryPart createSentryPart(CmmnSentryDeclaration sentryDeclaration, String type)
-
handleChildTransition
public void handleChildTransition(CmmnExecution child, String transition)
-
fireIfOnlySentryParts
public void fireIfOnlySentryParts()
Description copied from interface:CmmnActivityExecution
Fire sentries that consist only out of ifPart, are not satisfied yet, but do satisfy condition.- Specified by:
fireIfOnlySentryParts
in interfaceCmmnActivityExecution
-
handleVariableTransition
public void handleVariableTransition(String variableName, String transition)
-
collectAffectedSentries
protected List<String> collectAffectedSentries(CmmnExecution child, String transition)
-
isNotSatisfiedIfPartOnly
protected boolean isNotSatisfiedIfPartOnly(CmmnSentryPart sentryPart)
-
addIdIfNotSatisfied
protected void addIdIfNotSatisfied(List<String> affectedSentries, CmmnSentryPart sentryPart)
-
collectAffectedSentriesWithVariableOnParts
protected List<String> collectAffectedSentriesWithVariableOnParts(String variableName, String variableEvent, List<CmmnSentryPart> sentryParts)
-
hasVariableWithSameNameInParent
protected boolean hasVariableWithSameNameInParent(CmmnExecution execution, String variableName)
-
collectAllSentries
protected Map<String,List<CmmnSentryPart>> collectAllSentries()
-
getAffectedSentryParts
protected List<CmmnSentryPart> getAffectedSentryParts(Map<String,List<CmmnSentryPart>> allSentries, List<String> affectedSentries)
-
collectSentryParts
protected List<CmmnSentryPart> collectSentryParts(Map<String,List<CmmnSentryPart>> sentries)
-
forceUpdateOnCaseSentryParts
protected void forceUpdateOnCaseSentryParts(List<CmmnSentryPart> sentryParts)
-
getSatisfiedSentries
protected List<String> getSatisfiedSentries(List<String> sentryIds)
Checks for each given sentry id whether the corresponding sentry is satisfied.
-
getSatisfiedSentriesInExecutionTree
protected List<String> getSatisfiedSentriesInExecutionTree(List<String> sentryIds, Map<String,List<CmmnSentryPart>> allSentries)
Checks for each given sentry id in the execution tree whether the corresponding sentry is satisfied.
-
resetSentryParts
protected void resetSentryParts(List<CmmnSentryPart> parts)
-
collectCaseExecutionsInExecutionTree
protected void collectCaseExecutionsInExecutionTree(List<CmmnExecution> children)
-
fireExitCriteria
public void fireExitCriteria()
-
fireEntryCriteria
public void fireEntryCriteria()
-
getCaseSentryParts
public abstract List<? extends CmmnSentryPart> getCaseSentryParts()
-
findSentry
protected abstract List<? extends CmmnSentryPart> findSentry(String sentryId)
-
getSentries
protected abstract Map<String,List<CmmnSentryPart>> getSentries()
-
isSentrySatisfied
public boolean isSentrySatisfied(String sentryId)
Description copied from interface:CmmnActivityExecution
Returns
true
, if eachCmmnSentryPart
of the givensentryId
is satisfied.- Specified by:
isSentrySatisfied
in interfaceCmmnActivityExecution
- Parameters:
sentryId
- the id of the sentry to check- Returns:
true
if the sentry is satisfied.
-
isSentryPartsSatisfied
protected boolean isSentryPartsSatisfied(String sentryId, List<? extends CmmnSentryPart> sentryParts)
-
containsIfPartAndExecutionActive
protected boolean containsIfPartAndExecutionActive(String sentryId, Map<String,List<CmmnSentryPart>> sentries)
-
isEntryCriterionSatisfied
public boolean isEntryCriterionSatisfied()
Description copied from interface:CmmnActivityExecution
The flag
entryCriterionSatisfied
will only be set totrue
, whenthis
CmmnActivityExecution
stays in stateCaseExecutionState.NEW
.For example:
There exists:
- a
Stage
, - the
Stage
contains two tasks (A and B) and - task B has an entry criterion which is satisfied,
when task A performs the transition
create
When the
Stage
instance becomes active, two child case executions will be created for task A and task B. Both tasks are in the stateCaseExecutionState.NEW
. Now task A performs thecreate
transition and so that the given sentry is triggered, that this is satisfied. Afterwards the sentry will be reseted, that the sentry is not satisfied anymore.But task B is still in the state
CaseExecutionState.NEW
and will not be notified, that its' entry criterion has been satisfied. That's why the the flagentryCriterionSatisfied
will be set totrue
on the case execution of task B in such a situation. When task B performs the transition into the stateCaseExecutionState.AVAILABLE
it can perform the next transition because the entry criterion has been already satisfied.- Specified by:
isEntryCriterionSatisfied
in interfaceCmmnActivityExecution
- a
-
getCaseBusinessKey
public String getCaseBusinessKey()
- Specified by:
getCaseBusinessKey
in interfaceDelegateCaseExecution
-
getBusinessKey
public String getBusinessKey()
Description copied from interface:BaseDelegateExecution
The business key for the root execution (e.g. process instance).- Specified by:
getBusinessKey
in interfaceBaseDelegateExecution
-
getCaseDefinition
public CmmnCaseDefinition getCaseDefinition()
-
setCaseDefinition
public void setCaseDefinition(CmmnCaseDefinition caseDefinition)
-
getCaseInstance
public abstract CmmnExecution getCaseInstance()
ensures initialization and returns the process instance.
-
setCaseInstance
public abstract void setCaseInstance(CmmnExecution caseInstance)
-
isCaseInstanceExecution
public boolean isCaseInstanceExecution()
Description copied from interface:CmmnActivityExecution
Returns
true
ifthis
case execution is a case instance. Ifthis
case execution is not a case instance thenfalse
will be returned.- Specified by:
isCaseInstanceExecution
in interfaceCmmnActivityExecution
- Returns:
- whether
this
case execution is a case instance or not.
-
getCaseInstanceId
public String getCaseInstanceId()
ensures initialization and returns the process instance.- Specified by:
getCaseInstanceId
in interfaceDelegateCaseExecution
-
getParent
public abstract CmmnExecution getParent()
ensures initialization and returns the parent- Specified by:
getParent
in interfaceCmmnActivityExecution
- Returns:
- a
parent
or null.
-
setParent
public abstract void setParent(CmmnExecution parent)
-
getActivity
public CmmnActivity getActivity()
ensures initialization and returns the activity- Specified by:
getActivity
in interfaceCmmnActivityExecution
- Returns:
- the associated
activity
-
setActivity
public void setActivity(CmmnActivity activity)
-
getVariableScopeKey
public String getVariableScopeKey()
- Specified by:
getVariableScopeKey
in interfaceVariableScope
- Overrides:
getVariableScopeKey
in classAbstractVariableScope
-
getParentVariableScope
public AbstractVariableScope getParentVariableScope()
- Specified by:
getParentVariableScope
in classAbstractVariableScope
-
deleteCascade
public void deleteCascade()
-
remove
public void remove()
Description copied from interface:CmmnActivityExecution
Removes
this
case execution from the parent case execution.- Specified by:
remove
in interfaceCmmnActivityExecution
-
isRequired
public boolean isRequired()
Description copied from interface:CmmnActivityExecution
Returns true, if
this
case execution is required.- Specified by:
isRequired
in interfaceCmmnActivityExecution
- Returns:
- true if
this
case execution is required.
-
setRequired
public void setRequired(boolean required)
Description copied from interface:CmmnActivityExecution
Sets
this
case execution as required or not required.- Specified by:
setRequired
in interfaceCmmnActivityExecution
- Parameters:
required
- a boolean value whetherthis
case execution is required or not required.
-
getCurrentState
public CaseExecutionState getCurrentState()
Description copied from interface:CmmnActivityExecution
Returns the
current state
ofthis
case execution.- Specified by:
getCurrentState
in interfaceCmmnActivityExecution
- Returns:
- the
current state
-
setCurrentState
public void setCurrentState(CaseExecutionState currentState)
Description copied from interface:CmmnActivityExecution
Sets the given
state
as the current state ofthis
case execution.- Specified by:
setCurrentState
in interfaceCmmnActivityExecution
- Parameters:
currentState
- the current state to set
-
getState
public int getState()
-
setState
public void setState(int state)
-
isNew
public boolean isNew()
Description copied from interface:CmmnActivityExecution
Returns
true
iff:
CmmnActivityExecution.getCurrentState()
==CaseExecutionState.NEW
- Specified by:
isNew
in interfaceCmmnActivityExecution
- Returns:
- whether
this
case execution has as current stateCaseExecutionState.NEW
-
isAvailable
public boolean isAvailable()
- Specified by:
isAvailable
in interfaceDelegateCaseExecution
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceDelegateCaseExecution
-
isDisabled
public boolean isDisabled()
- Specified by:
isDisabled
in interfaceDelegateCaseExecution
-
isActive
public boolean isActive()
- Specified by:
isActive
in interfaceDelegateCaseExecution
-
isCompleted
public boolean isCompleted()
- Specified by:
isCompleted
in interfaceDelegateCaseExecution
-
isSuspended
public boolean isSuspended()
- Specified by:
isSuspended
in interfaceDelegateCaseExecution
-
isSuspending
public boolean isSuspending()
Description copied from interface:CmmnActivityExecution
Returns
true
iff:
CmmnActivityExecution.getCurrentState()
==CaseExecutionState.SUSPENDING_ON_SUSPENSION
||CmmnActivityExecution.getCurrentState()
==CaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION
- Specified by:
isSuspending
in interfaceCmmnActivityExecution
- Returns:
- whether
this
case execution has as current stateCaseExecutionState.SUSPENDING_ON_SUSPENSION
orCaseExecutionState.SUSPENDING_ON_PARENT_SUSPENSION
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfaceDelegateCaseExecution
-
isTerminating
public boolean isTerminating()
Description copied from interface:CmmnActivityExecution
Returns
true
iff:
CmmnActivityExecution.getCurrentState()
==CaseExecutionState.TERMINATING_ON_TERMINATION
||CmmnActivityExecution.getCurrentState()
==CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION
||CmmnActivityExecution.getCurrentState()
==CaseExecutionState.TERMINATING_ON_EXIT
- Specified by:
isTerminating
in interfaceCmmnActivityExecution
- Returns:
- whether
this
case execution has as current stateCaseExecutionState.TERMINATING_ON_TERMINATION
,CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION
orCaseExecutionState.TERMINATING_ON_EXIT
-
isFailed
public boolean isFailed()
- Specified by:
isFailed
in interfaceDelegateCaseExecution
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceDelegateCaseExecution
-
getPreviousState
public CaseExecutionState getPreviousState()
Description copied from interface:CmmnActivityExecution
Returns the
previous state
ofthis
case execution.- Specified by:
getPreviousState
in interfaceCmmnActivityExecution
- Returns:
- the
previous state
-
getPrevious
public int getPrevious()
-
setPrevious
public void setPrevious(int previous)
-
create
public void create()
Description copied from interface:CmmnCaseInstance
This
case instance transitions toACTIVE
state.- Specified by:
create
in interfaceCmmnCaseInstance
-
create
public void create(Map<String,Object> variables)
Description copied from interface:CmmnCaseInstance
This
case instance transitions toACTIVE
state.The given
variables
will be set a case instance variables.- Specified by:
create
in interfaceCmmnCaseInstance
-
createChildExecutions
public List<CmmnExecution> createChildExecutions(List<CmmnActivity> activities)
Description copied from interface:CmmnActivityExecution
Creates new child case executions for each given
CmmnActivity
.Afterwards the method
CmmnActivityExecution.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 whenthis
case execution (which represents aStage
) transitions toACTIVE
state. The passed collection ofactivities
are the planned items that should be executed in thisStage
. So that for each givenCmmnActivity
a new case execution will be instantiated. Furthermore for each created child execution there happens a transition to the initial stateAVAILABLE
.- Specified by:
createChildExecutions
in interfaceCmmnActivityExecution
- Parameters:
activities
- a collection ofactivities
of planned items to execute insidethis
case execution
-
triggerChildExecutionsLifecycle
public void triggerChildExecutionsLifecycle(List<CmmnExecution> children)
Description copied from interface:CmmnActivityExecution
This method triggers for each given case execution the lifecycle.
This method must be called after
CmmnActivityExecution.createChildExecutions(List)
.- Specified by:
triggerChildExecutionsLifecycle
in interfaceCmmnActivityExecution
- Parameters:
children
- a collection ofcase execution
to trigger for each given case execution the lifecycle
-
createCaseExecution
protected abstract CmmnExecution createCaseExecution(CmmnActivity activity)
-
newCaseExecution
protected abstract CmmnExecution newCaseExecution()
-
enable
public void enable()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.ENABLED
state.This
case execution must be inCaseExecutionState.AVAILABLE
state to be able to do this transition.It is only possible to enable a case execution which is associated with a
Stage
orTask
.- Specified by:
enable
in interfaceCmmnActivityExecution
-
disable
public void disable()
Description copied from interface:CmmnActivityExecution
Transition to state.
This
case execution must be inCaseExecutionState.ENABLED
state to be able to do this transition.It is only possible to disable a case execution which is associated with a
Stage
orTask
.If
this
case execution has a parent case execution, that parent case execution will be notified thatthis
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 seeCmmnActivityExecution.complete()
.- Specified by:
disable
in interfaceCmmnActivityExecution
-
reenable
public void reenable()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.ENABLED
state.This
case execution must be inCaseExecutionState.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
orTask
.- Specified by:
reenable
in interfaceCmmnActivityExecution
-
manualStart
public void manualStart()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.ACTIVE
state.This
case execution must be inCaseExecutionState.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
orTask
.- Specified by:
manualStart
in interfaceCmmnActivityExecution
-
start
public void start()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.ACTIVE
state.This
case execution must be inCaseExecutionState.AVAILABLE
state to be able to do this transition.It is only possible to start a case execution which is associated with a
Stage
orTask
.- Specified by:
start
in interfaceCmmnActivityExecution
-
complete
public void complete()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.COMPLETED
state.This
case execution must be inCaseExecutionState.ACTIVE
state to be able to do this transition.It is only possible to complete a case execution which is associated with a
Stage
orTask
.If
this
case execution has a parent case execution, that parent case execution will be notified thatthis
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 seeCmmnActivityExecution.complete()
.In case of a
Stage
the completion can only be performed when the following criteria are fulfilled:
- there are no children in the state
CaseExecutionState.ACTIVE
orCaseExecutionState.NEW
- if the property
autoComplete
of the associatedStage
is set totrue
:- all required (
requiredRule
evaluates totrue
) children are in state
- all required (
- if the property
autoComplete
of the associatedStage
is set tofalse
:
For a
Task
instance, this means its purpose has been accomplished:
HumanTask
have been completed by human.CaseTask
have launched a newCaseInstance
and if output parameters are required and/or the propertyisBlocking
is set totrue
, then the launchedCaseInstance
has completed and returned the output parameters.ProcessTask
have launched a newProcessInstance
and if output parameters are required and/or the propertyisBlocking
is set totrue
, then the launchedProcessInstance
has completed and returned the output parameters.
- Specified by:
complete
in interfaceCmmnActivityExecution
- there are no children in the state
-
manualComplete
public void manualComplete()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.COMPLETED
state.This
case execution must be inCaseExecutionState.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
orTask
.If
this
case execution has a parent case execution, that parent case execution will be notified thatthis
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 seeCmmnActivityExecution.complete()
.In case of a
Stage
the completion can only be performed when the following criteria are fulfilled:
- there are no children in the state
CaseExecutionState.ACTIVE
orCaseExecutionState.NEW
- all required (
requiredRule
evaluates totrue
) children are in state
For a
Task
instance, this means its purpose has been accomplished:
HumanTask
have been completed by human.
- Specified by:
manualComplete
in interfaceCmmnActivityExecution
- there are no children in the state
-
occur
public void occur()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.COMPLETED
state.This
case execution must be inCaseExecutionState.AVAILABLE
state to be able to do this transition.For
Forevent listener
transitions when the event being listened by theevent listener
instance does occur. For auser event listener
instance this transition happens when a human decides to raise the event.Milestone
instance transitions when one of the achievingsentries
(entry criteria) is satisfied.If
this
case execution has a parent case execution, that parent case execution will be notified thatthis
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 seeCmmnActivityExecution.complete()
.- Specified by:
occur
in interfaceCmmnActivityExecution
-
terminate
public void terminate()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.TERMINATING_ON_TERMINATION
state.If
this
case execution is associated with aStage
orTask
, thenthis
case execution must be inCaseExecutionState.ACTIVE
state to be able to do this transition.
And ifthis
case execution is association withEventListener
or aMilestone
, thenthis
case execution must be inCaseExecutionState.AVAILABLE
state to be able to do this transition.For a
Stage
instance the termination ofthis
case execution will be propagated down to all its containedEventListener
,Milestone
,Stage
, andTask
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 methodCmmnActivityExecution.performTerminate()
must be called to complete the transition into the stateCaseExecutionState.TERMINATED
.- Specified by:
terminate
in interfaceCmmnActivityExecution
-
performTerminate
public void performTerminate()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.TERMINATED
state.If
this
case execution has a parent case execution, that parent case execution will be notified thatthis
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 seeCmmnActivityExecution.complete()
.- Specified by:
performTerminate
in interfaceCmmnActivityExecution
-
parentTerminate
public void parentTerminate()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.TERMINATING_ON_PARENT_TERMINATION
state.This
case execution must be inCaseExecutionState.AVAILABLE
orCaseExecutionState.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
orMilestone
.Afterwards the method
CmmnActivityExecution.performParentTerminate()
must be called to complete the transition into the stateCaseExecutionState.TERMINATED
.- Specified by:
parentTerminate
in interfaceCmmnActivityExecution
-
performParentTerminate
public void performParentTerminate()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.TERMINATED
state.This
case execution must be inCaseExecutionState.AVAILABLE
orCaseExecutionState.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
orMilestone
.- Specified by:
performParentTerminate
in interfaceCmmnActivityExecution
-
exit
public void exit()
Description copied from interface:CmmnActivityExecution
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:CaseExecutionState.AVAILABLE
,CaseExecutionState.ENABLED
,CaseExecutionState.DISABLED
,CaseExecutionState.ACTIVE
,CaseExecutionState.SUSPENDED
orCaseExecutionState.FAILED
It is only possible to execute an exit on a case execution which is associated with a
Stage
orTask
.Afterwards the method
CmmnActivityExecution.performExit()
must be called to complete the transition into the stateCaseExecutionState.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 thatthis
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 seeCmmnActivityExecution.complete()
.- Specified by:
exit
in interfaceCmmnActivityExecution
-
parentComplete
public void parentComplete()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.TERMINATED
state.- Specified by:
parentComplete
in interfaceCmmnActivityExecution
-
performExit
public void performExit()
Description copied from interface:CmmnActivityExecution
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
CmmnActivityExecution.complete()
.- Specified by:
performExit
in interfaceCmmnActivityExecution
-
suspend
public void suspend()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.SUSPENDING_ON_SUSPENSION
state.If
this
case execution is associated with aStage
orTask
, thenthis
case execution must be inCaseExecutionState.ACTIVE
state to be able to do this transition.
And ifthis
case execution is association withEventListener
or aMilestone
, thenthis
case execution must be inCaseExecutionState.AVAILABLE
state to be able to do this transition.For a
Stage
instance the suspension ofthis
case execution will be propagated down to all its containedEventListener
,Milestone
,Stage
, andTask
instances.Afterwards the method
CmmnActivityExecution.performSuspension()
must be called to complete the transition into the stateCaseExecutionState.SUSPENDED
.- Specified by:
suspend
in interfaceCmmnActivityExecution
-
performSuspension
public void performSuspension()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.SUSPENDED
state.- Specified by:
performSuspension
in interfaceCmmnActivityExecution
-
parentSuspend
public void parentSuspend()
Description copied from interface:CmmnActivityExecution
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:CaseExecutionState.AVAILABLE
,CaseExecutionState.ENABLED
,CaseExecutionState.DISABLED
orCaseExecutionState.ACTIVE
It is only possible to execute a parent suspension on a case execution which is associated with a
Stage
orTask
.Afterwards the method
CmmnActivityExecution.performParentSuspension()
must be called to complete the transition into the stateCaseExecutionState.SUSPENDED
.- Specified by:
parentSuspend
in interfaceCmmnActivityExecution
-
performParentSuspension
public void performParentSuspension()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.SUSPENDED
state.- Specified by:
performParentSuspension
in interfaceCmmnActivityExecution
-
resume
public void resume()
Description copied from interface:CmmnActivityExecution
Transition to either to
CaseExecutionState.ACTIVE
state, ifthis
case execution is associated with aStage
orTask
, or toCaseExecutionState#AVAILABE
, ifthis
case execution is associated with aEventListener
orMilestone
.This
case execution must be inCaseExecutionState.SUSPENDED
state to be able to do this transition.For a
Stage
instance the resume ofthis
case execution will be propagated down to all its containedEventListener
,Milestone
,Stage
, andTask
instances.- Specified by:
resume
in interfaceCmmnActivityExecution
-
parentResume
public void parentResume()
Description copied from interface:CmmnActivityExecution
Transition to the previous state (
CaseExecutionState.AVAILABLE
,CaseExecutionState.ENABLED
,CaseExecutionState.DISABLED
orCaseExecutionState.ACTIVE
) when the parentStage
transitions out ofCaseExecutionState.SUSPENDED
.This
case execution must be inCaseExecutionState.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
orTask
.- Specified by:
parentResume
in interfaceCmmnActivityExecution
-
reactivate
public void reactivate()
Description copied from interface:CmmnActivityExecution
Transition to
CaseExecutionState.ACTIVE
state.If
this
case execution is associated with aStage
orTask
and is not a case instance, thenthis
case execution must be inCaseExecutionState.FAILED
state to be able to do this transition.
And ifthis
case execution is a case instance, thenthis
case instance must be in one of the following state to perform this transition:CaseExecutionState.COMPLETED
,CaseExecutionState.SUSPENDED
,CaseExecutionState.TERMINATED
orCaseExecutionState.FAILED
In case of a case instance the transition out of
CaseExecutionState.SUSPENDED
state the resume will be propagated down to all its containedEventListener
,Milestone
,Stage
, andTask
instances, seeCmmnActivityExecution.resume()
andCmmnActivityExecution.parentResume()
.- Specified by:
reactivate
in interfaceCmmnActivityExecution
-
close
public void close()
Description copied from interface:CmmnActivityExecution
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:
- Specified by:
close
in interfaceCmmnActivityExecution
-
dispatchEvent
public void dispatchEvent(VariableEvent variableEvent)
- Specified by:
dispatchEvent
in interfaceVariableEventDispatcher
- Overrides:
dispatchEvent
in classAbstractVariableScope
-
queueVariableEvent
protected void queueVariableEvent(VariableEvent variableEvent, boolean includeCustomerListeners)
-
invokeVariableListeners
protected void invokeVariableListeners(boolean includeCustomerListeners)
-
getVariableEventQueue
protected Queue<VariableEvent> getVariableEventQueue()
-
getToStringIdentity
protected String getToStringIdentity()
-
-