Search in sources :

Example 11 with ActivityExecution

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

the class ParallelGatewayActivityBehavior method execute.

public void execute(ActivityExecution execution) throws Exception {
    // Join
    PvmActivity activity = execution.getActivity();
    List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
    execution.inactivate();
    lockConcurrentRoot(execution);
    List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
    int nbrOfExecutionsToJoin = execution.getActivity().getIncomingTransitions().size();
    int nbrOfExecutionsJoined = joinedExecutions.size();
    if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {
        // Fork
        LOG.activityActivation(activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
        execution.leaveActivityViaTransitions(outgoingTransitions, joinedExecutions);
    } else {
        LOG.noActivityActivation(activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
    }
}
Also used : ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity) PvmTransition(org.camunda.bpm.engine.impl.pvm.PvmTransition)

Example 12 with ActivityExecution

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

the class ExternalTaskEntity method bpmnError.

public void bpmnError(String errorCode) {
    ensureActive();
    ActivityExecution activityExecution = getExecution();
    BpmnError bpmnError = new BpmnError(errorCode);
    try {
        ExternalTaskActivityBehavior behavior = ((ExternalTaskActivityBehavior) activityExecution.getActivity().getActivityBehavior());
        behavior.propagateBpmnError(bpmnError, activityExecution);
    } catch (Exception ex) {
        throw ProcessEngineLogger.CMD_LOGGER.exceptionBpmnErrorPropagationFailed(errorCode, ex);
    }
}
Also used : ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) ExternalTaskActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.ExternalTaskActivityBehavior)

Example 13 with ActivityExecution

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

the class ParallelMultiInstanceActivityBehavior method createConcurrentExecution.

protected ActivityExecution createConcurrentExecution(ActivityExecution scopeExecution) {
    ActivityExecution concurrentChild = scopeExecution.createExecution();
    scopeExecution.forceUpdate();
    concurrentChild.setConcurrent(true);
    concurrentChild.setScope(false);
    return concurrentChild;
}
Also used : ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)

Example 14 with ActivityExecution

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

the class ParallelMultiInstanceActivityBehavior method destroyInnerInstance.

@Override
public void destroyInnerInstance(ActivityExecution concurrentExecution) {
    ActivityExecution scopeExecution = concurrentExecution.getParent();
    concurrentExecution.remove();
    scopeExecution.forceUpdate();
    int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES);
    setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances - 1);
}
Also used : ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)

Example 15 with ActivityExecution

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

the class ParallelMultiInstanceActivityBehavior method createInnerInstance.

@Override
public ActivityExecution createInnerInstance(ActivityExecution scopeExecution) {
    // even though there is only one instance, there is always a concurrent child
    ActivityExecution concurrentChild = createConcurrentExecution(scopeExecution);
    int nrOfInstances = getLoopVariable(scopeExecution, NUMBER_OF_INSTANCES);
    setLoopVariable(scopeExecution, NUMBER_OF_INSTANCES, nrOfInstances + 1);
    int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES);
    setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances + 1);
    setLoopVariable(concurrentChild, LOOP_COUNTER, nrOfInstances);
    return concurrentChild;
}
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