I am doing ksession.insert(list) and after that I have to fire rule 1 in the drl file, then ksession.insert(list) and fire rule 2 in the drl.
Could someone tell me how to achieve this. I read about agenda filters and facthandles but do not really know how to get this to work
Below is some code:
ArrayList list = new ArrayList();
list.add(product1);
list.add(product2);
list.add(product3);
ksession.insert(list);
ksession.fireAllRules("fire rule 1 in drl");
//remove list?
ArrayList list2 = new ArrayList();
list2.add(str1);
list2.add(str2);
list2.add(str3);
ksession.insert(list2);
ksession.fireAllRules("fire rule 2 in drl");
Best Answer
I think there is a better workaround...you can control pattern matching..
Here is a simple and quick way
.. in your drl and inside Rule 1 ..when you want Rule 1 to work with arraylist1, have this matching first in the lhs
$al:ArrayList(this contains "Rule 1")
That is all..