Class WorkingDayCalculatorImpl
java.lang.Object
pro.taskana.common.internal.workingtime.WorkingDayCalculatorImpl
- All Implemented Interfaces:
WorkingTimeCalculator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddWorkingTime(Instant workStart, Duration workingTime) AddsworkingTimefromworkStart.booleanisGermanHoliday(Instant instant) Decides whetherinstantis a holiday in Germany.booleanDecides whether { @code instant} is a holiday.booleanDecides whetherinstantis a weekend day.booleanisWorkingDay(Instant instant) Decides whetherinstantis a working day.subtractWorkingTime(Instant workStart, Duration workingTime) SubtractsworkingTimefromworkStart.workingTimeBetween(Instant first, Instant second) Calculates the working time betweenfirstandsecondaccording to the configured working time schedule.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface pro.taskana.common.api.WorkingTimeCalculator
isWorkingTimeBetween
-
Constructor Details
-
WorkingDayCalculatorImpl
-
-
Method Details
-
subtractWorkingTime
public Instant subtractWorkingTime(Instant workStart, Duration workingTime) throws InvalidArgumentException Description copied from interface:WorkingTimeCalculatorSubtractsworkingTimefromworkStart. Respects the configured working time schedule and Holidays.The returned Instant denotes the first time in point the work time starts or in short it is inclusive.
E.g can be used for planned date calculation.
- Specified by:
subtractWorkingTimein interfaceWorkingTimeCalculator- Parameters:
workStart- The InstantworkingTimeis subtracted from.workingTime- The Duration to subtract fromworkStart. May have any resolution Duration supports, e.g. minutes or seconds.- Returns:
- A new Instant which represents the subtraction of working time.
- Throws:
InvalidArgumentException- IfworkingTimeis negative.
-
addWorkingTime
public Instant addWorkingTime(Instant workStart, Duration workingTime) throws InvalidArgumentException Description copied from interface:WorkingTimeCalculatorAddsworkingTimefromworkStart. Respects the configured working time schedule and Holidays.The returned Instant denotes the first time in point the work time has ended or in short it is exclusive.
E.g can be used for due date calculation.
- Specified by:
addWorkingTimein interfaceWorkingTimeCalculator- Parameters:
workStart- The InstantworkingTimeis added to.workingTime- The Duration to add toworkStart. May have any resolution Duration supports, e.g. minutes or seconds.- Returns:
- A new Instant which represents the addition of working time.
- Throws:
InvalidArgumentException- IfworkingTimeis negative.
-
workingTimeBetween
Description copied from interface:WorkingTimeCalculatorCalculates the working time betweenfirstandsecondaccording to the configured working time schedule. The returned Duration is precise to nanoseconds.This method does not impose any ordering on
firstorsecond.- Specified by:
workingTimeBetweenin interfaceWorkingTimeCalculator- Parameters:
first- An Instant denoting the start or end of the considered time frame.second- An Instant denoting the start or end of the considered time frame.- Returns:
- The Duration representing the working time between
firstandto. - Throws:
InvalidArgumentException- If eitherfirstorsecondisnull.
-
isWorkingDay
Description copied from interface:WorkingTimeCalculatorDecides whetherinstantis a working day.- Specified by:
isWorkingDayin interfaceWorkingTimeCalculator- Parameters:
instant- The Instant to check. May not benull.- Returns:
trueifinstantis a working day.falseotherwise.
-
isWeekend
Description copied from interface:WorkingTimeCalculatorDecides whetherinstantis a weekend day.- Specified by:
isWeekendin interfaceWorkingTimeCalculator- Parameters:
instant- The Instant to check. May not benull.- Returns:
trueifinstantis a weekend day.falseotherwise.
-
isHoliday
Description copied from interface:WorkingTimeCalculatorDecides whether { @code instant} is a holiday.- Specified by:
isHolidayin interfaceWorkingTimeCalculator- Parameters:
instant- The Instant to check. May not benull.- Returns:
trueifinstantis a holiday.falseotherwise.
-
isGermanHoliday
Description copied from interface:WorkingTimeCalculatorDecides whetherinstantis a holiday in Germany.- Specified by:
isGermanHolidayin interfaceWorkingTimeCalculator- Parameters:
instant- The Instant to check. May not benull.- Returns:
trueifinstantis a holiday in Germany.falseotherwise.
-