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.
the knowledge builder dosent return any package if it has atleast one failed package.
But I want the successfully-compiled rules to be in the kBase and log the failed rules with the unique identifier of it.
so the author of the rule is notified and rest all rules work without any issue.
creating new kBuilder for every rule (drl string) in the db and adding its packages to the kBase is the only way?
may be something like kBuilder.remove(failedResource) or getSuccessfulKnowledgePackages();
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.
-WOn 10 June 2012 01:44, Sandeep Bandela <gibsosmat@gmail.com> wrote:_______________________________________________Hi,
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 ... )
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)
some rules might have compilation errors, hence the KnowledgeBuilder.hasErrors() is set to true.
those will not be added to the package by the PackageBuilder.
My problem is to log the error causing rule_id and the error message.
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.
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.
is there any elegant way to do this?
I am using drools-5.2.0.final
--
Regards,
Sandeep Bandela.
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users