Search in sources :

Example 21 with ActivityExecution

use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution in project camunda-bpm-platform by camunda.

the class PvmExecutionImpl method leaveActivityViaTransitions.

@Override
public void leaveActivityViaTransitions(List<PvmTransition> _transitions, List<? extends ActivityExecution> _recyclableExecutions) {
    List<? extends ActivityExecution> recyclableExecutions = Collections.emptyList();
    if (_recyclableExecutions != null) {
        recyclableExecutions = new ArrayList<ActivityExecution>(_recyclableExecutions);
    }
    // execution).
    if (recyclableExecutions.size() > 1) {
        removeVariablesLocalInternal();
    }
    // the activity.
    for (ActivityExecution execution : recyclableExecutions) {
        execution.setEnded(true);
    }
    // remove 'this' from recyclable executions to
    // leave the activity with 'this' execution
    // (when 'this' execution is the last concurrent
    // execution, then 'this' execution will be pruned,
    // and the activity is left with the scope
    // execution)
    recyclableExecutions.remove(this);
    for (ActivityExecution execution : recyclableExecutions) {
        execution.end(_transitions.isEmpty());
    }
    PvmExecutionImpl propagatingExecution = this;
    if (getReplacedBy() != null) {
        propagatingExecution = getReplacedBy();
    }
    propagatingExecution.isActive = true;
    propagatingExecution.isEnded = false;
    if (_transitions.isEmpty()) {
        propagatingExecution.end(!propagatingExecution.isConcurrent());
    } else {
        propagatingExecution.setTransitionsToTake(_transitions);
        propagatingExecution.performOperation(PvmAtomicOperation.TRANSITION_NOTIFY_LISTENER_END);
    }
}
Also used : ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)

Aggregations

ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)21 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)6 ArrayList (java.util.ArrayList)5 PvmTransition (org.camunda.bpm.engine.impl.pvm.PvmTransition)5 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)4 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)3 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)2 BpmnError (org.camunda.bpm.engine.delegate.BpmnError)1 Condition (org.camunda.bpm.engine.impl.Condition)1 ExternalTaskActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.ExternalTaskActivityBehavior)1 VariableInstanceEntity (org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)1 PvmScope (org.camunda.bpm.engine.impl.pvm.PvmScope)1 ModificationObserverBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ModificationObserverBehavior)1 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)1 TransitionImpl (org.camunda.bpm.engine.impl.pvm.process.TransitionImpl)1 ExecutionStartContext (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext)1 InstantiationStack (org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack)1