Creating Business Calendar

You can create business calendars at design time using annotated Java interfaces or runtime using UI screens available at Administration → Business calendars.

Creating Business Calendar at Runtime

Open the Administration → Business calendars application screen and click the Create button.

After that, the Business calendar editor is opened.

business calendar editor

Specify the following parameters:

  • Name - human-readable description of the given calendar.

  • Code - unique identifier of the given calendar.

On the Holidays tab, click Create to add holidays and weekends.

business calendar holidays

The add-on supports the following types of holidays:

  • Day of week - allows specifying holiday for desired week’s days; for example, Saturday and Sunday.

    business calendar day of week
  • Specific date holiday - allows setting holiday for an exact date, for example, 2022-08-03.

    business calendar specific date holiday
  • Annual holiday - repeatable yearly holidays, like the 1st of January.

    business calendar annual holiday
  • Cron-based holiday - allows specifying holidays in the quartz CRON format. See Cron trigger tutorial for more information.

    business calendar cron holiday

    It can help specify some none trivial holidays, like the Third Friday of every month or the First Monday of July, etc.

On the Working schedule tab, you can specify working hours for each day of the week. There can be more than one working period per day, but they should not overlap.

working sheduler editor

You can define some holidays as working days on the Additional business days tab. If such a day belongs to one of the holidays, it will be considered a working day.

additional business day editor

Creating Business Calendar at Design Time

You can create a business calendar at design time using annotated Java interfaces, for example:

@BusinessCalendar(name = "Sample Business Calendar",
                  code = "sample-business-calendar") (1)
public interface SampleBusinessCalendar {

    @CronHoliday(expression = "* * * 1-2 MAY ?") (2)
    @CronHoliday(expression = "* * * ? * 6#3")
    void cronHoliday();

    @WeeklyHoliday(DayOfWeek.SATURDAY)
    @WeeklyHoliday(value = DayOfWeek.SUNDAY,
            description = "Sunday is always a day for family") (3)
    void weeklyHolidays();

    @FixedDayHoliday(fixedDate = "2021-05-08") (4)
    @FixedDayHoliday(fixedDate = "2021-05-09")
    void fixedHoliday();

    @FixedYearlyHoliday(month = Month.NOVEMBER, dayOfMonth = 4) (5)
    @FixedYearlyHoliday(month = Month.JUNE, dayOfMonth = 12)
    void fixedYearlyHoliday();

    @ScheduledBusinessDay(dayOfWeek = DayOfWeek.MONDAY,
            startTime = "08:00", endTime = "17:00") (6)
    @ScheduledBusinessDay(dayOfWeek = DayOfWeek.WEDNESDAY,
            startTime = "09:00", endTime = "17:00")
    @ScheduledBusinessDay(dayOfWeek = DayOfWeek.FRIDAY,
            startTime = "10:00", endTime = "15:00")
    void scheduledBD();

    @AdditionalBusinessDay(fixedDate = "2021-05-06",
            startTime = "10:00", endTime = "16:30") (7)
    @AdditionalBusinessDay(fixedDate = "2021-05-07",
            startTime = "10:00", endTime = "16:30")
    void additionalBD();

}
1 Annotated business calendar is an interface annotated with the @BusinessCalendar annotation. You should specify the following parameters for the @BusinessCalendar annotation:
  • name - a human-readable description of a given calendar;

  • code - a unique identifier of a given calendar.

2 Specify holiday in the quartz CRON format.
3 Specify holiday for desired week’s days.
4 Specify holiday for a specific date.
5 Specify holiday for an annually recurring date.
6 Specify scheduled business days.
7 Specify additional business days.

A business calendar created at the design time is displayed in the list of all business calendars and is available only for viewing.

business calendars