Hi all !
I'm trying to integrate some Drool Rules in a simple process. Basically I'm creating an user class which has some properties:
User user = new User("George",50);
Map<String, Object> params = new HashMap<String, Object>();
ProcessInstance processInstance = ksession.createProcessInstance("DemoProcess", params);
When the process is started, there is a Gateway with the following rule in it:
--------- Node X
--------- Node Y
The Rules in the Gateway(X) are:
user.IsAdult -->Go to Node X
!user.IsAdult -->Go to Node Y
The problem is that the condition is always evaluated to Y because the Rule that sets isAdult seems to be evaluated later (when the process already passed that Gateway)
rule "check user"
$p: User( age > 18)
$pi: WorkflowProcessInstanceImpl($user: variables['user'])
Is there something I am missing in my process ????
Thanks a lot
fireAllRules should go before you start the process. Alternatively you could have a business rule task that runs the rule before you go to gateway.