use of org.camunda.bpm.dmn.engine.impl.delegate.DmnDecisionTableEvaluationEventImpl in project camunda-engine-dmn by camunda.
the class DecisionTableEvaluationHandler method evaluate.
@Override
public DmnDecisionLogicEvaluationEvent evaluate(DmnDecision decision, VariableContext variableContext) {
DmnDecisionTableEvaluationEventImpl evaluationResult = new DmnDecisionTableEvaluationEventImpl();
evaluationResult.setDecisionTable(decision);
DmnDecisionTableImpl decisionTable = (DmnDecisionTableImpl) decision.getDecisionLogic();
evaluationResult.setExecutedDecisionElements(calculateExecutedDecisionElements(decisionTable));
evaluateDecisionTable(decisionTable, variableContext, evaluationResult);
// apply hit policy
decisionTable.getHitPolicyHandler().apply(evaluationResult);
// notify listeners
for (DmnDecisionTableEvaluationListener evaluationListener : evaluationListeners) {
evaluationListener.notify(evaluationResult);
}
return evaluationResult;
}
use of org.camunda.bpm.dmn.engine.impl.delegate.DmnDecisionTableEvaluationEventImpl in project camunda-engine-dmn by camunda.
the class AbstractCollectNumberHitPolicyHandler method apply.
public DmnDecisionTableEvaluationEvent apply(DmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) {
String resultName = getResultName(decisionTableEvaluationEvent);
TypedValue resultValue = getResultValue(decisionTableEvaluationEvent);
DmnDecisionTableEvaluationEventImpl evaluationEvent = (DmnDecisionTableEvaluationEventImpl) decisionTableEvaluationEvent;
evaluationEvent.setCollectResultName(resultName);
evaluationEvent.setCollectResultValue(resultValue);
return evaluationEvent;
}
use of org.camunda.bpm.dmn.engine.impl.delegate.DmnDecisionTableEvaluationEventImpl in project camunda-engine-dmn by camunda.
the class AnyHitPolicyHandler method apply.
public DmnDecisionTableEvaluationEvent apply(DmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) {
List<DmnEvaluatedDecisionRule> matchingRules = decisionTableEvaluationEvent.getMatchingRules();
if (!matchingRules.isEmpty()) {
if (allOutputsAreEqual(matchingRules)) {
DmnEvaluatedDecisionRule firstMatchingRule = matchingRules.get(0);
((DmnDecisionTableEvaluationEventImpl) decisionTableEvaluationEvent).setMatchingRules(Collections.singletonList(firstMatchingRule));
} else {
throw LOG.anyHitPolicyRequiresThatAllOutputsAreEqual(matchingRules);
}
}
return decisionTableEvaluationEvent;
}
use of org.camunda.bpm.dmn.engine.impl.delegate.DmnDecisionTableEvaluationEventImpl in project camunda-engine-dmn by camunda.
the class FirstHitPolicyHandler method apply.
public DmnDecisionTableEvaluationEvent apply(DmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) {
if (!decisionTableEvaluationEvent.getMatchingRules().isEmpty()) {
DmnEvaluatedDecisionRule firstMatchedRule = decisionTableEvaluationEvent.getMatchingRules().get(0);
((DmnDecisionTableEvaluationEventImpl) decisionTableEvaluationEvent).setMatchingRules(Collections.singletonList(firstMatchedRule));
}
return decisionTableEvaluationEvent;
}
Aggregations