Search in sources :

Example 1 with DmnDecisionTableEvaluationEvent

use of org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent in project camunda-bpm-platform by camunda.

the class DefaultDmnHistoryEventProducer method initDecisionInstanceEvent.

protected void initDecisionInstanceEvent(HistoricDecisionInstanceEntity event, DmnDecisionLogicEvaluationEvent evaluationEvent, HistoryEventTypes eventType) {
    event.setEventType(eventType.getEventName());
    DecisionDefinition decision = (DecisionDefinition) evaluationEvent.getDecision();
    event.setDecisionDefinitionId(decision.getId());
    event.setDecisionDefinitionKey(decision.getKey());
    event.setDecisionDefinitionName(decision.getName());
    if (decision.getDecisionRequirementsDefinitionId() != null) {
        event.setDecisionRequirementsDefinitionId(decision.getDecisionRequirementsDefinitionId());
        event.setDecisionRequirementsDefinitionKey(decision.getDecisionRequirementsDefinitionKey());
    }
    if (evaluationEvent instanceof DmnDecisionTableEvaluationEvent) {
        initDecisionInstanceEventForDecisionTable(event, (DmnDecisionTableEvaluationEvent) evaluationEvent);
    } else if (evaluationEvent instanceof DmnDecisionLiteralExpressionEvaluationEvent) {
        initDecisionInstanceEventForDecisionLiteralExpression(event, (DmnDecisionLiteralExpressionEvaluationEvent) evaluationEvent);
    } else {
        event.setInputs(Collections.<HistoricDecisionInputInstance>emptyList());
        event.setOutputs(Collections.<HistoricDecisionOutputInstance>emptyList());
    }
}
Also used : HistoricDecisionInputInstance(org.camunda.bpm.engine.history.HistoricDecisionInputInstance) DmnDecisionLiteralExpressionEvaluationEvent(org.camunda.bpm.dmn.engine.delegate.DmnDecisionLiteralExpressionEvaluationEvent) DmnDecisionTableEvaluationEvent(org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent) HistoricDecisionOutputInstance(org.camunda.bpm.engine.history.HistoricDecisionOutputInstance) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 2 with DmnDecisionTableEvaluationEvent

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

DmnDecisionTableEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent)2 ArrayList (java.util.ArrayList)1 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)1 DmnDecisionLiteralExpressionEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionLiteralExpressionEvaluationEvent)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 DmnDecisionResultImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultImpl)1 HistoricDecisionInputInstance (org.camunda.bpm.engine.history.HistoricDecisionInputInstance)1 HistoricDecisionOutputInstance (org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)1 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)1