I would like to generate a template that can output rules, as explained in Drools expert user guide at chapter 5.2 (http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html#d0e6212).
My parameters are 2 lists of strings. In some case the list is to be outputted as a "multi restriction", and that is no problem. 
But, from one of this lists, i need also to generate a collection of strings to then reason over.
As an example, suppose the list1 contains 3 productIds, "A","B","C", and the list2 contains "X" and "Y".
In the generated rule, i need to check, for example, that: 
and 
then i will execute my code.

I think the generated rule should be something like:

when
    $target: Product (id in ("X","Y"))
    $list: ArrayList() from ????  #arrayList should contain the parameter values "A","B","C"
    forall ( $id: String() from $list
             Product (id == $id, ....here some condition...)
    )
then
   .....

The difficult part is to generate the ArrayList dynamically, i don't know how to accomplish that...
Any ideas? Is there a better approach than templates, to generate a rule like this?
Do you have a suggestion on how the rule could be rewritten to avoid the use of the ArrayList?
Thank you in advance
Giovanni