Class TimeframedDataNeedUtils

java.lang.Object
energy.eddie.dataneeds.utils.TimeframedDataNeedUtils

public class TimeframedDataNeedUtils extends Object
  • Method Details

    • calculateRelativeStartAndEnd

      public static DataNeedWrapper calculateRelativeStartAndEnd(TimeframedDataNeed timeframedDataNeed, LocalDate referenceDate, Period earliestStart, Period latestEnd) throws IllegalArgumentException, UnsupportedDataNeedException
      Helper method that evaluates the start and end date of the passed data need.

      Evaluates the relative dates if the given data need has a relative duration. It uses referenceDate to calculate the start and end dates, therefore the date should have been created with the timezone of the region connector in mind. earliestStart and latestEnd represent the Periods for the earliest/latest date the calling region connector supports and are used if the data need is configured with open start/end. This method also calculates the correct start date if a sticky start is defined by the data needs relative duration.

      Parameters:
      timeframedDataNeed - Data need to calculate the start and end date for.
      referenceDate - Reference date to use as reference for calculations for relative durations.
      earliestStart - Period indicating the earliest start that is supported by the calling region connector.
      latestEnd - Period indicating the latest end that is supported by the calling region connector.
      Returns:
      Wrapper containing the data need and the start and end date.
      Throws:
      IllegalArgumentException
      UnsupportedDataNeedException