use of org.drools.compiler.lang.dsl.DSLMapping in project drools-wb by kiegroup.
the class DslFileIndexer method fillIndexBuilder.
@Override
public DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
final List<String> lhs = new ArrayList<String>();
final List<String> rhs = new ArrayList<String>();
final String dsl = ioService.readAllString(path);
// Construct a dummy DRL file to parse index elements
final DSLTokenizedMappingFile dslLoader = new DSLTokenizedMappingFile();
if (dslLoader.parseAndLoad(new StringReader(dsl))) {
DSLMapping dslMapping = dslLoader.getMapping();
for (DSLMappingEntry e : dslMapping.getEntries()) {
switch(e.getSection()) {
case CONDITION:
lhs.add(e.getValuePattern());
break;
case CONSEQUENCE:
rhs.add(e.getValuePattern());
break;
default:
}
}
final String drl = makeDrl(path, lhs, rhs);
return fillDrlIndexBuilder(path, drl);
}
return null;
}
Aggregations