Hey, 

I use a lot of quartz calendars in my rules like this:

rule "my rule"
        calendars "myCalendar"  
when

But defining them in java is quite verbose. Also I often use the same calendar 
for only one rule. I believe the calendar is part of the logic and therefore 
don't like to initialize it elsewhere but with the logic code in the rule.

DailyCalendar myCalendar = new DailyCalendar( 7, 0, 0, 0, 8, 0, 0, 0 );
myCalendar.setInvertTimeRange( true );
ksession.getCalendars().set( "myCalendar", QuartzHelper.quartzCalendarAdapter( 
myCalendar ) );

I would rather define calendars directly in the rule files or even exactly 
where I use them, e.g.

rule "my super rule"
        calendars DailyCalendar(   7, 0, 0, 0, 8, 0, 0, 0, true );
when

or defining them in the rule file like this: (example)

declare "myCalendar"
        @role(calendar)
        @type( daily )
        @from (7,0,0)
        @until (8, 0, 0)
        @invert(true)
end

and the use them as ever. 

I couldnt find anything like this in the documentation, but would not be 
surprised if it is actually already possible somehow.
 
If not I would like to suggest this as a new feature ;)  (I think I'd prefer 
the second example with declare)

- Alex

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to