use of org.drools.mvel.parser.printer.PrintUtil in project drools by kiegroup.
the class PatternAccumulateConstraint method buildPattern.
@Override
public void buildPattern() {
Map<String, List<BaseDescr>> constraintsByVar = new HashMap<>();
for (BaseDescr constraint : constraintDescrs) {
Set<String> exprIds = DrlxParseUtil.parseExpression(constraint.getText()).getExpr().findAll(DrlNameExpr.class).stream().map(PrintUtil::printNode).collect(toSet());
for (AccumulateDescr.AccumulateFunctionCallDescr accFunc : source.getFunctions()) {
if (exprIds.contains(accFunc.getBind())) {
constraintsByVar.computeIfAbsent(accFunc.getBind(), s -> new ArrayList<>()).add(constraint);
break;
}
}
}
constraintsByVar.forEach((id, constraints) -> {
pattern.setIdentifier(id);
new PatternDSLPattern(context, packageModel, pattern, constraints, null).buildPattern();
});
pattern.setIdentifier(null);
}
Aggregations