use of org.camunda.bpm.engine.impl.bpmn.parser.ConditionalEventDefinition in project camunda-bpm-platform by camunda.
the class DefaultConditionHandler method evaluateCondition.
protected boolean evaluateCondition(ConditionSet conditionSet, ActivityImpl activity) {
ExecutionEntity temporaryExecution = new ExecutionEntity();
if (conditionSet.getVariables() != null) {
temporaryExecution.initializeVariableStore(conditionSet.getVariables());
}
temporaryExecution.setProcessDefinition(activity.getProcessDefinition());
ConditionalEventDefinition conditionalEventDefinition = activity.getProperties().get(BpmnProperties.CONDITIONAL_EVENT_DEFINITION);
if (conditionalEventDefinition.getVariableName() == null || conditionSet.getVariables().containsKey(conditionalEventDefinition.getVariableName())) {
return conditionalEventDefinition.tryEvaluate(temporaryExecution);
} else {
return false;
}
}
use of org.camunda.bpm.engine.impl.bpmn.parser.ConditionalEventDefinition in project camunda-bpm-platform by camunda.
the class EventBasedGatewayActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
// If conditional events exist after the event based gateway they should be evaluated.
// If a condition is satisfied the event based gateway should be left,
// otherwise the event based gateway is a wait state
ActivityImpl eventBasedGateway = (ActivityImpl) execution.getActivity();
for (ActivityImpl act : eventBasedGateway.getEventActivities()) {
ActivityBehavior activityBehavior = act.getActivityBehavior();
if (activityBehavior instanceof ConditionalEventBehavior) {
ConditionalEventBehavior conditionalEventBehavior = (ConditionalEventBehavior) activityBehavior;
ConditionalEventDefinition conditionalEventDefinition = conditionalEventBehavior.getConditionalEventDefinition();
if (conditionalEventDefinition.tryEvaluate(execution)) {
((ExecutionEntity) execution).executeEventHandlerActivity(conditionalEventDefinition.getConditionalActivity());
return;
}
}
}
}
Aggregations