[rules-users] Can calendars be defined within .drl ?
Alexander Wolf
mail at alexander-wolf.net
Fri Sep 13 08:49:09 EDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130913/df2b4211/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20130913/df2b4211/attachment-0001.bin
More information about the rules-users
mailing list