yeah the internal impl is arraylist but the interface is a collection<KnowledgeBuilderErrors>, so everytime I had to convert it to array and keep counter of last-error-index and fetch new KnowledgeBuilderErrors on the collection, or use iterator to iterate the last-error-index and continue till the end of the collection.<br>
the knowledge builder dosent return any package if it has atleast one failed package. <br>But I want the successfully-compiled rules to be in the kBase and log the failed rules with the unique identifier of it. <br>so the author of the rule is notified and rest all rules work without any issue.<br>
<br>creating new kBuilder for every rule (drl string) in the db and adding its packages to the kBase is the only way?<br>may be something like kBuilder.remove(failedResource) or getSuccessfulKnowledgePackages();<br><br><div class="gmail_quote">
On Sun, Jun 10, 2012 at 10:58 AM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If the list of errors is extended by errors detected during another kb.add(): why not just keep track of the last size() of the list? New errors are bound to appear at the end of the list.<br>-W<br><br><div class="gmail_quote">
<div><div class="h5">
On 10 June 2012 01:44, Sandeep Bandela <span dir="ltr"><<a href="mailto:gibsosmat@gmail.com" target="_blank">gibsosmat@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
Hi,<br>I have rules (drl format strings) stored in a database column in a schema like MyRules(rule_id integer, name text, rule text, enabled boolean ... )<br>I query the db to get them and iterate over the rows and add using KnowledgeBuilder.add() using String.getBytes. (I dont want to move to guvnor as of now)<br>
some rules might have compilation errors, hence the KnowledgeBuilder.hasErrors() is set to true.<br>those will not be added to the package by the PackageBuilder.<br><br>My problem is to log the error causing rule_id and the error message.<br>
KnowledgeBuilderErrors dosent expose the internal errors list so that I could see if any new errors are in the arraylist from the last time error seen time and log them.<br>But only solution i could think of is using the low level api of using DrlParser to pre-parse it to check for errors+log and add to the kBuilder if its not failed.<br>
<br>is there any elegant way to do this? <br><br>I am using drools-5.2.0.final<span><font color="#888888"><br><br><br><br clear="all"><br>-- <br>Regards,<br>Sandeep Bandela.<br>
<br>
</font></span><br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Sandeep Bandela.<br><br>