[rules-users] how to eval with property inside a nested object

gmkumar2005 gmkumar2005 at gmail.com
Tue Jul 12 13:08:56 EDT 2011


Hi everyone.
I have a BaseProduct with paymentMode as a property 
BaseProduct is assigned to a Customer
Customer creates a uProduct. uProduct is a customized product created by the
customer. It contains multiple BaseProducts.

for eg
Music is a Baseproduct with Wire paymentMode
Picture is a product with CreditCard paymentMode
Movie is a product with DebitCard paymentMode

iPod is a uProduct which contains Music and Pictures implies that it 
supports Wire and CreditCard 
iPad is a uProduct with contains Music, Movies and Pictures implies that it
supports all paymentModes

rule "Non Mandatory"
// calculates all non mandatory fields for display
when 
   $transaction : Transaction($paymentModes :uProduct.baseProduct) 
// select all the paymentModes supported by the uProduct
   $displayMode : Property(payMode in $paymentModes)
// select a property which has a valid paymentMode
   ... someOther conditions .... 
then
...

in the above rule $paymentModes returns arrayList of baseProducts. But I
want to access the list of paymentModes. ie, when Transaction has iPod
$paymentMode should return [wire,CreditCard], when Transaction has iPad it
should return [wire,CreditCard,DebitCard]

Question : How do I access array of a selected property which are again part
of Array of an object ?

Any suggestion ?
Thanks a lot.


--
View this message in context: http://drools.46999.n3.nabble.com/how-to-eval-with-property-inside-a-nested-object-tp3163169p3163169.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list