Search in sources :

Example 26 with DmnDecisionResultEntries

use of org.camunda.bpm.dmn.engine.DmnDecisionResultEntries in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultImpl method wrap.

public static DmnDecisionTableResultImpl wrap(DmnDecisionResult decisionResult) {
    List<DmnDecisionRuleResult> ruleResults = new ArrayList<DmnDecisionRuleResult>();
    for (DmnDecisionResultEntries result : decisionResult) {
        DmnDecisionRuleResultImpl ruleResult = new DmnDecisionRuleResultImpl();
        ruleResult.putAllValues(result.getEntryMapTyped());
        ruleResults.add(ruleResult);
    }
    return new DmnDecisionTableResultImpl(ruleResults);
}
Also used : DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) ArrayList(java.util.ArrayList)

Example 27 with DmnDecisionResultEntries

use of org.camunda.bpm.dmn.engine.DmnDecisionResultEntries in project camunda-engine-dmn by camunda.

the class DecisionTableEvaluationHandler method generateDecisionResult.

@Override
public DmnDecisionResult generateDecisionResult(DmnDecisionLogicEvaluationEvent event) {
    DmnDecisionTableEvaluationEvent evaluationResult = (DmnDecisionTableEvaluationEvent) event;
    List<DmnDecisionResultEntries> ruleResults = new ArrayList<DmnDecisionResultEntries>();
    if (evaluationResult.getCollectResultName() != null || evaluationResult.getCollectResultValue() != null) {
        DmnDecisionResultEntriesImpl ruleResult = new DmnDecisionResultEntriesImpl();
        ruleResult.putValue(evaluationResult.getCollectResultName(), evaluationResult.getCollectResultValue());
        ruleResults.add(ruleResult);
    } else {
        for (DmnEvaluatedDecisionRule evaluatedRule : evaluationResult.getMatchingRules()) {
            DmnDecisionResultEntriesImpl ruleResult = new DmnDecisionResultEntriesImpl();
            for (DmnEvaluatedOutput evaluatedOutput : evaluatedRule.getOutputEntries().values()) {
                ruleResult.putValue(evaluatedOutput.getOutputName(), evaluatedOutput.getValue());
            }
            ruleResults.add(ruleResult);
        }
    }
    return new DmnDecisionResultImpl(ruleResults);
}
Also used : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) DmnDecisionResultImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultImpl) ArrayList(java.util.ArrayList) DmnEvaluatedOutput(org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedOutput) DmnEvaluatedDecisionRule(org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedDecisionRule) DmnDecisionTableEvaluationEvent(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent) DmnDecisionResultEntriesImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultEntriesImpl)

Aggregations

DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)27 Deployment (org.camunda.bpm.engine.test.Deployment)18 ArrayList (java.util.ArrayList)5 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)4 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)4 Test (org.junit.Test)4 Map (java.util.Map)2 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)2 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)1 DmnDecisionTableEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent)1 DmnEvaluatedDecisionRule (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedDecisionRule)1 DmnEvaluatedOutput (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedOutput)1 DmnDecisionResultEntriesImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultEntriesImpl)1 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)1 DmnDecisionResultImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultImpl)1 VariableValueDto (org.camunda.bpm.engine.rest.dto.VariableValueDto)1 VariableMap (org.camunda.bpm.engine.variable.VariableMap)1