Try OpenEdge Now
skip to main content
BP Server Developer's Guide
Business calendar : Calculating the due date
 

Calculating the due date

A business calendar in XML format is parsed and stored in the database. In the SBM_CALENDAR table, the calendar name and the XML are also persisted.
The Calendar parser utility parses the XML and persists all holidays and weekends in the SBM_HOLIDAY table.
The database properties can be specified in the business calendar XML, or using APIs. Using these properties, the Business Calendar creates the database connection and persist all the required calendar information.
When the database properties are not specified either through an API or an XML, then the calendar utility tries to read the database properties from oebpsdb.properties. The Business Calendar reads oebpsdb.properties only using classpath.
Note: For calendar runtime initialization SBMCalendar.init(), if the specified properties are invalid, then an exception is raised.
For every due date calculation, a BizCalendar object is created and passed on to the getDueDate(BizCalendar) of the SBMCalendar object which returns the due date as a Calendar object. The due date is returned as a java.util.Calendar object so that information about locale, timezone, and other helper methods are available to the user.
long startDate = (new java.util.Date()).getTime();
long duration = 5*24*60*60*1000; //5 days in milliseconds
    SBMCalendar sbmcal = new SBMCalendar("savvion-usa-calendar.xml");
BizCalendar bcal = new BizCalendar(startDate, duration);
Calendar duedate = sbmcal.getDueDate(bcal);
System.out.println("DUEDATE: " + duedate.getTime().getTime());
Note: Cached calendars are updated during BP Server restart.
* Workstep instance due date
* Pre-script in workstep due date
* Work item due date