Search in sources :

Example 1 with EscalationEventDefinition

use of org.camunda.bpm.engine.impl.bpmn.parser.EscalationEventDefinition in project camunda-bpm-platform by camunda.

the class ThrowEscalationEventActivityBehavior method execute.

@Override
public void execute(ActivityExecution execution) throws Exception {
    final PvmActivity currentActivity = execution.getActivity();
    final EscalationEventDefinitionFinder escalationEventDefinitionFinder = new EscalationEventDefinitionFinder(escalation.getEscalationCode(), currentActivity);
    ActivityExecutionMappingCollector activityExecutionMappingCollector = new ActivityExecutionMappingCollector(execution);
    ActivityExecutionHierarchyWalker walker = new ActivityExecutionHierarchyWalker(execution);
    walker.addScopePreVisitor(escalationEventDefinitionFinder);
    walker.addExecutionPreVisitor(activityExecutionMappingCollector);
    walker.addExecutionPreVisitor(new OutputVariablesPropagator());
    walker.walkUntil(new ReferenceWalker.WalkCondition<ActivityExecutionTuple>() {

        @Override
        public boolean isFulfilled(ActivityExecutionTuple element) {
            return escalationEventDefinitionFinder.getEscalationEventDefinition() != null || element == null;
        }
    });
    EscalationEventDefinition escalationEventDefinition = escalationEventDefinitionFinder.getEscalationEventDefinition();
    if (escalationEventDefinition != null) {
        executeEscalationHandler(escalationEventDefinition, activityExecutionMappingCollector);
    }
    if (escalationEventDefinition == null || !escalationEventDefinition.isCancelActivity()) {
        leaveExecution(execution, currentActivity, escalationEventDefinition);
    }
}
Also used : ActivityExecutionMappingCollector(org.camunda.bpm.engine.impl.tree.ActivityExecutionMappingCollector) ActivityExecutionHierarchyWalker(org.camunda.bpm.engine.impl.tree.ActivityExecutionHierarchyWalker) EscalationEventDefinition(org.camunda.bpm.engine.impl.bpmn.parser.EscalationEventDefinition) ReferenceWalker(org.camunda.bpm.engine.impl.tree.ReferenceWalker) OutputVariablesPropagator(org.camunda.bpm.engine.impl.tree.OutputVariablesPropagator) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity) ActivityExecutionTuple(org.camunda.bpm.engine.impl.tree.ActivityExecutionTuple)

Aggregations

EscalationEventDefinition (org.camunda.bpm.engine.impl.bpmn.parser.EscalationEventDefinition)1 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)1 ActivityExecutionHierarchyWalker (org.camunda.bpm.engine.impl.tree.ActivityExecutionHierarchyWalker)1 ActivityExecutionMappingCollector (org.camunda.bpm.engine.impl.tree.ActivityExecutionMappingCollector)1 ActivityExecutionTuple (org.camunda.bpm.engine.impl.tree.ActivityExecutionTuple)1 OutputVariablesPropagator (org.camunda.bpm.engine.impl.tree.OutputVariablesPropagator)1 ReferenceWalker (org.camunda.bpm.engine.impl.tree.ReferenceWalker)1