Package org.camunda.bpm.engine.impl.cmd
Class GetActivityInstanceCmd
- java.lang.Object
-
- org.camunda.bpm.engine.impl.cmd.GetActivityInstanceCmd
-
- All Implemented Interfaces:
Command<ActivityInstance>
public class GetActivityInstanceCmd extends java.lang.Object implements Command<ActivityInstance>
Creates an activity instance tree according to the following strategy:
- Event scope executions are not considered at all
- For every leaf execution, generate an activity/transition instance; the activity instance id is set in the leaf execution and the parent instance id is set in the parent execution
- For every non-leaf scope execution, generate an activity instance; the activity instance id is always set in the parent execution and the parent activity instance id is always set in the parent's parent (because of tree compactation, we ensure that an activity instance id for a scope activity is always stored in the corresponding scope execution's parent, unless the execution is a leaf)
- Compensation is an exception to the above procedure: A compensation throw event is not a scope, however the compensating executions are added as child executions of the (probably non-scope) execution executing the throw event. Logically, the compensating executions are children of the scope execution the throwing event is executed in. Due to this oddity, the activity instance id are stored on different executions
- Author:
- Thorben Lindhauer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGetActivityInstanceCmd.ExecutionIdComparator
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringprocessInstanceId
-
Constructor Summary
Constructors Constructor Description GetActivityInstanceCmd(java.lang.String processInstanceId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckGetActivityInstance(java.lang.String processInstanceId, CommandContext commandContext)protected ActivityInstanceImplcreateActivityInstance(PvmExecutionImpl scopeExecution, ScopeImpl scope, java.lang.String activityInstanceId, java.lang.String parentActivityInstanceId, java.util.Map<java.lang.String,java.util.List<Incident>> incidentsByExecution)protected TransitionInstanceImplcreateTransitionInstance(PvmExecutionImpl execution, java.util.Map<java.lang.String,java.util.List<Incident>> incidentsByExecution)ActivityInstanceexecute(CommandContext commandContext)protected java.util.List<ExecutionEntity>filterLeaves(java.util.List<ExecutionEntity> executionList)protected java.util.List<ExecutionEntity>filterNonEventScopeExecutions(java.util.List<ExecutionEntity> executionList)protected ExecutionEntityfilterProcessInstance(java.util.List<ExecutionEntity> executionList)protected java.util.List<java.lang.String>getIncidentIds(java.util.Map<java.lang.String,java.util.List<Incident>> incidents, PvmExecutionImpl execution)protected java.util.List<Incident>getIncidents(java.util.Map<java.lang.String,java.util.List<Incident>> incidents, PvmExecutionImpl execution)protected java.util.Map<java.lang.String,java.util.List<Incident>>groupIncidentIdsByExecutionId(CommandContext commandContext)protected voidloadChildExecutionsFromCache(ExecutionEntity execution, java.util.List<ExecutionEntity> childExecutions)Loads all executions that are part of this process instance tree from the dbSqlSession cache.protected java.util.List<ExecutionEntity>loadFromDb(java.lang.String processInstanceId, CommandContext commandContext)protected java.util.List<ExecutionEntity>loadProcessInstance(java.lang.String processInstanceId, CommandContext commandContext)protected voidorderById(java.util.List<ExecutionEntity> leaves)protected voidpopulateChildInstances(java.util.Map<java.lang.String,ActivityInstanceImpl> activityInstances, java.util.Map<java.lang.String,TransitionInstanceImpl> transitionInstances)protected <S,T>
voidputListElement(java.util.Map<S,java.util.List<T>> mapOfLists, S key, T listElement)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.camunda.bpm.engine.impl.interceptor.Command
isRetryable
-
-
-
-
Method Detail
-
execute
public ActivityInstance execute(CommandContext commandContext)
- Specified by:
executein interfaceCommand<ActivityInstance>
-
checkGetActivityInstance
protected void checkGetActivityInstance(java.lang.String processInstanceId, CommandContext commandContext)
-
orderById
protected void orderById(java.util.List<ExecutionEntity> leaves)
-
createActivityInstance
protected ActivityInstanceImpl createActivityInstance(PvmExecutionImpl scopeExecution, ScopeImpl scope, java.lang.String activityInstanceId, java.lang.String parentActivityInstanceId, java.util.Map<java.lang.String,java.util.List<Incident>> incidentsByExecution)
-
createTransitionInstance
protected TransitionInstanceImpl createTransitionInstance(PvmExecutionImpl execution, java.util.Map<java.lang.String,java.util.List<Incident>> incidentsByExecution)
-
populateChildInstances
protected void populateChildInstances(java.util.Map<java.lang.String,ActivityInstanceImpl> activityInstances, java.util.Map<java.lang.String,TransitionInstanceImpl> transitionInstances)
-
putListElement
protected <S,T> void putListElement(java.util.Map<S,java.util.List<T>> mapOfLists, S key, T listElement)
-
filterProcessInstance
protected ExecutionEntity filterProcessInstance(java.util.List<ExecutionEntity> executionList)
-
filterLeaves
protected java.util.List<ExecutionEntity> filterLeaves(java.util.List<ExecutionEntity> executionList)
-
filterNonEventScopeExecutions
protected java.util.List<ExecutionEntity> filterNonEventScopeExecutions(java.util.List<ExecutionEntity> executionList)
-
loadProcessInstance
protected java.util.List<ExecutionEntity> loadProcessInstance(java.lang.String processInstanceId, CommandContext commandContext)
-
loadFromDb
protected java.util.List<ExecutionEntity> loadFromDb(java.lang.String processInstanceId, CommandContext commandContext)
-
loadChildExecutionsFromCache
protected void loadChildExecutionsFromCache(ExecutionEntity execution, java.util.List<ExecutionEntity> childExecutions)
Loads all executions that are part of this process instance tree from the dbSqlSession cache. (optionally querying the db if a child is not already loaded.- Parameters:
execution- the current root execution (already contained in childExecutions)childExecutions- the list in which all child executions should be collected
-
groupIncidentIdsByExecutionId
protected java.util.Map<java.lang.String,java.util.List<Incident>> groupIncidentIdsByExecutionId(CommandContext commandContext)
-
getIncidentIds
protected java.util.List<java.lang.String> getIncidentIds(java.util.Map<java.lang.String,java.util.List<Incident>> incidents, PvmExecutionImpl execution)
-
getIncidents
protected java.util.List<Incident> getIncidents(java.util.Map<java.lang.String,java.util.List<Incident>> incidents, PvmExecutionImpl execution)
-
-