use of org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl in project camunda-engine-dmn by camunda.
the class DmnDecisionTableRuleTransformHandler method createFromRule.
protected DmnDecisionTableRuleImpl createFromRule(DmnElementTransformContext context, Rule rule) {
DmnDecisionTableRuleImpl decisionTableRule = createDmnElement(context, rule);
decisionTableRule.setId(rule.getId());
decisionTableRule.setName(rule.getLabel());
return decisionTableRule;
}
use of org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl in project camunda-engine-dmn by camunda.
the class DecisionTableEvaluationHandler method evaluateDecisionTable.
protected void evaluateDecisionTable(DmnDecisionTableImpl decisionTable, VariableContext variableContext, DmnDecisionTableEvaluationEventImpl evaluationResult) {
int inputSize = decisionTable.getInputs().size();
List<DmnDecisionTableRuleImpl> matchingRules = new ArrayList<DmnDecisionTableRuleImpl>(decisionTable.getRules());
for (int inputIdx = 0; inputIdx < inputSize; inputIdx++) {
// evaluate input
DmnDecisionTableInputImpl input = decisionTable.getInputs().get(inputIdx);
DmnEvaluatedInput evaluatedInput = evaluateInput(input, variableContext);
evaluationResult.getInputs().add(evaluatedInput);
// compose local variable context out of global variable context enhanced with the value of the current input.
VariableContext localVariableContext = getLocalVariableContext(input, evaluatedInput, variableContext);
// filter rules applicable with this input
matchingRules = evaluateInputForAvailableRules(inputIdx, input, matchingRules, localVariableContext);
}
setEvaluationOutput(decisionTable, matchingRules, variableContext, evaluationResult);
}
use of org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl in project camunda-engine-dmn by camunda.
the class DecisionTableEvaluationHandler method setEvaluationOutput.
protected void setEvaluationOutput(DmnDecisionTableImpl decisionTable, List<DmnDecisionTableRuleImpl> matchingRules, VariableContext variableContext, DmnDecisionTableEvaluationEventImpl evaluationResult) {
List<DmnDecisionTableOutputImpl> decisionTableOutputs = decisionTable.getOutputs();
List<DmnEvaluatedDecisionRule> evaluatedDecisionRules = new ArrayList<DmnEvaluatedDecisionRule>();
for (DmnDecisionTableRuleImpl matchingRule : matchingRules) {
DmnEvaluatedDecisionRule evaluatedRule = evaluateMatchingRule(decisionTableOutputs, matchingRule, variableContext);
evaluatedDecisionRules.add(evaluatedRule);
}
evaluationResult.setMatchingRules(evaluatedDecisionRules);
}
Aggregations