[rules-users] display all rules name.

Wolfgang Laun wolfgang.laun at gmail.com
Fri Dec 2 04:41:38 EST 2011


Again and again, I have urged the addition of methods for retrieving
from the stable API's Rule class object all that can be written in the
DRL. There's really no point in hiding this while it's a plainly
visible and heavily used DRL feature. Moreover, sensible SW
development would require you to keep track of features, etc.

Here's the code to get the agenda group. Note that the Rule class is
from a different package and it's NOT in the stable API.

for( Rule rule: knowledgePackage.getRules() ){				
    String ruleName = rule.getName();
    org.drools.rule.Rule realRule =
        (org.drools.rule.Rule)
((KnowledgePackageImp)knowledgePackage).getRule( ruleName );
    String agName = realRule.getAgendaGroup();
}

@srinivasandra: Get into the habit of using generic parameters (with
e.g. Collection<X>) and catch up on Java's "for" statement. Both will
improve your code.

-W

On 2 December 2011 07:27, srinivasasanda <srinivasasanda at gmail.com> wrote:
> Thank you..I've found to get tule names..But how can I get agenda group
> names..Can you suggest this
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/display-all-rules-name-tp3553740p3553896.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list