Class GetActivityInstanceCmd

  • All Implemented Interfaces:

    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
    Thorben Lindhauer
    • Field Detail

      • processInstanceId

        protected java.lang.String processInstanceId
    • Constructor Detail

      • GetActivityInstanceCmd

        public GetActivityInstanceCmd​(java.lang.String processInstanceId)
    • Method Detail

      • 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)
      • 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)
      • 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)
      • 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.
        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)