Search in sources :

Example 1 with DmnEvaluatedOutputImpl

use of org.camunda.bpm.dmn.engine.impl.delegate.DmnEvaluatedOutputImpl in project camunda-engine-dmn by camunda.

the class DecisionTableEvaluationHandler method evaluateOutputEntries.

protected Map<String, DmnEvaluatedOutput> evaluateOutputEntries(List<DmnDecisionTableOutputImpl> decisionTableOutputs, DmnDecisionTableRuleImpl matchingRule, VariableContext variableContext) {
    Map<String, DmnEvaluatedOutput> outputEntries = new LinkedHashMap<String, DmnEvaluatedOutput>();
    for (int outputIdx = 0; outputIdx < decisionTableOutputs.size(); outputIdx++) {
        // evaluate output entry, skip empty expressions
        DmnExpressionImpl conclusion = matchingRule.getConclusions().get(outputIdx);
        if (isNonEmptyExpression(conclusion)) {
            Object value = evaluateOutputEntry(conclusion, variableContext);
            // transform to output type
            DmnDecisionTableOutputImpl decisionTableOutput = decisionTableOutputs.get(outputIdx);
            TypedValue typedValue = decisionTableOutput.getTypeDefinition().transform(value);
            // set on result
            DmnEvaluatedOutputImpl evaluatedOutput = new DmnEvaluatedOutputImpl(decisionTableOutput, typedValue);
            outputEntries.put(decisionTableOutput.getOutputName(), evaluatedOutput);
        }
    }
    return outputEntries;
}
Also used : DmnDecisionTableOutputImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableOutputImpl) DmnExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl) DmnEvaluatedOutput(org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedOutput) DmnEvaluatedOutputImpl(org.camunda.bpm.dmn.engine.impl.delegate.DmnEvaluatedOutputImpl) LinkedHashMap(java.util.LinkedHashMap) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)1 DmnEvaluatedOutput (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedOutput)1 DmnDecisionTableOutputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableOutputImpl)1 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)1 DmnEvaluatedOutputImpl (org.camunda.bpm.dmn.engine.impl.delegate.DmnEvaluatedOutputImpl)1 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)1