[rules-users] Counting Number of Items in NESTED LIST
aliosha79
alex_orl1079 at yahoo.it
Fri Jul 20 06:22:06 EDT 2012
I have this use case: an Order can contain one or more items... each item is
characterized by one or more measures. They are described by this simple
pojo class.
public class Order{
protected List<Item> itemList;
public void setItemList (List<Item> itemList) { ... }
public List<Item> getItemList() { ... }
}
public class Item {
protected List<Measure> measureList;
public void setMeasureList (List<Measure> measureList) { ... }
public List<Measure> getMeasureList() { ... }
}
public class Measure {
protected int measure;
public getMeasure() { ... }
public setMeasure() { ... }
}
Supposing i have in my Working Memory an Order containing 2 items. The first
item contains 5 measures, the second one instead contains 12 Measures.
I'd like to write a rule using MVEL (for the assumptions), specifying
WHEN each ITEM has more than 11 measures THEN system.out.println ("order is
valid");
How can i write the assumption? It's important to use MVEL ... (is it
necessary to use accumulate? from? or what?)
Really thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Counting-Number-of-Items-in-NESTED-LIST-tp4018794.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list