See inline!<div><br><div class="gmail_quote">On 13 February 2012 06:23, Veera <span dir="ltr"><<a href="mailto:veera.se@gmail.com">veera.se@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
<br>
Can anybody help to get the Field type(what datatype it is ).<br>
I have declared a Facts in Guvnor 5.3 and i can able to retreive all the<br>
package names & rules names & fact names , now i want to know what is the<br>
datatype of each fact , i don't know which api to use for this.<br>
<br>
Can any body help me pelase...<br>
<br>
below code to get the all package names & rules names & fact names...:<br>
Collection<KnowledgePackage> kpackages =<br>
_kagent.getKnowledgeBase().getKnowledgePackages();<br>
<br>
for(KnowledgePackage kpackage : kpackages)<br>
{<br>
for(org.drools.definition.rule.Rule rule1 :kpackage.getRules())<br>
{<br>
//printing package names & rule names.<br>
String packname= rule1.getPackageName();<br>
String rulename=rule1.getName();<br>
System.out.println("This is : "+packname+" Packages and<br>
RuleName is " +rulename);<br>
<br>
//printing Fact names..<br>
Field[] s=kpackage.getClass().getFields();<br></blockquote><div><br></div><div>Method getClass() is inherited from java.lang.Object and returns the object's java.lang.Class. Therefore, the Field[] s are the fields of java.lang.Class().</div>
<div><br></div><div>There is no (stable) way of retrieving the declared fact names from a KnowledgePackage.</div><div><br></div><div>If you are willing to use the <u style="font-weight:bold;font-style:italic">UNSTABLE</u> API, look at all (!) of</div>
<div><br></div><div><a href="http://drools.46999.n3.nabble.com/Fact-Names-in-a-Model-td3572234.html">http://drools.46999.n3.nabble.com/Fact-Names-in-a-Model-td3572234.html</a><br></div><div><br></div><div>-W</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
System.out.println(s.toString());<br>
}<br>
}<br>
<br>
<br>
Thanks,<br>
Veera<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/How-to-get-the-Fact-datatypes-from-the-Guvnor-tp3739223p3739223.html" target="_blank">http://drools.46999.n3.nabble.com/How-to-get-the-Fact-datatypes-from-the-Guvnor-tp3739223p3739223.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>