[rules-users] How to get the Fact datatypes from the Guvnor

Veera veera.se at gmail.com
Mon Feb 13 00:23:40 EST 2012


Hi All,

Can anybody help to get the Field type(what datatype it is ).
I have declared a Facts in Guvnor 5.3 and i can able to retreive all the
package names & rules names & fact names , now i want to know what is the
datatype of each fact , i don't know which api to use for this.

Can any body help me pelase...

below code to get the all package names & rules names & fact names...:
Collection<KnowledgePackage> kpackages =
_kagent.getKnowledgeBase().getKnowledgePackages();
   
        for(KnowledgePackage kpackage : kpackages) 
        {
           for(org.drools.definition.rule.Rule rule1 :kpackage.getRules()) 
           {
        	//printing package names & rule names. 
               String packname= rule1.getPackageName();
               String rulename=rule1.getName();
               System.out.println("This is : "+packname+" Packages and 
RuleName is " +rulename);
               
               //printing Fact names..
                Field[] s=kpackage.getClass().getFields();
                System.out.println(s.toString());
           }
        }


Thanks,
Veera

--
View this message in context: http://drools.46999.n3.nabble.com/How-to-get-the-Fact-datatypes-from-the-Guvnor-tp3739223p3739223.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list