Search in sources :

Example 1 with BIND_CALL

use of org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder.BIND_CALL in project drools by kiegroup.

the class AccumulateVisitorPatternDSL method buildBinding.

@Override
protected MethodCallExpr buildBinding(String bindingName, Collection<String> usedDeclaration, Expression expression) {
    MethodCallExpr bindDSL = new MethodCallExpr(null, BIND_CALL);
    bindDSL.addArgument(toVar(bindingName));
    usedDeclaration.stream().map(d -> new NameExpr(toVar(d))).forEach(bindDSL::addArgument);
    bindDSL.addArgument(buildConstraintExpression(expression, usedDeclaration));
    return bindDSL;
}
Also used : PackageModel(org.drools.modelcompiler.builder.PackageModel) Parameter(org.drools.javaparser.ast.body.Parameter) Expression(org.drools.javaparser.ast.expr.Expression) ModelGeneratorVisitor(org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor) Collection(java.util.Collection) DrlxParseUtil(org.drools.modelcompiler.builder.generator.DrlxParseUtil) BIND_CALL(org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder.BIND_CALL) NameExpr(org.drools.javaparser.ast.expr.NameExpr) DrlxParseUtil.fromVar(org.drools.modelcompiler.builder.generator.DrlxParseUtil.fromVar) RuleContext(org.drools.modelcompiler.builder.generator.RuleContext) List(java.util.List) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr) DrlxParseUtil.toVar(org.drools.modelcompiler.builder.generator.DrlxParseUtil.toVar) Optional(java.util.Optional) LambdaExpr(org.drools.javaparser.ast.expr.LambdaExpr) PatternExpressionBuilder(org.drools.modelcompiler.builder.generator.expression.PatternExpressionBuilder) Node(org.drools.javaparser.ast.Node) NameExpr(org.drools.javaparser.ast.expr.NameExpr) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr)

Example 2 with BIND_CALL

use of org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder.BIND_CALL in project drools by kiegroup.

the class AccumulateVisitorFlowDSL method buildBinding.

@Override
protected MethodCallExpr buildBinding(String bindingName, Collection<String> usedDeclaration, Expression expression) {
    MethodCallExpr bindDSL = new MethodCallExpr(null, BIND_CALL);
    bindDSL.addArgument(toVar(bindingName));
    MethodCallExpr bindAsDSL = new MethodCallExpr(bindDSL, BIND_AS_CALL);
    usedDeclaration.stream().map(d -> new NameExpr(toVar(d))).forEach(bindAsDSL::addArgument);
    bindAsDSL.addArgument(buildConstraintExpression(expression, usedDeclaration));
    return bindAsDSL;
}
Also used : PackageModel(org.drools.modelcompiler.builder.PackageModel) Parameter(org.drools.javaparser.ast.body.Parameter) Expression(org.drools.javaparser.ast.expr.Expression) ModelGeneratorVisitor(org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor) BIND_AS_CALL(org.drools.modelcompiler.builder.generator.ModelGenerator.BIND_AS_CALL) FlowExpressionBuilder(org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder) Collection(java.util.Collection) BIND_CALL(org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder.BIND_CALL) Collectors(java.util.stream.Collectors) NameExpr(org.drools.javaparser.ast.expr.NameExpr) DrlxParseUtil.fromVar(org.drools.modelcompiler.builder.generator.DrlxParseUtil.fromVar) ArrayList(java.util.ArrayList) RuleContext(org.drools.modelcompiler.builder.generator.RuleContext) List(java.util.List) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr) DrlxParseUtil.toVar(org.drools.modelcompiler.builder.generator.DrlxParseUtil.toVar) Optional(java.util.Optional) LambdaExpr(org.drools.javaparser.ast.expr.LambdaExpr) NameExpr(org.drools.javaparser.ast.expr.NameExpr) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr)

Aggregations

Collection (java.util.Collection)2 List (java.util.List)2 Optional (java.util.Optional)2 Parameter (org.drools.javaparser.ast.body.Parameter)2 Expression (org.drools.javaparser.ast.expr.Expression)2 LambdaExpr (org.drools.javaparser.ast.expr.LambdaExpr)2 MethodCallExpr (org.drools.javaparser.ast.expr.MethodCallExpr)2 NameExpr (org.drools.javaparser.ast.expr.NameExpr)2 PackageModel (org.drools.modelcompiler.builder.PackageModel)2 DrlxParseUtil.fromVar (org.drools.modelcompiler.builder.generator.DrlxParseUtil.fromVar)2 DrlxParseUtil.toVar (org.drools.modelcompiler.builder.generator.DrlxParseUtil.toVar)2 RuleContext (org.drools.modelcompiler.builder.generator.RuleContext)2 BIND_CALL (org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder.BIND_CALL)2 ModelGeneratorVisitor (org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor)2 ArrayList (java.util.ArrayList)1 Collectors (java.util.stream.Collectors)1 Node (org.drools.javaparser.ast.Node)1 DrlxParseUtil (org.drools.modelcompiler.builder.generator.DrlxParseUtil)1 BIND_AS_CALL (org.drools.modelcompiler.builder.generator.ModelGenerator.BIND_AS_CALL)1 FlowExpressionBuilder (org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder)1