[rules-users] how to write the rule
yong zhao
cluncao at yahoo.com.cn
Tue Mar 22 10:20:45 EDT 2011
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/a423fbdf/attachment.html
More information about the rules-users
mailing list