Re: [rules-users] How to pass variables to a drools rule file?

2013-02-27 Thread FrankVhh
It is looking for com.sample.Qos. Try to add the import statement
test.java.Qos somewhere on top of your file.

Regards,
Frank


penny wrote
 Hi,there.I have a class in test.java file.It looks like:
 class Qos{
   boolean S;
   boolean W;
   Qos(){
   S = true;
   W = false;
   }
   public boolean getS(){
   return S;
   }
   public boolean getW(){
   return W;
   }
 }
 
 Now I want to use the Qos class in my rule file like this:
 rule rule1
   ruleflow-group myRules
   salience 4
 when
 //conditions
 $qos:Qos(S==true  W==true);
 then
System.out.println(rule1);   
 end
 
 But here is an error.
 [Error: could not access field: com.sample.Qos.S]
 [Near : {... S == true }]
  ^
 [Line: 1, Column: 1]
 
 How can I do?





--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-pass-variables-to-a-drools-rule-file-tp4022607p4022608.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


Re: [rules-users] How to pass variables to a drools rule file?

2013-02-27 Thread Wolfgang Laun
This is yet another MVEL bug, as it appears to fail to handle package
visibility correctly.

Put Qos into a .java file of its own in any package, precede class by
public and use a proper import in the .drl.

You can omit the import if the package of the Java class and the .drl
is the same.

-W



On 27/02/2013, FrankVhh frank.vanhoensho...@agserv.eu wrote:
 It is looking for com.sample.Qos. Try to add the import statement
 test.java.Qos somewhere on top of your file.

 Regards,
 Frank


 penny wrote
 Hi,there.I have a class in test.java file.It looks like:
 class Qos{
  boolean S;
  boolean W;
  Qos(){
  S = true;
  W = false;
  }
  public boolean getS(){
  return S;
  }
  public boolean getW(){
  return W;
  }
 }

 Now I want to use the Qos class in my rule file like this:
 rule rule1
  ruleflow-group myRules
  salience 4
 when
 //conditions
 $qos:Qos(S==true  W==true);
 then
System.out.println(rule1);  
 end

 But here is an error.
 [Error: could not access field: com.sample.Qos.S]
 [Near : {... S == true }]
  ^
 [Line: 1, Column: 1]

 How can I do?





 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-pass-variables-to-a-drools-rule-file-tp4022607p4022608.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