Class WorkingDaysToDaysReportConverter

java.lang.Object
io.kadai.monitor.internal.preprocessor.WorkingDaysToDaysReportConverter

public class WorkingDaysToDaysReportConverter extends Object
The DaysToWorkingDaysReportConverter provides a method to convert an age in days into an age in working days. Before the method convertDaysToWorkingDays() can be used, the WorkingDaysToDaysReportConverter has to be initialized. For a list of TimeIntervalColumnHeaders the converter creates a "table" with integer that represents the age in days from the largest lower limit until the smallest upper limit of the timeIntervalColumnHeaders. This table is valid for a whole day until the converter is initialized with bigger limits.
  • Method Details

    • initialize

      public static WorkingDaysToDaysReportConverter initialize(List<? extends TimeIntervalColumnHeader> columnHeaders, io.kadai.common.api.WorkingTimeCalculator workingTimeCalculator) throws io.kadai.common.api.exceptions.InvalidArgumentException
      Throws:
      io.kadai.common.api.exceptions.InvalidArgumentException
    • initialize

      public static WorkingDaysToDaysReportConverter initialize(List<? extends TimeIntervalColumnHeader> columnHeaders, io.kadai.common.api.WorkingTimeCalculator workingTimeCalculator, Instant referenceDate) throws io.kadai.common.api.exceptions.InvalidArgumentException
      Initializes the WorkingDaysToDaysConverter for a list of TimeIntervalColumnHeaders and a referenceDate. A new table is only created if there are bigger limits or the date has changed.
      Parameters:
      columnHeaders - a list of TimeIntervalColumnHeaders that determines the size of the table
      workingTimeCalculator - the workingTimeCalculator used by kadai to determine if a specific day is a working day.
      referenceDate - a Instant that represents the current day of the table
      Returns:
      an instance of the WorkingDaysToDaysConverter
      Throws:
      io.kadai.common.api.exceptions.InvalidArgumentException - thrown if columnHeaders or referenceDate is null
    • convertDaysToWorkingDays

      public int convertDaysToWorkingDays(int amountOfDays)
    • convertWorkingDaysToDays

      public List<Integer> convertWorkingDaysToDays(int amountOfWorkdays)
    • generateDaysToWorkingDays

      protected Map<Integer,Integer> generateDaysToWorkingDays(List<? extends TimeIntervalColumnHeader> columnHeaders, Instant referenceDate)
    • toString

      public String toString()
      Overrides:
      toString in class Object