Search in sources :

Example 1 with DmnDecisionResultImpl

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

the class DecisionLiteralExpressionEvaluationHandler method generateDecisionResult.

@Override
public DmnDecisionResult generateDecisionResult(DmnDecisionLogicEvaluationEvent event) {
    DmnDecisionLiteralExpressionEvaluationEvent evaluationEvent = (DmnDecisionLiteralExpressionEvaluationEvent) event;
    DmnDecisionResultEntriesImpl result = new DmnDecisionResultEntriesImpl();
    result.putValue(evaluationEvent.getOutputName(), evaluationEvent.getOutputValue());
    return new DmnDecisionResultImpl(Collections.<DmnDecisionResultEntries>singletonList(result));
}
Also used : DmnDecisionResultImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultImpl) DmnDecisionLiteralExpressionEvaluationEvent(org.camunda.bpm.dmn.engine.delegate.DmnDecisionLiteralExpressionEvaluationEvent) DmnDecisionResultEntriesImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultEntriesImpl)

Example 2 with DmnDecisionResultImpl

use of org.camunda.bpm.dmn.engine.impl.DmnDecisionResultImpl 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

DmnDecisionResultEntriesImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultEntriesImpl)2 DmnDecisionResultImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultImpl)2 ArrayList (java.util.ArrayList)1 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)1 DmnDecisionLiteralExpressionEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionLiteralExpressionEvaluationEvent)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