Search in sources :

Example 6 with DmnDecisionTableRuleImpl

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;
}
Also used : DmnDecisionTableRuleImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl)

Example 7 with DmnDecisionTableRuleImpl

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);
}
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)

Example 8 with DmnDecisionTableRuleImpl

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);
}
Also used : DmnDecisionTableOutputImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableOutputImpl) ArrayList(java.util.ArrayList) DmnDecisionTableRuleImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl) DmnEvaluatedDecisionRule(org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedDecisionRule)

Aggregations

DmnDecisionTableRuleImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl)8 DmnDecisionTableInputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl)4 ArrayList (java.util.ArrayList)3 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)3 DmnDecisionTableOutputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableOutputImpl)3 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)3 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)3 Rule (org.camunda.bpm.model.dmn.instance.Rule)3 Test (org.junit.Test)3 HashSet (java.util.HashSet)1 DmnEvaluatedDecisionRule (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedDecisionRule)1 DmnEvaluatedInput (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedInput)1 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)1 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)1 VariableContext (org.camunda.bpm.engine.variable.context.VariableContext)1 CompositeVariableContext (org.camunda.bpm.engine.variable.impl.context.CompositeVariableContext)1 DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)1 Input (org.camunda.bpm.model.dmn.instance.Input)1 InputEntry (org.camunda.bpm.model.dmn.instance.InputEntry)1 Output (org.camunda.bpm.model.dmn.instance.Output)1