[rules-users] 回复: how to write the rule

yong zhao cluncao at yahoo.com.cn
Tue Mar 22 10:40:11 EDT 2011


 I got the root. Thanks



________________________________
发件人: yong zhao <cluncao at yahoo.com.cn>
收件人: rules <rules-users at lists.jboss.org>
发送日期: 2011/3/22 (周二) 10:20:45 下午
主   题: [rules-users] how to write the rule


Hi,

public class Order {
Buyer   buyer;
List<Item>orderItems = new ArrayList<Item>();

public List<Item> getOrderItems() {
return orderItems;
}
public void  setOrderItems(List<Item> items) {
this.orderItems = items;
}
}

public class Item {

String id;
double price;
int  amount;
String catelogTag;

public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}


business rule 

import base.Order;
import base.Item;

rule "rule1"
when
$o: Order($b : buyer);
eval ($b != null && $b.getUserLevel() == UserTag.TAG[UserTag.TA]);
then    
System.out.println("");  
end


rule "rule2"
when
$o:Order($b : buyer);
#here is the error message in eclipse: "Item could not be resolved"
$i:Item() from $o.orderItems;
then    
System.out.println("");  
end

when I try to build the rule and run case, I got the following error in 
Rule Compilation error : [Rule name='rule2']
Rule_rule2_0.java (8:785) : item cannot be resolved

1. What is my error in the code and how to get that every Item in the orderItems 
list?
2. Another question is how to get source code when build the rule via eclise 
plugin?

thinks in advance


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110322/36c2c79d/attachment.html 


More information about the rules-users mailing list