[rules-users] issues with 'contains' and 'and'
Edson Tirelli
tirelli at post.com
Tue Feb 27 18:01:25 EST 2007
You must add the constraint to the same Pattern and not an additional
pattern. In your case this will also prevent the loop.
Example:
rule "CompDept Product Qualification Rule"
salience 7
no-loop true;
when
$cust:( Customer( productIDs contains "Computer", compDeptState == Customer.NOTRUN )
or Customer(productIDs contains "monitor", compDeptState == Customer.NOTRUN ))
then
$cust.setCompDeptState (Customer.DONE);
System.out.println("getStatus after...." + $cust.getCompDeptState () );
$cust.addQualifiedProduct("CompDeptProduct");
System.out.println("CompDeptProduct qualified...." );
modify($cust);
end
[]s
Edson
Amarendra Mishra wrote:
>Hi,
>
>I am trying to write a protoype with JBoss Rules 3.0.5
>I am having problem in getting the following working properly :
>
>rule "CompDept Product Qualification Rule"
> salience 7
> no-loop true;
>
> when
> $cust:( Customer( productIDs contains "Computer")
> or Customer(productIDs contains "monitor"))
> # Customer(compDeptState == Customer.NOTRUN) <-------- Commented line
> then
> $cust.setCompDeptState (Customer.DONE);
> System.out.println("getStatus after...." + $cust.getCompDeptState () );
> $cust.addQualifiedProduct("CompDeptProduct");
> System.out.println("CompDeptProduct qualified...." );
> modify($cust);
>end
>
>where productIDs are defined as Vector in Customer class.
>If I run the above rule it goes in recursive mode (I have another rule in the drl that also acts on the same customer object and modifies it).
>If I uncomment the commented line my LHS it's not evaluating to true and RHS is not running.
>
>Any help would be appreciated.
>
>Kind Regards,
>Amarendra.
>
>
>
>____________________________________________________________________________________
>Bored stiff? Loosen up...
>Download and play hundreds of games for free on Yahoo! Games.
>http://games.yahoo.com/games/front
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com
More information about the rules-users
mailing list