Search in sources :

Example 6 with ActivityExecution

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

the class ThrowEscalationEventActivityBehavior method executeEscalationHandler.

protected void executeEscalationHandler(EscalationEventDefinition escalationEventDefinition, ActivityExecutionMappingCollector activityExecutionMappingCollector) {
    PvmActivity escalationHandler = escalationEventDefinition.getEscalationHandler();
    PvmScope escalationScope = getScopeForEscalation(escalationEventDefinition);
    ActivityExecution escalationExecution = activityExecutionMappingCollector.getExecutionForScope(escalationScope);
    if (escalationEventDefinition.getEscalationCodeVariable() != null) {
        escalationExecution.setVariable(escalationEventDefinition.getEscalationCodeVariable(), escalation.getEscalationCode());
    }
    escalationExecution.executeActivity(escalationHandler);
}
Also used : PvmScope(org.camunda.bpm.engine.impl.pvm.PvmScope) ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 7 with ActivityExecution

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

the class AbstractBpmnActivityBehavior method signalCompensationDone.

protected void signalCompensationDone(ActivityExecution execution) {
    if (((PvmExecutionImpl) execution).getNonEventScopeExecutions().isEmpty()) {
        if (execution.getParent() != null) {
            ActivityExecution parent = execution.getParent();
            execution.remove();
            parent.signal(SIGNAL_COMPENSATION_DONE, null);
        }
    } else {
        ((ExecutionEntity) execution).forceUpdate();
    }
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)

Example 8 with ActivityExecution

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

the class CancelEndEventActivityBehavior method doLeave.

public void doLeave(ActivityExecution execution) {
    // continue via the appropriate cancel boundary event
    ScopeImpl eventScope = (ScopeImpl) cancelBoundaryEvent.getEventScope();
    ActivityExecution boundaryEventScopeExecution = execution.findExecutionForFlowScope(eventScope);
    boundaryEventScopeExecution.executeActivity(cancelBoundaryEvent);
}
Also used : ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)

Example 9 with ActivityExecution

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

the class InclusiveGatewayActivityBehavior method execute.

public void execute(ActivityExecution execution) throws Exception {
    execution.inactivate();
    lockConcurrentRoot(execution);
    PvmActivity activity = execution.getActivity();
    if (activatesGateway(execution, activity)) {
        LOG.activityActivation(activity.getId());
        List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
        String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
        List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();
        // find matching non-default sequence flows
        for (PvmTransition outgoingTransition : execution.getActivity().getOutgoingTransitions()) {
            if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
                Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
                if (condition == null || condition.evaluate(execution)) {
                    transitionsToTake.add(outgoingTransition);
                }
            }
        }
        // if none found, add default flow
        if (transitionsToTake.isEmpty()) {
            if (defaultSequenceFlow != null) {
                PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
                if (defaultTransition == null) {
                    throw LOG.missingDefaultFlowException(execution.getActivity().getId(), defaultSequenceFlow);
                }
                transitionsToTake.add(defaultTransition);
            } else {
                // No sequence flow could be found, not even a default one
                throw LOG.stuckExecutionException(execution.getActivity().getId());
            }
        }
        // take the flows found
        execution.leaveActivityViaTransitions(transitionsToTake, joinedExecutions);
    } else {
        LOG.noActivityActivation(activity.getId());
    }
}
Also used : Condition(org.camunda.bpm.engine.impl.Condition) ArrayList(java.util.ArrayList) 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 10 with ActivityExecution

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

the class InclusiveGatewayActivityBehavior method getLeafExecutions.

protected Collection<ActivityExecution> getLeafExecutions(ActivityExecution parent) {
    List<ActivityExecution> executionlist = new ArrayList<ActivityExecution>();
    List<? extends ActivityExecution> subExecutions = parent.getNonEventScopeExecutions();
    if (subExecutions.size() == 0) {
        executionlist.add(parent);
    } else {
        for (ActivityExecution concurrentExecution : subExecutions) {
            executionlist.addAll(getLeafExecutions(concurrentExecution));
        }
    }
    return executionlist;
}
Also used : ArrayList(java.util.ArrayList) 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