<br><font size=2 face="sans-serif">Hello there,</font>
<br>
<br><font size=2 face="sans-serif">I am experimenting with Drools. I seem
to be having problems with making the ForEach element to work. It cannot
'see' the mappings created when I start the process. I am hand coding the
XML flow files and using the schema (and documentation) to help me.</font>
<br>
<br><font size=2 face="sans-serif">The problem seems to be in the flow
file before the rule file is even executed. Is this the correct way to
pass a collection to the process?</font>
<br>
<br><font size=2 face="sans-serif">// the collection to iterate over</font>
<br><font size=2 face="sans-serif">Collection<BusinessObject> pending
= new ArrayList<BusinessObject>();</font>
<br><font size=2 face="sans-serif">pending.add(new BusinessObject());</font>
<br><font size=2 face="sans-serif">pending.add(new BusinessObject());</font>
<br>
<br><font size=2 face="sans-serif">// the parameters for the process</font>
<br><font size=2 face="sans-serif">Map<String, Object> params = new
HashMap<String, Object>();</font>
<br><font size=2 face="sans-serif">params.put("pending", pending);</font>
<br>
<br><font size=2 face="sans-serif">ksession.startProcess("org.processor",
params);</font>
<br><font size=2 face="sans-serif">ksession.fireAllRules();</font>
<br>
<br><font size=2 face="sans-serif">In the rule file, I have:</font>
<br><font size=2 face="sans-serif"> <forEach
id="2" name="processor" variableName="current"
collectionExpression="pending" > </font>
<br><font size=2 face="sans-serif">
<in-ports></font>
<br><font size=2 face="sans-serif">
<in-port
type="DROOLS_DEFAULT" nodeId="6" nodeInType="DROOLS_DEFAULT"
/> </font>
<br><font size=2 face="sans-serif">
</in-ports></font>
<br><font size=2 face="sans-serif">
<out-ports></font>
<br><font size=2 face="sans-serif">
<out-port
type="DROOLS_DEFAULT" nodeId="8" nodeOutType="DROOLS_DEFAULT"
/> </font>
<br><font size=2 face="sans-serif">
</out-ports></font>
<br>
<br><font size=2 face="sans-serif"> <nodes></font>
<br><font size=2 face="sans-serif">
<start id="6" name="test"
/></font>
<br>
<br><font size=2 face="sans-serif">
<actionNode id="7"></font>
<br><font size=2 face="sans-serif">
<action type="expression" dialect="mvel"></font>
<br><font size=2 face="sans-serif">
System.out.println(current);</font>
<br><font size=2 face="sans-serif">
</action></font>
<br><font size=2 face="sans-serif">
</actionNode></font>
<br>
<br><font size=2 face="sans-serif">
<end id="8" name="done"/></font>
<br>
<br><font size=2 face="sans-serif"> </nodes></font>
<br>
<br><font size=2 face="sans-serif">
<connections></font>
<br><font size=2 face="sans-serif">
<connection
from="6" to="7" /></font>
<br><font size=2 face="sans-serif">
<connection
from="7" to="8" /></font>
<br><font size=2 face="sans-serif">
</connections></font>
<br>
<br><font size=2 face="sans-serif"> </forEach></font>
<br>
<br>
<br><font size=2 face="sans-serif">I cannot tell if the scope inside the
ForEach > nodes is separate from the outer-scope, can I use the same
IDs?</font>
<br>
<br><font size=2 face="sans-serif">The error I receive:</font>
<br><font size=2 face="sans-serif">Exception in thread "main"
java.lang.IllegalArgumentException: Could not find collection params</font>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">What am I doing wrong?</font>
<br>
<br><font size=2 face="sans-serif">Regards,</font>
<br><font size=2 face="sans-serif">S. Squire</font>
<br>
<BR>
This message may contain confidential and privileged information and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorised. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator and then immediately delete this message. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses.<BR>
<BR>
Please refer to http://www.bnymellon.com/disclaimer/piml.html for certain disclosures.<BR>