Search in sources :

Example 1 with Expression

use of org.camunda.bpm.model.dmn.instance.Expression 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

DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)1 DmnDecisionLiteralExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl)1 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)1 Decision (org.camunda.bpm.model.dmn.instance.Decision)1 DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)1 Expression (org.camunda.bpm.model.dmn.instance.Expression)1 InputExpression (org.camunda.bpm.model.dmn.instance.InputExpression)1 LiteralExpression (org.camunda.bpm.model.dmn.instance.LiteralExpression)1