Here's how I'd do it:
rule "missing address type"
when
$tpType: TaxpayerType( $addressTypes: addressTypes )
Taxpayer( $name: name, taxpayerType == $tpType, $addrs: addresses )
accumulate( Address( $addrType: addressType ) from $addrs,
$addrTypeSet: collectSet( $addrType ) )
eval( ! $addrTypeSet.containsAll( $addressTypes ) )
then
System.out.println( $name + " is not OK" );
end
Enum TaxpayerType has a property addressTypes of type Set (actually an
EnumSet) containing the set of required address types.
The "accumulate" collects, in set $addrTypeSet all actually available
AddressType values from the taxpayer's addresses.
-W
On 20/08/2012, Suvek <suvek.shah(a)gmail.com> wrote:
Thanks for your quick reply...
AddressType is Enum and have around 15 odd values, based on the taxpayer
type some of the AddressTypes would be selected...
Addresses is list of Address and addressType is one of the field under
Address. All the addresses may be of same or different types (say a
taxpayer
can have two houses )
--
View this message in context:
http://drools.46999.n3.nabble.com/All-the-values-from-one-list-must-be-pr...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users