Package energy.eddie.dataneeds.utils
Class TimeframedDataNeedUtils
java.lang.Object
energy.eddie.dataneeds.utils.TimeframedDataNeedUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic DataNeedWrappercalculateRelativeStartAndEnd(TimeframedDataNeed timeframedDataNeed, LocalDate referenceDate, Period earliestStart, Period latestEnd) Helper method that evaluates the start and end date of the passed data need.
-
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
referenceDateto calculate the start and end dates, therefore the date should have been created with the timezone of the region connector in mind.earliestStartandlatestEndrepresent 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:
IllegalArgumentExceptionUnsupportedDataNeedException
-