|
This post was updated on .
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 classes.
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. |
|
when
$order: Order() not Item( measureList.size < 12 ) from $order.itemList; then Why is it *important* to use MVEL? -W On 20/07/2012, aliosha79 <[hidden email]> wrote: > 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. > _______________________________________________ > rules-users mailing list > [hidden email] > https://lists.jboss.org/mailman/listinfo/rules-users > rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users |
|
thanks a lot laune... mvel it's necessary for now as in my editor there is still not che possibility to set the language for building rules.
|
|
On 20/07/2012, aliosha79 <[hidden email]> wrote:
> thanks a lot laune... mvel it's necessary for now as in my editor there is > still not che possibility to set the language for building rules. > It should still be possible to use, e.g., $x.getItemList() since MVEL must also understand pure Java expressions. That's why I wondered. -W _______________________________________________ rules-users mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-users |
| Powered by Nabble | Edit this page |
