[rules-users] using homemade Date in Drools

Maxime Catelin mcatelin at perinfo.com
Mon May 21 09:34:12 EDT 2007


Hi,

We are using a lot of Dates in our application but we use a homemade 
Date class for that.  Therefore, we cannot use > and < provided by 
Drools.  I looked through the mailing list but could not find any 
examples using Dates in Drools other than in the documentation.  What 
interested me in particular in the documentation was "If more control is 
required, use the predicate constraint."

Could someone give some examples of using predicate constraint with dates?

Something I would like to do, for example, is the following :

If there is an obj1 of class A with field of type Date d1 and another 
obj2 of class A with field Date d2, where d1 is before d2, obj2 should 
be used to fire something.

rule XXX
when
    obj : A( $date : mydate)
    // do not know how to use constraint on date here.
then
    // something
    obj.doSomething();
end

Thanks for your input.



More information about the rules-users mailing list