use of org.drools.drl.ast.descr.PatternSourceDescr in project drools by kiegroup.
the class AccumulateInline method parseAccumulatePattern.
void parseAccumulatePattern() {
PatternDescr pattern = accumulateDescr.getInputPattern();
if (pattern == null || pattern.getSource() == null) {
return;
}
PatternSourceDescr sourceDescr = pattern.getSource();
if (sourceDescr instanceof FromDescr) {
DeclarativeInvokerDescr invokerDescr = ((FromDescr) sourceDescr).getDataSource();
String mvelBlock = addCurlyBracesToBlock(addSemicolon(invokerDescr.getText()));
CompiledBlockResult fromCodeCompilationResult = mvelCompiler.compileStatement(mvelBlock);
BlockStmt fromBlock = fromCodeCompilationResult.statementResults();
for (Statement stmt : fromBlock.getStatements()) {
stmt.findAll(NameExpr.class).stream().map(Node::toString).filter(context::hasDeclaration).forEach(usedExternalDeclarations::add);
}
}
}
Aggregations