Package org.jbpm.process.core.timer
Class BusinessCalendarImpl
java.lang.Object
org.jbpm.process.core.timer.BusinessCalendarImpl
- All Implemented Interfaces:
BusinessCalendar
Default implementation of BusinessCalendar interface that is configured with properties.
Following are supported properties:
Holidays can be given in two formats:
Holiday date format must be given in pattern that is supported by
Weekend days should be given as integer that corresponds to
- business.days.per.week - specifies number of working days per week (default 5)
- business.hours.per.day - specifies number of working hours per day (default 8)
- business.start.hour - specifies starting hour of work day (default 9AM)
- business.end.hour - specifies ending hour of work day (default 5PM)
- business.holidays - specifies holidays (see format section for details on how to configure it)
- business.holiday.date.format - specifies holiday date format used (default yyyy-MM-dd)
- business.weekend.days - specifies days of the weekend (default Saturday and Sunday)
- business.cal.timezone - specifies time zone to be used (if not given uses default of the system it runs on)
Holidays can be given in two formats:
- as date range separated with colon - for instance 2012-05-01:2012-05-15
- single day holiday - for instance 2012-05-01
Holiday date format must be given in pattern that is supported by
java.text.SimpleDateFormat.Weekend days should be given as integer that corresponds to
java.util.Calendar constants.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBusinessCalendarImpl(Properties configuration) BusinessCalendarImpl(Properties configuration, org.kie.kogito.timer.SessionClock clock) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringadoptISOFormat(String timeExpression) calculateBusinessTimeAsDate(String timeExpression) Calculates given time expression into target date based on calendar configuration.longcalculateBusinessTimeAsDuration(String timeExpression) Calculates given time expression into duration in milliseconds based on calendar configuration.protected longprotected intgetPropertyAsInt(String propertyName, String defaultValue) protected voidhandleHoliday(Calendar c, boolean resetTime) protected voidhandleWeekend(Calendar c, boolean resetTime) protected voidinit()protected booleanisWorkingDay(int day) protected List<org.jbpm.process.core.timer.BusinessCalendarImpl.TimePeriod>protected void
-
Field Details
-
DAYS_PER_WEEK
- See Also:
-
HOURS_PER_DAY
- See Also:
-
START_HOUR
- See Also:
-
END_HOUR
- See Also:
-
HOLIDAYS
- See Also:
-
HOLIDAY_DATE_FORMAT
- See Also:
-
WEEKEND_DAYS
- See Also:
-
TIMEZONE
- See Also:
-
-
Constructor Details
-
BusinessCalendarImpl
public BusinessCalendarImpl() -
BusinessCalendarImpl
-
BusinessCalendarImpl
-
-
Method Details
-
init
protected void init() -
adoptISOFormat
-
calculateBusinessTimeAsDuration
Description copied from interface:BusinessCalendarCalculates given time expression into duration in milliseconds based on calendar configuration.- Specified by:
calculateBusinessTimeAsDurationin interfaceBusinessCalendar- Parameters:
timeExpression- time expression that is supported by business calendar implementation.- Returns:
- duration expressed in milliseconds
-
calculateBusinessTimeAsDate
Description copied from interface:BusinessCalendarCalculates given time expression into target date based on calendar configuration.- Specified by:
calculateBusinessTimeAsDatein interfaceBusinessCalendar- Parameters:
timeExpression- time expression that is supported by business calendar implementation.- Returns:
- date when given time expression will match in the future
-
handleHoliday
-
getPropertyAsInt
-
parseHolidays
-
parseWeekendDays
protected void parseWeekendDays() -
getCurrentTime
protected long getCurrentTime() -
isWorkingDay
protected boolean isWorkingDay(int day) -
handleWeekend
-