Nope, at the moment the largest unit supported is day.
There are a couple reasons for that, including that such use cases
require access to historic data that is usually kept outside the rules
engine (in a database for instance) and loaded on demand, but the main
reason was I didn't want to commit to a given temporal semantics
before having a clear picture of the direction Java is going. Once we
start talking about months, we are required to support Calendars, due
to the different semantics of months in different calendars. Although
we have JodaTime that is a pretty established date/time API, we also
have JSR-310 that I was hoping would be finalized for Java 7.
In other words, it is on our TODO list to improve temporal
reasoning with full blown date/time API and units, but not sure this
will be done for Drools 5.2. More likely in Drools 6, mid 2011.
Edson
2010/11/16 Nathan Bell <Nathan.Bell(a)pharmacyonesource.com>:
Fusion seems to only support days, hours, minutes, seconds and
milliseconds
for the units of time used with temporal operators. For example consider the
following rule (which works correctly):
rule "AdmittedInLast7Days"
dialect "java"
when
$now : RuleTime()
$account : PatientAccount(this after[-7d,0s] $now )
then
System.out.println("AdmittedInLast7Days fired");
End
Now suppose that I want an alternate version of this rule that instead of
firing for patients admitted in the last 7 days it fires for patients
admitted in the last 7 months, or years. Is there built-in support for doing
this? If not, does anyone have suggestions on the best way to approach this?
Thank You,
Nathan Bell
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com