Working Time Calculator
The adapter calculates the working time.
The Working Time Calculator replaces with version 6.0 of the X4 BPMS the outdated working time calculation functions of the Java class de.softproject.xsl.WorkingTimeCalculator
, which were provided within XSL mappings.
Properties
Operationen | Defines the operation executed by the adapter Possible values:
|
Parameter
Adapter | Main class of the adapter (do not change!) Possible values: de.softproject.x4.adapter.workingTimeCalculator: Main class (default) |
Status values
1 | The operation was executed successfully and the output contains an XML document with the corresponding result |
-1 | An error occurred during the adapter's execution:
|
Input
The adapter expects a predefined input XML structure for the various operations:
- Holidays or vacation days (non-working days) are defined in the date format
yyyy-MM-dd
within any number of<Holiday>
elements. These are created as child elements of<Holidays>
. - Workdays (weekdays) are defined within
<WorkingDay>
elements. These are created as child elements of<WorkingDays>
. The value of<WorkingDay>
is the respective weekday in German or English, e.g.Montag
oderFriday
. The upper and lower case is not important. Special Days are defined in the date format
yyyy-MM-dd HH:mm-HH:mm
within any number of<SpecialDay>
elements. These are created as child elements of<SpecialDays>
.SpecialDays
are considered a special working day regardless of if it is a normal working day or a day off. Only the time defined within<SpecialDay>
counts as working time.
The working time calculation functions dateDiff
or dateDiffWorkingMinutes
of the obsolete Java class de.softproject.xsl.WorkingTimeCalculator
have been replaced by the following functions:
dateDiffWorkingMinutes
can be implemented by operationGetWorkingTimeMinutes
dateDiff
can be implemented by defining all weekdays asWorkingDay
and setting working hours from00:00
to23:59
. NeitherHolidays
norSpecialDays
must be defined.
Operation AddWorkingTimeMinutes
Sample input for the operation AddWorkingTimeMinutes
<WorkingTimeCalculator>
<Holidays>
<Holiday>2019-01-01</Holiday>
<Holiday>2019-01-06</Holiday>
<Holiday>2019-04-19</Holiday>
<Holiday>2019-04-21</Holiday>
<Holiday>2019-04-22</Holiday>
</Holidays>
<SpecialDays>
<SpecialDay>2019-12-24 21:00-23:00</SpecialDay>
</SpecialDays>
<!--You can use either the German or the English word-->
<WorkingDays>
<WorkingDay>Monday</WorkingDay>
<WorkingDay>Tuesday</WorkingDay>
<WorkingDay>Wednesday</WorkingDay>
<WorkingDay>Thursday</WorkingDay>
<WorkingDay>Friday</WorkingDay>
</WorkingDays>
<setWorkingDayBegin>09:30</setWorkingDayBegin>
<setWorkingDayEnd>17:30</setWorkingDayEnd>
<StartDate>2019-12-23 10:00</StartDate> <!-- Format yyyy-MM-dd or yyyy-MM-dd HH:mm -->
<addMinutesToWorkingTime>500</addMinutesToWorkingTime>
</WorkingTimeCalculator>
Operation GetWorkingTimeMinutes
Sample input for the operation GetWorkingTimeMinutes
<WorkingTimeCalculator>
<Holidays>
<Holiday>2019-01-01</Holiday>
<Holiday>2019-01-06</Holiday>
<Holiday>2019-04-19</Holiday>
<Holiday>2019-04-21</Holiday>
<Holiday>2019-04-22</Holiday>
</Holidays>
<SpecialDays>
<SpecialDay>2019-12-24 21:00-23:00</SpecialDay>
</SpecialDays>
<!--You can use either the German or the English word-->
<WorkingDays>
<WorkingDay>Monday</WorkingDay>
<WorkingDay>Tuesday</WorkingDay>
<WorkingDay>Wednesday</WorkingDay>
<WorkingDay>Thursday</WorkingDay>
<WorkingDay>Friday</WorkingDay>
</WorkingDays>
<StartDate>2019-12-23 10:00</StartDate> <!-- Format yyyy-MM-dd or yyyy-MM-dd HH:mm -->
<EndDate>2020-01-01 10:00</EndDate> <!-- Format yyyy-MM-dd or yyyy-MM-dd HH:mm -->
<setWorkingDayBegin>09:30</setWorkingDayBegin>
<setWorkingDayEnd>17:30</setWorkingDayEnd>
</WorkingTimeCalculator>
Operation GetEaster
Sample input for the operation GetEaster
<WorkingTimeCalculator>
<GetEaster>2019</GetEaster>
</WorkingTimeCalculator>
Output
The adapter outputs an XML document depending on the selected operation:
Operation AddWorkingTimeMinutes
:
Sample output for the operation AddWorkingTimeMinutes
<WorkingTimeCalculator>
<addWorkingTimeMinutes>2019-12-24T21:50:00</addWorkingTimeMinutes>
</WorkingTimeCalculator>
Operation GetWorkingTimeMinutes
Sample output for the operation GetWorkingTimeMinutes
<WorkingTimeCalculator>
<getWorkingTimeMinutes>2010.0</getWorkingTimeMinutes>
</WorkingTimeCalculator>
Operation GetEaster
Sample output for the operation GetEaster
<EasterHolidays>
<EasterSunday>2019-04-21</EasterSunday>
</EasterHolidays>