[rules-users] Re: How to write the validation timestamp lessthancurrent date using drools

Alexander Claus styjdt at claus4joy.de
Thu Jun 12 04:05:35 EDT 2008


Manya,
please do not open two threads for almost the same question!

> 1.end_timestamp must be > start_timestamp  this is the condition.
> 1.start_timestamp can not be =< Current Date this is the condition.

First, I think, "can not be <=" is the same as "must be >".

Drools is able to compare timestamps as primitive number types or as 
java.util.Date's. So without DSL you can directly (no matter, what type the 
timestamps are):
SomeClass(startTimestamp < endTimestamp, startTimestamp > $currentTimestamp)
where $currentTimestamp is a variable binding done earlier in the rule. 
Since clock support is introduced not until Drools 5, you have to insert a 
virtual clock object in the working memory, which you have to update with 
certain mechanism to the current system time.

If you have your solution without DSL it should not be difficult to cast and 
abstract this into a DSL.

Alexander Claus 




More information about the rules-users mailing list