use of org.drools.modelcompiler.builder.generator.visitor.NamedConsequenceVisitor.BREAKING_CALL in project drools by kiegroup.
the class Consequence method createCall.
public MethodCallExpr createCall(RuleDescr ruleDescr, String consequenceString, BlockStmt ruleVariablesBlock, boolean isBreaking) {
BlockStmt ruleConsequence = rewriteConsequence(consequenceString);
if (ruleConsequence != null) {
ruleConsequence.findAll(Expression.class).stream().filter(s -> isNameExprWithName(s, "kcontext")).forEach(n -> n.replace(new NameExpr("drools")));
}
Collection<String> usedDeclarationInRHS = extractUsedDeclarations(ruleConsequence, consequenceString);
MethodCallExpr onCall = onCall(usedDeclarationInRHS);
if (isBreaking) {
onCall = new MethodCallExpr(onCall, BREAKING_CALL);
}
MethodCallExpr executeCall = null;
if (context.getRuleDialect() == RuleContext.RuleDialect.JAVA) {
executeCall = executeCall(ruleVariablesBlock, ruleConsequence, usedDeclarationInRHS, onCall);
} else if (context.getRuleDialect() == RuleContext.RuleDialect.MVEL) {
executeCall = executeScriptCall(ruleDescr, onCall);
}
return executeCall;
}
Aggregations