See inline.
On 13/02/2013, Patrick <patrick.kelley(a)anixter.com> wrote:
Hello,
This is my current drool rule:
rule "RULE1"
when
context : StaticTaskContext(
taskToPerform.name == "TRANSFER",
deallocatedOrder == true,
currentTask != null
)
then
context.setRuleResult("STAYPUT");
end
What I need to do is check to see if the predecessor task is of a certain
value.
ie:
currentTask.getPredecessorTaskChains().iterate().next().getPredecessorTask.getTaskType()
== "VALUE"
I'm not aware of an *iterate()* method, I guess you mean iterator()?
Almost certainly, this condition does not describe what you want - it
just compares the first set element's predecessorTask.taskType.
But, again, I guess what you need:
rule "test type"
when
StaticTaskContext( $ct: currentTask != null )
TaskChain( predecessorTask.getTaskType() == "VALUE" )
from $ct.getPredecessorTaskChains()
then
...
end
This may fire repeatedly if there is more than one match - don't know
whether this is posible.
-W
The predecessorTaskChain is declared as:
private Set<TaskChain> predecessorTaskChains;
How can I go through all the task chains on the current task?
Thanks
--
View this message in context:
http://drools.46999.n3.nabble.com/Check-a-set-of-objects-for-a-value-tp40...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users