Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.1.0-SNAPSHOT
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jbpm.process.core.timer
Class BusinessCalendarImpl

    java.lang.Object
      org.jbpm.process.core.timer.BusinessCalendarImpl

All Implemented Interfaces:
  BusinessCalendar

    public class BusinessCalendarImpl

extends Object
implements BusinessCalendar

Default implementation of BusinessCalendar interface that is configured with properties. Following are supported properties:

- business.hours.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-DD-mm)
- 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)

Format
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

each holiday period should be separated from next one with comma: 2012-05-01:2012-05-15,2012-12-24:2012-12-27
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
`static String` | `DAYS_PER_WEEK`
`static String` | `END_HOUR`
`static String` | `HOLIDAY_DATE_FORMAT`
`static String` | `HOLIDAYS`
`static String` | `HOURS_PER_DAY`
`static String` | `START_HOUR`
`static String` | `TIMEZONE`
`static String` | `WEEKEND_DAYS`

Constructor Summary
`BusinessCalendarImpl()`
`BusinessCalendarImpl(Properties configuration)`
`BusinessCalendarImpl(Properties configuration, SessionClock clock)`

Method Summary
`protected String` | `adoptISOFormat(String timeExpression)`
`Date` | `calculateBusinessTimeAsDate(String timeExpression)` Calculates given time expression into target date based on calendar configuration.
`long` | `calculateBusinessTimeAsDuration(String timeExpression)` Calculates given time expression into duration in milliseconds based on calendar configuration.
`protected long` | `getCurrentTime()`
`protected int` | `getPropertyAsInt(String propertyName, String defaultValue)`
`protected void` | `handleHoliday(Calendar c)`
`protected void` | `handleWeekend(Calendar c)`
`protected void` | `init()`
`protected boolean` | `isWorkingDay(int day)`
`protected List<org.jbpm.process.core.timer.BusinessCalendarImpl.TimePeriod>` | `parseHolidays()`
`protected void` | `parseWeekendDays()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DAYS_PER_WEEK

    public static final String DAYS_PER_WEEK

See Also:
  Constant Field Values

### HOURS_PER_DAY

    public static final String HOURS_PER_DAY

See Also:
  Constant Field Values

### START_HOUR

    public static final String START_HOUR

See Also:
  Constant Field Values

### END_HOUR

    public static final String END_HOUR

See Also:
  Constant Field Values

### HOLIDAYS

    public static final String HOLIDAYS

See Also:
  Constant Field Values

### HOLIDAY_DATE_FORMAT

    public static final String HOLIDAY_DATE_FORMAT

See Also:
  Constant Field Values

### WEEKEND_DAYS

    public static final String WEEKEND_DAYS

See Also:
  Constant Field Values

### TIMEZONE

    public static final String TIMEZONE

See Also:
  Constant Field Values

Constructor Detail

### BusinessCalendarImpl

    public BusinessCalendarImpl()

### BusinessCalendarImpl

    public BusinessCalendarImpl(Properties configuration)

### BusinessCalendarImpl

    public BusinessCalendarImpl(Properties configuration,
                                SessionClock clock)

Method Detail

### init

    protected void init()

### adoptISOFormat

    protected String adoptISOFormat(String timeExpression)

### calculateBusinessTimeAsDuration

    public long calculateBusinessTimeAsDuration(String timeExpression)

  Description copied from interface: `BusinessCalendar`
  Calculates given time expression into duration in milliseconds based on calendar configuration.

  Specified by:
    `calculateBusinessTimeAsDuration` in interface `BusinessCalendar`
  Parameters:
    `timeExpression` - time expression that is supported by business calendar implementation.
  Returns:
    duration expressed in milliseconds

### calculateBusinessTimeAsDate

    public Date calculateBusinessTimeAsDate(String timeExpression)

  Description copied from interface: `BusinessCalendar`
  Calculates given time expression into target date based on calendar configuration.

  Specified by:
    `calculateBusinessTimeAsDate` in interface `BusinessCalendar`
  Parameters:
    `timeExpression` - time expression that is supported by business calendar implementation.
  Returns:
    date when given time expression will match in the future

### handleHoliday

    protected void handleHoliday(Calendar c)

### getPropertyAsInt

    protected int getPropertyAsInt(String propertyName,
                                   String defaultValue)

### parseHolidays

    protected List<org.jbpm.process.core.timer.BusinessCalendarImpl.TimePeriod> parseHolidays()

### parseWeekendDays

    protected void parseWeekendDays()

### getCurrentTime

    protected long getCurrentTime()

### isWorkingDay

    protected boolean isWorkingDay(int day)

### handleWeekend

    protected void handleWeekend(Calendar c)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.1.0-SNAPSHOT
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.