[rules-users] Write Assumptions for NESTED List<Object>

aliosha79 alex_orl1079 at yahoo.it
Mon Jun 25 18:11:41 EDT 2012


Hi i have these simple three POJO class. The first is an OrderType that
cointains a List or OrderLineType and each orderline cointains a list 
of measures.
________________________________________________________
/public class OrderType { 
     protected List<OrderLineType> OrderLine; 
     protected String priority; 
      
     public void   set .... 
     public List<OrderlineType> get .... 

     public    getPriority()... 
     public    setPriority()... 
} 



public class OrderLineType { 
     
     protected String Quantity;         
     protected List<OrderLineMeasure> OrderLineMeasure;
      
     public void   set .... 
     public List<OrderLineMeasure> get ....
      
     public    getQuantity()... 
     public    setQuantity()... 
} 


public class OrderLineMeasure { 
     
     protected int measure;         
     protected List<OrderLineMeasure> OrderLineMeasure;
      
     public    getMeasure()... 
     public    setMeasure()... 
} /
________________________________________________________

I want to write an assumption stating that: 
*If an ORDER contains at least 3 orderLine... the order must have the High
Priority.* In can do that writing this rule:

_______________________________________________________________

/when 
    $Order : OrderType ($orderLineList :orderLine) 
    OrderLineType(Quantity.Value >= 3 ) from $orderLineList 

then 
   $Order.getUBLRuleEnginePriority().setValue("high"); 
end/
________________________________________________________________

Now how can i write the assumption? if i want  a rule stating:    
*If an ORDER contains at least 3 orderLine and Each OrderLine contains more
than 12 measures... the order must have the High Priority.*
Really thanks for your help.
Regards.
Alessio

--
View this message in context: http://drools.46999.n3.nabble.com/Write-Assumptions-for-NESTED-List-Object-tp4018241.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list