org.jbpm.process.core.timer
Class BusinessCalendarImpl

java.lang.Object
  extended by 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:

Format
Holidays can be given in two formats: 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
 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()

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)


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