Search in sources :

Example 1 with VariableContext

use of org.camunda.bpm.engine.variable.context.VariableContext 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);
}
Also used : DmnDecisionTableInputImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl) DmnEvaluatedInput(org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedInput) DmnDecisionTableRuleImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl) ArrayList(java.util.ArrayList) CompositeVariableContext(org.camunda.bpm.engine.variable.impl.context.CompositeVariableContext) VariableContext(org.camunda.bpm.engine.variable.context.VariableContext)

Aggregations

ArrayList (java.util.ArrayList)1 DmnEvaluatedInput (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedInput)1 DmnDecisionTableInputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl)1 DmnDecisionTableRuleImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl)1 VariableContext (org.camunda.bpm.engine.variable.context.VariableContext)1 CompositeVariableContext (org.camunda.bpm.engine.variable.impl.context.CompositeVariableContext)1