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

FrankVhh frank.vanhoenshoven at agserv.eu
Wed Feb 27 03:35:41 EST 2013


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.


More information about the rules-users mailing list