Hi all!
I need to apply rules to each element of a collection. So I tried to use
ForEach component in my ruleflow. Here is my rule flow file
http://n3.nabble.com/forum/FileDownload.jtp?type=n&id=744264&name...
testRuleflow.rf .
I set CollectionExpression to "children" and VariableName to "child"
properties of the component.
In the code to run rules:
....
Map variables = new HashMap();
variables.put("children", collection);
ksession.startProcess(ruleFlowName, variables);
ksession.fireAllRules();
....
But when I run the code it throws the following exception:
437 [main] INFO com.test.TestForEach - Start process: flow
Exception in thread "main" java.lang.IllegalArgumentException: Could not
find collection children
at
org.drools.workflow.instance.node.ForEachNodeInstance$ForEachSplitNodeInstance.evaluateCollectionExpression(ForEachNodeInstance.java:112)
at
org.drools.workflow.instance.node.ForEachNodeInstance$ForEachSplitNodeInstance.internalTrigger(ForEachNodeInstance.java:81)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:112)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:148)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:135)
....
Any guesses what I am doing wrong?
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/How-to-Ruleflow-ForEa...
Sent from the Drools - Dev mailing list archive at
Nabble.com.