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

2012-02-13 Thread Wolfgang Laun
See inline!

On 13 February 2012 06:23, Veera veera...@gmail.com wrote:

 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...:
 CollectionKnowledgePackage 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();


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().

There is no (stable) way of retrieving the declared fact names from a
KnowledgePackage.

If you are willing to use the *UNSTABLE* API, look at all (!) of

http://drools.46999.n3.nabble.com/Fact-Names-in-a-Model-td3572234.html

-W


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.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2012-02-12 Thread Veera
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...:
CollectionKnowledgePackage 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.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users