Search in sources :

Example 6 with Binding

use of org.kie.dmn.model.v1_1.Binding in project drools by kiegroup.

the class DMNEvaluatorCompiler method compileInvocation.

private DMNExpressionEvaluator compileInvocation(DMNCompilerContext ctx, DMNModelImpl model, DMNBaseNode node, Invocation expression) {
    Invocation invocation = expression;
    // expression must be a literal text with the name of the function
    String functionName = ((LiteralExpression) invocation.getExpression()).getText();
    DMNInvocationEvaluator invEval = new DMNInvocationEvaluator(node.getName(), node.getSource(), functionName, invocation, null, feel.newFEELInstance());
    for (Binding binding : invocation.getBinding()) {
        if (binding.getParameter() == null) {
            // error, missing binding parameter
            MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, binding, model, null, null, Msg.MISSING_PARAMETER_FOR_INVOCATION, node.getIdentifierString());
            return null;
        }
        if (binding.getExpression() == null) {
            MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, binding, model, null, null, Msg.MISSING_PARAMETER_FOR_INVOCATION, node.getIdentifierString());
            return null;
        }
        invEval.addParameter(binding.getParameter().getName(), compiler.resolveTypeRef(model, node, binding.getParameter(), binding.getParameter(), binding.getParameter().getTypeRef()), compileExpression(ctx, model, node, binding.getParameter().getName(), binding.getExpression()));
    }
    return invEval;
}
Also used : Binding(org.kie.dmn.model.v1_1.Binding) Invocation(org.kie.dmn.model.v1_1.Invocation) LiteralExpression(org.kie.dmn.model.v1_1.LiteralExpression) DMNInvocationEvaluator(org.kie.dmn.core.ast.DMNInvocationEvaluator)

Example 7 with Binding

use of org.kie.dmn.model.v1_1.Binding in project drools by kiegroup.

the class BindingConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Binding b = (Binding) parent;
    writeChildrenNode(writer, context, b.getParameter(), PARAMETER);
    if (b.getExpression() != null)
        writeChildrenNode(writer, context, b.getExpression(), MarshallingUtils.defineExpressionNodeName(b.getExpression()));
}
Also used : Binding(org.kie.dmn.model.v1_1.Binding)

Aggregations

Binding (com.google.iam.v1.Binding)3 Policy (com.google.iam.v1.Policy)3 Binding (org.kie.dmn.model.v1_1.Binding)3 Invocation (org.kie.dmn.model.v1_1.Invocation)2 SubscriptionAdminClient (com.google.cloud.pubsub.spi.v1.SubscriptionAdminClient)1 TopicAdminClient (com.google.cloud.pubsub.spi.v1.TopicAdminClient)1 ByteString (com.google.protobuf.ByteString)1 SubscriptionName (com.google.pubsub.v1.SubscriptionName)1 TopicName (com.google.pubsub.v1.TopicName)1 XStream (com.thoughtworks.xstream.XStream)1 Test (org.junit.Test)1 DMNExtensionRegister (org.kie.dmn.api.marshalling.v1_1.DMNExtensionRegister)1 DMNInvocationEvaluator (org.kie.dmn.core.ast.DMNInvocationEvaluator)1 DMNElement (org.kie.dmn.model.v1_1.DMNElement)1 Definitions (org.kie.dmn.model.v1_1.Definitions)1 LiteralExpression (org.kie.dmn.model.v1_1.LiteralExpression)1 XStreamUtils.createTrustingXStream (org.kie.soup.commons.xstream.XStreamUtils.createTrustingXStream)1