Skip to main content
Skip table of contents

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:

  • AddWorkingTimeMinutes: Adds a certain number of working minutes to a start date and displays the end date and time
  • GetWorkingTimeMinutes: Calculates the working time between a start date and an end date and displays the working minutes
  • GetEaster: Calculates the Easter Sunday based on a year number

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:

  • The required date format (yyyy-MM-dd bzw. yyyy-MM-dd hh:mm) was not followed.
  • The days of the week were not entered correctly. A correct German or English weekday is required.
  • No Input available.

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 oder  Friday. 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 operation GetWorkingTimeMinutes
  • dateDiff can be implemented by defining all weekdays as WorkingDay and setting working hours from 00:00 to 23:59. Neither Holidays nor SpecialDays must be defined.

Operation AddWorkingTimeMinutes 

Sample input for the operation AddWorkingTimeMinutes

XML
<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

XML
<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

XML
<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

XML
<WorkingTimeCalculator>
	<addWorkingTimeMinutes>2019-12-24T21:50:00</addWorkingTimeMinutes>
</WorkingTimeCalculator>

Operation GetWorkingTimeMinutes

Sample output for the operation GetWorkingTimeMinutes

XML
<WorkingTimeCalculator>
	<getWorkingTimeMinutes>2010.0</getWorkingTimeMinutes>
</WorkingTimeCalculator>

Operation GetEaster

Sample output for the operation GetEaster

XML
<EasterHolidays>
	<EasterSunday>2019-04-21</EasterSunday>
</EasterHolidays>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.