Anybody?
All,
I’m trying to prepare some answers to questions of a customer
The client wish to execute some rules on dates which are not today.
The rule is:
1. |
| |
rule "TooYoung" |
2. |
| |
date-expires "26-MAR-2013" |
3. |
| |
date-effective "19-MAR-2010" |
4. |
| |
dialect "mvel" |
5. |
| |
when |
6. |
| |
Driver( age < "16" ) |
7. |
| |
then |
8. |
| |
Rejection fact0 = new Rejection(); |
9. |
| |
fact0.setReason( "TooYoung" ); |
10. |
| |
insert(fact0 ); |
11. |
| |
System.out.println("TooYoung"); |
12. |
| |
end |
First test with execution date set to today in Guvnor/test-scenario
Rule is executed - OK
Second test with execution date set to tomorrow
Rule is executed – OK
Now one change the rule’s attributes and execution date
Execution date = 20-MAR-2011
date-effective = 19-MAR-2010
date-expires = 26-MAR-2011
no execution
Execution date = 20-MAR-2012
date-effective = 19-MAR-2012
date-expires = 26-MAR-2013
no execution
So my guess is the execution date is ignored.
I tried to use the AgendaFilter unsuccessfully.
ksession.fireAllRules(new AgendaFilter() {
public boolean accept(Activation a) {
System.out.println("-- " + a.getRule().getName());
return true;
}
});
But this code do not work for the specific rule above, others with no date attributes are going through and the sysout do its job.
My question is:
How can I tell the engine which rule to execute based on the
execution date? Maybe this behaviour is only in Guvnor.
Is it possible to set an execution date to the engine which is not today and
how to do it?
Thank you
Damien