use of org.drools.template.parser.TemplateDataListener in project drools by kiegroup.
the class RuleTemplateModelDRLPersistenceImpl method marshal.
@Override
public String marshal(final RuleModel model) {
// Build rule
final String ruleTemplate = marshalRule(model);
log.debug("ruleTemplate:\n{}", ruleTemplate);
log.debug("generated template:\n{}", ruleTemplate);
final DataProvider dataProvider = chooseDataProvider(model);
final DataProviderCompiler tplCompiler = new DataProviderCompiler();
final InputStream templateStream = new ByteArrayInputStream(ruleTemplate.getBytes(IoUtils.UTF8_CHARSET));
final DefaultTemplateContainer tc = new DefaultTemplateContainer(templateStream, false);
final TemplateDataListener listener = new TemplateDataListener(tc, false);
final String generatedDrl = tplCompiler.compile(dataProvider, listener);
log.debug("generated drl:\n{}", generatedDrl);
return generatedDrl;
}
use of org.drools.template.parser.TemplateDataListener in project drools by kiegroup.
the class ExternalSpreadsheetCompiler method compile.
public String compile(final InputStream xlsStream, final InputStream templateStream, InputType type, int startRow, int startCol) {
TemplateContainer tc = new DefaultTemplateContainer(templateStream);
closeStream(templateStream);
return compile(xlsStream, type, new TemplateDataListener(startRow, startCol, tc));
}
Aggregations