On 9 August 2010 17:31, Mark Proctor <mproctor(a)codehaus.org> wrote:
For now you can cast and unwrap any drools-api interface and get the
legacy concrete implementation that you need. We are aiming for 5.2 for
october, so we can look into exposing some more things then.
In the case of Rule, your proposal doesn't work. To show the set of rules
bundled in an agenda group, I tried to
StatefulKnowledgeSession session = ...;
for( KnowledgePackage knowledgePackage:
session.getKnowledgeBase().getKnowledgePackages() ){
for( Rule rule: knowledgePackage.getRules() ){
???
but it turns out that this "rule" object is of the interface type
org.drools.definition.rule.Rule
implemented by
org.drools.definitions.rule.impl.Rule
which is just as meagre as the interface. Dead end, apparently.
Using other classes like Package or RuleBase from the "unstable" part
of the API to get at
the "real meat" in org.drools.rule.Rule isn't really a way I want to go.
Being able to "reverse engineer" one's rules for documentation or
filters or similar is an asset which
improves Drools usability. Please make do in 5.2.
Thanks
-W