use of org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder in project drools by kiegroup.
the class FlowAccumulateConstraint method buildPattern.
@Override
public void buildPattern() {
for (BaseDescr constraint : constraintDescrs) {
String expression = constraint.toString();
final DrlxParseResult drlxParseResult = new ConstraintParser(context, packageModel).drlxParse(null, null, expression, false);
drlxParseResult.accept(success -> {
success.setSkipThisAsParam(true);
new FlowExpressionBuilder(context).processExpression(success);
});
}
}
use of org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder in project drools by kiegroup.
the class EvalVisitor method visit.
public void visit(EvalDescr descr) {
String expression = descr.getContent().toString();
DrlxParseResult drlxParseResult = new ConstraintParser(context, packageModel).drlxParse(null, null, expression);
drlxParseResult.accept(drlxParseSuccess -> {
Expression rewriteExprAsLambdaWithoutThisParam = DrlxParseUtil.generateLambdaWithoutParameters(drlxParseSuccess.getUsedDeclarations(), drlxParseSuccess.getExpr(), true);
// rewrites the DrlxParserResult expr as directly the lambda to use
drlxParseSuccess.setExpr(rewriteExprAsLambdaWithoutThisParam);
drlxParseSuccess.setStatic(true);
new FlowExpressionBuilder(context).processExpression(drlxParseSuccess);
});
}
use of org.drools.modelcompiler.builder.generator.expression.FlowExpressionBuilder in project drools by kiegroup.
the class FlowDSLSimpleConstraint method buildPattern.
@Override
public void buildPattern() {
// need to augment the watch inside drlxParseResult with the look-ahead properties.
drlxParseResult.addAllWatchedProperties(context.getRuleDescr().lookAheadFieldsOfIdentifier(pattern));
drlxParseResult.addAllWatchedProperties(DrlxParseUtil.getPatternListenedProperties(pattern));
if (pattern.isUnification()) {
drlxParseResult.setPatternBindingUnification(true);
}
new FlowExpressionBuilder(context).processExpression(drlxParseResult);
}
Aggregations