BusinessCalendar

From RunaWFE

Jump to: navigation, search

Business calendar

Version 4.3.0

© 2015-2018, "Process Technologies" Ltd, this document is available under GNU FDL license. RUNA WFE is an open source system distributed under a LGPL license (http://www.gnu.org/licenses/lgpl.html).

Source code moved from https://sourceforge.net/p/runawfe to https://github.com/processtech.


Contents

# Configuration

business.calendar.properties

name description default value
business.week.expressed.in.business.days
the number of business days in one business week 5
business.month.expressed.in.business.days
the number of business days in one business month 21
business.year.expressed.in.business.days
the number of business days in one business year 220
weekday.(dayname), where (dayname) = monday tuesday wednesday thursday friday saturday sunday
working time intervals in format [(daypart) [& (daypart)]*], where (daypart) is in format (time of start)-(time of end)
holiday.(anystring), where (anystring) = any string
days off in format defined in date.format.pattern

# Duration format

Duration is set in format

[+|-]<quantity of time> [business] <measurement unit>

, where

  • 1st symbol (optional) can signify the direction of time counting (adding or subtracting time). If it's omitted + is by default
  • quantity of time is an integer
  • business (optional) is business time marker
  • measurement unit is one of the following: seconds, minutes, hours, days, weeks, months, years

Note. Seconds measurement unit is not supported.

# Algorithm

If it's not business time

The indicated number of measurement units is added to the base date by java.util.Calendar.add(..).

If it's business time

All business time operations are held either in minutes or in days. When minutes are used (time measurement unit is smaller than business day) working time intervals are kept in mind. Days are used for time measurement unit business days or larger.

This means that 480 business minutes and 1 business days is not the same.

  1. business hours are converted to business minutes; business weeks, business months, business years - to business days
  2. If current time in the base date is not in working time intervals then depending on the counting direction the closest working time is used.
  3. Simple count by working time intervals is used for minutes (or by business days for days) to find out the resultant date-time

# Extension

Any class that implements ru.runa.wfe.commons.bc.BusinessCalendar interface can be used as business calendar implementation. To switch to the desired implementation in Spring context change bean class for the bean with id = businessCalendar Example:

<bean id="businessCalendar" class="ru.runa.timings.logic.AlfBusinessCalendar" />

It can be useful to extend ru.runa.wfe.commons.bc.AbstractBusinessCalendar implementing method

protected abstract BusinessDay getBusinessDay(Calendar calendar);

, that returns business time intervals in BusinessDay object for the given date (calendar).

Personal tools