[rules-users] display all rules name.
Mauricio Salatino
salaboy at gmail.com
Thu Dec 1 23:59:02 EST 2011
That's not the rule name that the string representation of the class
called: RuleImpl
Try to see what methods do you have available from that class.
Cheers
On Fri, Dec 2, 2011 at 1:09 AM, srinivasasanda <srinivasasanda at gmail.com> wrote:
> Hi All,
> Thanks in advance, Please clear this problem.
> Please sort out my problem. I am able to display the package
> names(Specification and GeoArea) but i want to display no. of rules names
> which are available under each package.
> (Under Specification package i have 2 rules & GeoArea package i have 2
> rules)
> I am getting the output Rule names as HashCode.
>
> Specification
> org.drools.definitions.rule.impl.RuleImpl at e483a8f
> org.drools.definitions.rule.impl.RuleImpl at 7d897ca2
> GeoArea
> org.drools.definitions.rule.impl.RuleImpl at 9b82c6e5
> org.drools.definitions.rule.impl.RuleImpl at 5e6f671d
>
> My Code is below:
>
>
> KnowledgeBuilder kbuilder1 = KnowledgeBuilderFactory.newKnowledgeBuilder();
>
> kbuilder1.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/Specification/LATEST"),ResourceType.PKG);
>
> kbuilder1.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/GeoArea/LATEST"),ResourceType.PKG);
>
> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
> kbase.addKnowledgePackages(kbuilder1.getKnowledgePackages());
> for( KnowledgePackage kp : kbase.getKnowledgePackages() ){
>
> System.out.println("------------------->"+kp.getName());
> Collection c=kp.getRules();
>
> Iterator it=c.iterator();
> while(it.hasNext())
> {
> Object ruleName=it.next();
> System.out.println("-------------------->"+ruleName);
> }
>
> Regards,
> Srinivasa
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/display-all-rules-name-tp3553740p3553740.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
--
- CTO @ http://www.plugtree.com
- MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jugargentina.org
- Co-Founder @ http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
More information about the rules-users
mailing list