Search in sources :

Example 11 with DecisionTable

use of org.camunda.bpm.model.dmn.instance.DecisionTable in project camunda-engine-dmn by camunda.

the class DefaultDmnTransform method transformDecision.

protected DmnDecisionImpl transformDecision(Decision decision) {
    DmnElementTransformHandler<Decision, DmnDecisionImpl> handler = handlerRegistry.getHandler(Decision.class);
    DmnDecisionImpl dmnDecision = handler.handleElement(this, decision);
    this.decision = dmnDecision;
    // validate decision id
    if (dmnDecision.getKey() == null) {
        throw LOG.decisionIdIsMissing(dmnDecision);
    }
    Expression expression = decision.getExpression();
    if (expression == null) {
        LOG.decisionWithoutExpression(decision);
        return null;
    }
    if (expression instanceof DecisionTable) {
        DmnDecisionTableImpl dmnDecisionTable = transformDecisionTable((DecisionTable) expression);
        dmnDecision.setDecisionLogic(dmnDecisionTable);
    } else if (expression instanceof LiteralExpression) {
        DmnDecisionLiteralExpressionImpl dmnDecisionLiteralExpression = transformDecisionLiteralExpression(decision, (LiteralExpression) expression);
        dmnDecision.setDecisionLogic(dmnDecisionLiteralExpression);
    } else {
        LOG.decisionTypeNotSupported(expression, decision);
        return null;
    }
    return dmnDecision;
}
Also used : DecisionTable(org.camunda.bpm.model.dmn.instance.DecisionTable) DmnDecisionTableImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) InputExpression(org.camunda.bpm.model.dmn.instance.InputExpression) Expression(org.camunda.bpm.model.dmn.instance.Expression) DmnDecisionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) DmnDecisionLiteralExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision) Decision(org.camunda.bpm.model.dmn.instance.Decision)

Aggregations

DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)11 Output (org.camunda.bpm.model.dmn.instance.Output)10 Decision (org.camunda.bpm.model.dmn.instance.Decision)8 Definitions (org.camunda.bpm.model.dmn.instance.Definitions)7 Input (org.camunda.bpm.model.dmn.instance.Input)7 Rule (org.camunda.bpm.model.dmn.instance.Rule)6 Test (org.junit.Test)6 InputExpression (org.camunda.bpm.model.dmn.instance.InputExpression)5 InputEntry (org.camunda.bpm.model.dmn.instance.InputEntry)4 OutputEntry (org.camunda.bpm.model.dmn.instance.OutputEntry)4 InputValues (org.camunda.bpm.model.dmn.instance.InputValues)3 OutputValues (org.camunda.bpm.model.dmn.instance.OutputValues)3 Text (org.camunda.bpm.model.dmn.instance.Text)3 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)2 DmnModelInstance (org.camunda.bpm.model.dmn.DmnModelInstance)2 Expression (org.camunda.bpm.model.dmn.instance.Expression)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)1