Search in sources :

Example 1 with DMNConditionalEvaluator

use of org.kie.dmn.core.ast.DMNConditionalEvaluator in project drools by kiegroup.

the class DMNEvaluatorCompiler method compileConditional.

private DMNExpressionEvaluator compileConditional(DMNCompilerContext ctx, DMNModelImpl model, DMNBaseNode node, String exprName, Conditional expression) {
    DMNExpressionEvaluator ifEvaluator = compileExpression(ctx, model, node, exprName + " [if]", expression.getIf().getExpression());
    DMNExpressionEvaluator thenEvaluator = compileExpression(ctx, model, node, exprName + " [then]", expression.getThen().getExpression());
    DMNExpressionEvaluator elseEvaluator = compileExpression(ctx, model, node, exprName + " [else]", expression.getElse().getExpression());
    if (ifEvaluator == null) {
        MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, node.getSource(), model, null, null, Msg.MISSING_EXPRESSION_FOR_CONDITION, "if", node.getIdentifierString());
        return null;
    }
    if (thenEvaluator == null) {
        MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, node.getSource(), model, null, null, Msg.MISSING_EXPRESSION_FOR_CONDITION, "then", node.getIdentifierString());
        return null;
    }
    if (elseEvaluator == null) {
        MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, node.getSource(), model, null, null, Msg.MISSING_EXPRESSION_FOR_CONDITION, "else", node.getIdentifierString());
        return null;
    }
    return new DMNConditionalEvaluator(exprName, node.getSource(), ifEvaluator, thenEvaluator, elseEvaluator);
}
Also used : DMNExpressionEvaluator(org.kie.dmn.core.api.DMNExpressionEvaluator) DMNConditionalEvaluator(org.kie.dmn.core.ast.DMNConditionalEvaluator)

Aggregations

DMNExpressionEvaluator (org.kie.dmn.core.api.DMNExpressionEvaluator)1 DMNConditionalEvaluator (org.kie.dmn.core.ast.DMNConditionalEvaluator)1