[rules-users] Inserting Different Objects Of Same Class !

abhinay_agarwal abhinay_agarwal at infosys.com
Tue Nov 27 03:26:46 EST 2012


Lemme expalin myself a bit,

I have three different list, consider list1, list2, list3

i wanna add something to the list under different conditions:

when
    cond #1
    $l1:ArrayList() // here i want the first list
then 
    $l1.add(something)
end

when
    cond #2
     $l2:ArrayList() //here i want the second list
then 
     $l2.add(something)
end

when
    cond #3
     $l3:ArrayList() //here i want the third list
then 
     $l3.add(something)
end

These lists are used in several rules, in different agenda-group !

Since all the three lists are empty lists, i cannot differentiate between
them.

What i see as a solution is,

i can do i make a Map<Name, List> and insert the map as a Fact .

Or

I can make a class with attributes as Name, List and insert three different
objects of the class, with three different names.

Is anything else possible ??

P.S. Initially i had to use just one list in my rules, so there was no
problem, but now as the requirement of multiple list have come, if I use
fact of some class, i will have to make changes in many rules, which i want
to avoid :)

Regards,
Abhinay



--
View this message in context: http://drools.46999.n3.nabble.com/Inserting-Different-Objects-Of-Same-Class-tp4020971p4020974.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list