Chapter 14. Business calendar

Table of Contents

Duedate
Duration
Base date
Examples
Calendar configuration

This chapter describes the business calendar of jBPM. The business calendar knows about business hours and is used in calculation of due dates for tasks and timers.

The business calendar is able to calculate a due date by adding a duration to or subtracting it from a base date. If the base date is ommited, the 'current' date is used.

Duedate

As mentioned the due date is composed of a duration and a base date. If this base date is ommitted, the duration is relative to the date (and time) at the moment of calculating the duedate. The format is:

duedate ::= [<basedate> +/-] <duration>

Duration

A duration is specified in absolute or in business hours. Let's look at the syntax:

duration ::= <quantity> [business] <unit>

Where <quantity> is a piece of text that is parsable with Double.parseDouble(quantity). <unit> is one of {second, seconds, minute, minutes, hour, hours, day, days, week, weeks, month, months, year, years}. And adding the optional indication business means that only business hours should be taken into account for this duration. Without the indication business, the duration will be interpreted as an absolute time period.

Base date

A duration is specified in absolute or in business hours. Let's look at the syntax:

basedate ::= <EL>

Where <EL> is any JAVA Expression Language expression that resolves to a JAVA Date or Calendar object. Referencing variable of other object types, even a String in a date format like '2036-02-12', will throw a JbpmException

NOTE: This basedate is supported on the duedate attributes of a plain timer, on the reminder of a task and the timer within a task. It is not supported on the repeat attributes of these elements.

Examples

The following examples of the usage are all possible

<timer name="daysBeforeHoliday" duedate="5 business days">...</timer>

<timer name="pensionDate" duedate="#{dateOfBirth} + 65 years" >...</timer>

<timer name="pensionReminder" duedate="#{dateOfPension} - 1 year" >...</timer>

<timer name="fireWorks" duedate="#{chineseNewYear} repeat="1 year" >...</timer>

<reminder name="hitBoss" duedate="#{payRaiseDay} + 3 days" repeat="1 week" />