Search in sources :

Example 6 with CompiledBlockResult

use of org.drools.mvelcompiler.CompiledBlockResult in project drools by kiegroup.

the class Consequence method rewriteModifyBlock.

private String rewriteModifyBlock(String consequence) {
    int modifyPos = StringUtils.indexOfOutOfQuotes(consequence, "modify");
    if (modifyPos < 0) {
        return consequence;
    }
    ModifyCompiler modifyCompiler = new ModifyCompiler();
    CompiledBlockResult compile = modifyCompiler.compile(addCurlyBracesToBlock(consequence));
    return printNode(compile.statementResults());
}
Also used : ModifyCompiler(org.drools.mvelcompiler.ModifyCompiler) CompiledBlockResult(org.drools.mvelcompiler.CompiledBlockResult)

Aggregations

CompiledBlockResult (org.drools.mvelcompiler.CompiledBlockResult)6 BlockStmt (com.github.javaparser.ast.stmt.BlockStmt)4 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)3 StaticJavaParser.parseStatement (com.github.javaparser.StaticJavaParser.parseStatement)2 Node (com.github.javaparser.ast.Node)2 Statement (com.github.javaparser.ast.stmt.Statement)2 VariableDeclarator (com.github.javaparser.ast.body.VariableDeclarator)1 AssignExpr (com.github.javaparser.ast.expr.AssignExpr)1 Expression (com.github.javaparser.ast.expr.Expression)1 FieldAccessExpr (com.github.javaparser.ast.expr.FieldAccessExpr)1 VariableDeclarationExpr (com.github.javaparser.ast.expr.VariableDeclarationExpr)1 ExpressionStmt (com.github.javaparser.ast.stmt.ExpressionStmt)1 DeclarativeInvokerDescr (org.drools.drl.ast.descr.DeclarativeInvokerDescr)1 FromDescr (org.drools.drl.ast.descr.FromDescr)1 PatternDescr (org.drools.drl.ast.descr.PatternDescr)1 PatternSourceDescr (org.drools.drl.ast.descr.PatternSourceDescr)1 CompilationProblemErrorResult (org.drools.modelcompiler.builder.errors.CompilationProblemErrorResult)1 MvelCompilationError (org.drools.modelcompiler.builder.errors.MvelCompilationError)1 DeclarationSpec (org.drools.modelcompiler.builder.generator.DeclarationSpec)1 ModifyCompiler (org.drools.mvelcompiler.ModifyCompiler)1