Package org.camunda.bpm.engine.impl.cmd
Class GetActivityInstanceCmd
java.lang.Object
org.camunda.bpm.engine.impl.cmd.GetActivityInstanceCmd
- All Implemented Interfaces:
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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkGetActivityInstance
(String processInstanceId, CommandContext commandContext) protected ActivityInstanceImpl
createActivityInstance
(PvmExecutionImpl scopeExecution, ScopeImpl scope, String activityInstanceId, String parentActivityInstanceId, Map<String, List<Incident>> incidentsByExecution) protected TransitionInstanceImpl
createTransitionInstance
(PvmExecutionImpl execution, Map<String, List<Incident>> incidentsByExecution) execute
(CommandContext commandContext) protected List<ExecutionEntity>
filterLeaves
(List<ExecutionEntity> executionList) protected List<ExecutionEntity>
filterNonEventScopeExecutions
(List<ExecutionEntity> executionList) protected ExecutionEntity
filterProcessInstance
(List<ExecutionEntity> executionList) getIncidentIds
(Map<String, List<Incident>> incidents, PvmExecutionImpl execution) getIncidents
(Map<String, List<Incident>> incidents, PvmExecutionImpl execution) groupIncidentIdsByExecutionId
(CommandContext commandContext) protected void
loadChildExecutionsFromCache
(ExecutionEntity execution, List<ExecutionEntity> childExecutions) Loads all executions that are part of this process instance tree from the dbSqlSession cache.protected List<ExecutionEntity>
loadFromDb
(String processInstanceId, CommandContext commandContext) protected List<ExecutionEntity>
loadProcessInstance
(String processInstanceId, CommandContext commandContext) protected void
orderById
(List<ExecutionEntity> leaves) protected void
populateChildInstances
(Map<String, ActivityInstanceImpl> activityInstances, Map<String, TransitionInstanceImpl> transitionInstances) protected <S,
T> void putListElement
(Map<S, List<T>> mapOfLists, S key, T listElement)
-
Field Details
-
processInstanceId
-
-
Constructor Details
-
GetActivityInstanceCmd
-
-
Method Details
-
execute
- Specified by:
execute
in interfaceCommand<ActivityInstance>
-
checkGetActivityInstance
-
orderById
-
createActivityInstance
protected ActivityInstanceImpl createActivityInstance(PvmExecutionImpl scopeExecution, ScopeImpl scope, String activityInstanceId, String parentActivityInstanceId, Map<String, List<Incident>> incidentsByExecution) -
createTransitionInstance
protected TransitionInstanceImpl createTransitionInstance(PvmExecutionImpl execution, Map<String, List<Incident>> incidentsByExecution) -
populateChildInstances
protected void populateChildInstances(Map<String, ActivityInstanceImpl> activityInstances, Map<String, TransitionInstanceImpl> transitionInstances) -
putListElement
-
filterProcessInstance
-
filterLeaves
-
filterNonEventScopeExecutions
-
loadProcessInstance
protected List<ExecutionEntity> loadProcessInstance(String processInstanceId, CommandContext commandContext) -
loadFromDb
-
loadChildExecutionsFromCache
protected void loadChildExecutionsFromCache(ExecutionEntity execution, 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
-
getIncidentIds
-
getIncidents
-