[rules-users] How to Handle Decision Table (XSL files) in Drools version 4.0.7
Hong-Qiang Gao
hgao at scenpro.com
Wed Feb 4 17:44:14 EST 2009
Is there a better way to handle Decision Table (XSL files) with Drools
version 4.0.7?
In Drools 2.1, I can do the following;
file = new File(dir, XSL_filename);
InputStream stream = null;
RuleBase ruleBase = null;
WorkingMemory wm = null;
try {
stream = new FileInputStream(file);
} catch{...
}
try{
ruleBase = DecisionTableLoader.loadFromInputStream(stream);
WorkingMemory wm = ruleBase.newWorkingMemory();
} catch{ ...
}
In Drool 4.0.7, I tried the following
file = new File(dir, XSL_filename);
InputStream stream = null;
RuleBase ruleBase = null;
try {
stream = new FileInputStream(file);
} catch{...
}
try{
ruleBase = RuleBaseFactory.newRuleBase();
PackageBuilder builder = new PackageBuilder();
SpreadsheetCompiler sCompiler = new SpreadsheetCompiler();
String drl = sCompiler.compile(stream, InputType.XLS);
builder.addPackageFromDrl(new StringReader(drl));
ruleBase.addPackage(builder.getPackage());
WorkingMemory wm = ruleBase.newStatefulSession();
} catch{ ...
}
Thanks,
Hong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090204/80a8c4a8/attachment.html
More information about the rules-users
mailing list