I'm relatively new to the world of Drools, so I apologize up front for what
might be silly questions.
I've written a couple of DRLs (rules) and got these working via a little bit
of java code hacked together by yours truely but really want to try to start
using the BRL editor within eclipse. This will hopefully demo to our
clients just how easy it will be to write rules.....
...well, it would be, if I could get them to work!
Unfortunately, I can't seem to get the rule to run. Now either this is my
java code (possibly) or the BRL is incorrect. The first thing I've noticed
is the generated DRL has '>' characters in certain places:
rule "package_mandatory_fields"
dialect "java"
ruleflow-group "PackageMetadata"
salience 100
when
package : Package( description == "null" || product ==
"null" || provider
== "null" || versionMajor == "0" )
then
Log : "Package retracted"
package.setProduct( "ABC" );
update( package );
retract( package );
end
I don't get any errors during compilation, so maybe this is a red-herring?
This is the code I am using to read the BRL file (please, this is prototype,
hence the hardcoded values!)
private static void buildFromBrl(PackageBuilder builder) throws Exception
{
//for now, hardcoded. Read BRL into a string then add to builder.
String curDir = System.getProperty("user.dir");
String fileName = curDir +
"\\src\\main\\rules\\package_mandatory_fields.brl";
File file = new File(fileName);
String fileAsString = FileUtils.readFileToString(file);
BRLPersistence read = BRXMLPersistence.getInstance();
BRLPersistence write = BRDRLPersistence.getInstance();
String outputDRL = write.marshal(read.unmarshal(fileAsString));
builder.addPackageFromDrl(new StringReader(outputDRL));
}
Does any of this make sense? Any help would be most appreciated at this
stage as I'm beginning to rip my hair out now!
--
View this message in context:
http://www.nabble.com/BRL-help.-tp22102294p22102294.html
Sent from the drools - user mailing list archive at
Nabble.com.