Interface TimeWindowElement

  • All Superinterfaces:
    Detail, Readable, SchedulerEntity, SchedulerEntityComp

    public interface TimeWindowElement
    extends Detail, Readable
    Represents a period in time [start-moment, end-moment). Each interval is defined as an intersection of constraints on timestamp, month, day of month, weekday of month (such as third Friday of a month), weekday (such as every Friday) and time of day. Each of these constraints is represented with two restrictions: fromRestriction and toRestriction. Setting one of them to null lifts the corresponding restriction up: Setting fromRestriction to null implies that the interval opens as early as possible; setting toRestriction to null implies that the interval opens as late as possible. Setting both to null eliminates the whole constraint. The default value for these constraints is null and as a result an empty TimeWindowElement is always open. The open periods of the "enabled during" time window are intersected with the constraints to define the open times. The open periods of the "disabled during" time window are subtracted from the open periods.
    • Method Detail

      • getDateFrom

        DateTimeZone getDateFrom()
        Get the value for DateFrom. (The date-time stamp from which the time window is active. If both constraints are set and DateTo is before DateFrom then the interval is restricted to a complement of [DateFrom, DateTo), i.e. to (lowDate, DateTo) ∪ [DateFrom, highDate). If DateFrom = DateTo then the window is always closed.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getDateTo

        DateTimeZone getDateTo()
        Get the value for DateTo. (The date until which the time window is active. See DateFrom for extra details.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getDayFrom

        Long getDayFrom()
        Get the value for DayFrom. (The day from which the time window is active counted from the first day of the month (1-31). The values 1, 0, and null are treated the same and define the first day. The value 1000 is a special value to indicate the last day. If a month has less days then specified, the interval will start on the last day of the month. )
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getDayTo

        Long getDayTo()
        Get the value for DayTo. (The day until which the time window is active counted from the first day of the month (1-31). The values 31, 1000, 0, and null are treated the same and define the first day. The value 1000 is a special value to indicate the last day. If a month has less days then specified, the interval will close on the last day of the month. )
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getDescription

        String getDescription()
        Get the value for Description. (Optional description for the time window element defined by the user.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getMonthFrom

        Long getMonthFrom()
        Get the value for MonthFrom. (The month from which the time window is active (1-12). The values 1, 0, and null are treated the same and define the first month.

        Examples:

        • Every March: <3,3>, i.e.[1.03 00:00, 1.04 00:00)
        • First quarter: <0,3> or <1,3>
        • Last quarter: <10,12> or <10,0>
        • First and last quarters: <10,3> (will be wrapped);
        )
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getMonthTo

        Long getMonthTo()
        Get the value for MonthTo. (The month until which the time window is active (1-12). The values 0, 12, and null are treated the same and define the last month. See MonthFrom for more details.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getParameters

        String getParameters()
        Get the value for Parameters. (Parameters for period functions. Period functions receive all of the constraintFrom and constraintTo attributes plus the Parameters. Parameters are represented with one line per parameter, of the form parameter-name = value. )
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getTimeOfDayFrom

        Long getTimeOfDayFrom()
        Get the value for TimeOfDayFrom. (Time of day in ms from which the time window is active. Resolution is in seconds; the value entered will be rounded to the second.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getTimeOfDayTo

        Long getTimeOfDayTo()
        Get the value for TimeOfDayTo. (Time of day in ms until which the time window is active. Resolution is in seconds; the value entered will be rounded to the second.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getOffsetTimeOfDay

        Long getOffsetTimeOfDay()
        Get the value for OffsetTimeOfDay. (Specifies the day rollover, which is the time in ms of the start of the day, in which TimeOfDayFrom and TimeOfDayTo are set. May wrap to the next day. )
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getWeekdayTo

        Long getWeekdayTo()
        Get the value for WeekdayTo. (The weekday until which the time window is active. See WeekdayFrom for extra details.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getWeekFrom

        Long getWeekFrom()
        Get the value for WeekFrom. (The day or week number that is used together with WeekdayFrom and WeekdayTo constraints.

        If the corresponding weekday constraint refers to a weekly day (e.g., Friday, or weekend) then this attribute refers to the week number of the weekday. For example, if this attribute is not set, and WeekdayFrom = Friday, WeekdayTo = Saturday, then the interval will be open every week from Friday to Saturday. If WeekFrom is set to 3 and WeekTo is set to 5 then the interval will be opened every month from the third Friday to the last Saturday.

        If the corresponding weekday constraint refers to a monthly day (e.g., WORKDAY or ANYYDAY) then this attribute refers to the day number in a month. For example, if WeekdayFrom is set to WORKDAY, WeekdayTo is set to WORKDAY, and WeekFrom is set to 3 and WeekTo is set to 5 then the interval will be opened from the 3-rd to the 5-th working day of the month.

        For conventional months we can have maximal of 5 weeks, 23 working days and 31 days. If a month has less days than set in WeekFrom or WeekTo then the LAST (working) day of the month is used. Thus, setting the latter to 31 will create an interval that is open every last day of a month, that may, for example, fall on the 28-th of February as well. The value 1000 can be used as a special value to indicate the last day. )

        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getWeekTo

        Long getWeekTo()
        Get the value for WeekTo. (The day or week number that is used together with WeekdayFrom and WeekdayTo constraints. See WeekdayFrom for extra details.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • getDayShift

        Long getDayShift()
        Get the value for DayShift. (The number of days that the open period for the time window element must be shifted.)
        Returns:
        the field
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setDateFrom

        void setDateFrom​(DateTimeZone newDateFrom)
        Set the value for DateFrom. (The date-time stamp from which the time window is active. If both constraints are set and DateTo is before DateFrom then the interval is restricted to a complement of [DateFrom, DateTo), i.e. to (lowDate, DateTo) ∪ [DateFrom, highDate). If DateFrom = DateTo then the window is always closed.) This value is optional.
        Parameters:
        newDateFrom - the new value for DateFrom.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setDateTo

        void setDateTo​(DateTimeZone newDateTo)
        Set the value for DateTo. (The date until which the time window is active. See DateFrom for extra details.) This value is optional.
        Parameters:
        newDateTo - the new value for DateTo.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setDayFrom

        void setDayFrom​(Long newDayFrom)
        Set the value for DayFrom. (The day from which the time window is active counted from the first day of the month (1-31). The values 1, 0, and null are treated the same and define the first day. The value 1000 is a special value to indicate the last day. If a month has less days then specified, the interval will start on the last day of the month. ) This value is optional.
        Parameters:
        newDayFrom - the new value for DayFrom.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setDayTo

        void setDayTo​(Long newDayTo)
        Set the value for DayTo. (The day until which the time window is active counted from the first day of the month (1-31). The values 31, 1000, 0, and null are treated the same and define the first day. The value 1000 is a special value to indicate the last day. If a month has less days then specified, the interval will close on the last day of the month. ) This value is optional.
        Parameters:
        newDayTo - the new value for DayTo.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setDescription

        void setDescription​(String newDescription)
        Set the value for Description. (Optional description for the time window element defined by the user.) This value is optional.
        Parameters:
        newDescription - the new value for Description.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setMonthFrom

        void setMonthFrom​(Long newMonthFrom)
        Set the value for MonthFrom. (The month from which the time window is active (1-12). The values 1, 0, and null are treated the same and define the first month.

        Examples:

        • Every March: <3,3>, i.e.[1.03 00:00, 1.04 00:00)
        • First quarter: <0,3> or <1,3>
        • Last quarter: <10,12> or <10,0>
        • First and last quarters: <10,3> (will be wrapped);
        ) This value is optional.
        Parameters:
        newMonthFrom - the new value for MonthFrom.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setMonthTo

        void setMonthTo​(Long newMonthTo)
        Set the value for MonthTo. (The month until which the time window is active (1-12). The values 0, 12, and null are treated the same and define the last month. See MonthFrom for more details.) This value is optional.
        Parameters:
        newMonthTo - the new value for MonthTo.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setParameters

        void setParameters​(String newParameters)
        Set the value for Parameters. (Parameters for period functions. Period functions receive all of the constraintFrom and constraintTo attributes plus the Parameters. Parameters are represented with one line per parameter, of the form parameter-name = value. ) This value is optional.
        Parameters:
        newParameters - the new value for Parameters.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setTimeOfDayFrom

        void setTimeOfDayFrom​(Long newTimeOfDayFrom)
        Set the value for TimeOfDayFrom. (Time of day in ms from which the time window is active. Resolution is in seconds; the value entered will be rounded to the second.) This value is optional.
        Parameters:
        newTimeOfDayFrom - the new value for TimeOfDayFrom.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setTimeOfDayTo

        void setTimeOfDayTo​(Long newTimeOfDayTo)
        Set the value for TimeOfDayTo. (Time of day in ms until which the time window is active. Resolution is in seconds; the value entered will be rounded to the second.) This value is optional.
        Parameters:
        newTimeOfDayTo - the new value for TimeOfDayTo.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setOffsetTimeOfDay

        void setOffsetTimeOfDay​(Long newOffsetTimeOfDay)
        Set the value for OffsetTimeOfDay. (Specifies the day rollover, which is the time in ms of the start of the day, in which TimeOfDayFrom and TimeOfDayTo are set. May wrap to the next day. ) This value is optional.
        Parameters:
        newOffsetTimeOfDay - the new value for OffsetTimeOfDay.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setWeekdayTo

        void setWeekdayTo​(Long newWeekdayTo)
        Set the value for WeekdayTo. (The weekday until which the time window is active. See WeekdayFrom for extra details.) This value is optional.
        Parameters:
        newWeekdayTo - the new value for WeekdayTo.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setWeekFrom

        void setWeekFrom​(Long newWeekFrom)
        Set the value for WeekFrom. (The day or week number that is used together with WeekdayFrom and WeekdayTo constraints.

        If the corresponding weekday constraint refers to a weekly day (e.g., Friday, or weekend) then this attribute refers to the week number of the weekday. For example, if this attribute is not set, and WeekdayFrom = Friday, WeekdayTo = Saturday, then the interval will be open every week from Friday to Saturday. If WeekFrom is set to 3 and WeekTo is set to 5 then the interval will be opened every month from the third Friday to the last Saturday.

        If the corresponding weekday constraint refers to a monthly day (e.g., WORKDAY or ANYYDAY) then this attribute refers to the day number in a month. For example, if WeekdayFrom is set to WORKDAY, WeekdayTo is set to WORKDAY, and WeekFrom is set to 3 and WeekTo is set to 5 then the interval will be opened from the 3-rd to the 5-th working day of the month.

        For conventional months we can have maximal of 5 weeks, 23 working days and 31 days. If a month has less days than set in WeekFrom or WeekTo then the LAST (working) day of the month is used. Thus, setting the latter to 31 will create an interval that is open every last day of a month, that may, for example, fall on the 28-th of February as well. The value 1000 can be used as a special value to indicate the last day. ) This value is optional.

        Parameters:
        newWeekFrom - the new value for WeekFrom.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setWeekTo

        void setWeekTo​(Long newWeekTo)
        Set the value for WeekTo. (The day or week number that is used together with WeekdayFrom and WeekdayTo constraints. See WeekdayFrom for extra details.) This value is optional.
        Parameters:
        newWeekTo - the new value for WeekTo.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • setDayShift

        void setDayShift​(Long newDayShift)
        Set the value for DayShift. (The number of days that the open period for the time window element must be shifted.) This value is optional.
        Parameters:
        newDayShift - the new value for DayShift.
        Throws:
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - This will be thrown if this method is called while the object is not attached to a session.
      • allStatusChanges

        List<Period> allStatusChanges​(DateTimeZone startTime,
                                      DateTimeZone endTime,
                                      TimeZone defaultTimeZone)
                               throws com.redwood.scheduler.api.exception.NoTimeZoneForTimeWindowCalculation
        All changes of the open-close status of this time window interval. Returns all status changes of the interval in the period AFTER startTime and BEFORE endTime.
        Parameters:
        startTime - starting time stamp
        endTime - ending time stamp
        defaultTimeZone - The TimeZone to use if the TimeWindowElement does not specify a TimeZone. The result will be in this time zone.
        Returns:
        Sorted list with status changes between (startTime, endTime) in the default time zone.
        Throws:
        com.redwood.scheduler.api.exception.NoTimeZoneForTimeWindowCalculation - No timezone could be found to calculate this TimeWindowElement. This means that the object that includes the TimeWindow should set the TimeZone to use for the calculation of the TimeWindow, or a TimeZone must be set on the TimeWindow or TimeWindowElement.
      • isOpen

        boolean isOpen​(DateTimeZone atTime,
                       TimeZone defaultTimeZone)
                throws com.redwood.scheduler.api.exception.NoTimeZoneForTimeWindowCalculation
        Returns status of this interval at atTime
        Parameters:
        atTime - as of what time stamp
        defaultTimeZone - The TimeZone to use if the TimeWindowElement does not specify a TimeZone
        Returns:
        Is open?
        Throws:
        com.redwood.scheduler.api.exception.NoTimeZoneForTimeWindowCalculation - No timezone could be found to calculate this TimeWindowElement. This means that the object that includes the TimeWindow should set the TimeZone to use for the calculation of the TimeWindow, or a TimeZone must be set on the TimeWindow or TimeWindowElement.
      • describe

        String describe()
        Human-readable description of the interval
        Returns:
        text
      • getDisabledDuringTimeWindow

        TimeWindow getDisabledDuringTimeWindow()
        Get the DisabledDuringTimeWindow.
        Returns:
        DisabledDuringTimeWindow
        Throws:
        com.redwood.scheduler.api.exception.ObjectDeletedException - If this method is called when the object has been marked for deletion.
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - If this method is called when the object has been removed from it's session.
      • getEnabledDuringTimeWindow

        TimeWindow getEnabledDuringTimeWindow()
        Get the EnabledDuringTimeWindow.
        Returns:
        EnabledDuringTimeWindow
        Throws:
        com.redwood.scheduler.api.exception.ObjectDeletedException - If this method is called when the object has been marked for deletion.
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - If this method is called when the object has been removed from it's session.
      • getPeriodFunction

        PeriodFunction getPeriodFunction()
        Get the PeriodFunction.
        Returns:
        PeriodFunction
        Throws:
        com.redwood.scheduler.api.exception.ObjectDeletedException - If this method is called when the object has been marked for deletion.
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - If this method is called when the object has been removed from it's session.
      • getTimeWindow

        TimeWindow getTimeWindow()
        Get the TimeWindow.
        Returns:
        TimeWindow
        Throws:
        com.redwood.scheduler.api.exception.ObjectDeletedException - If this method is called when the object has been marked for deletion.
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - If this method is called when the object has been removed from it's session.
      • getTimeZone

        TimeZone getTimeZone()
        Get the TimeZone.
        Returns:
        TimeZone
        Throws:
        com.redwood.scheduler.api.exception.ObjectDeletedException - If this method is called when the object has been marked for deletion.
        com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException - If this method is called when the object has been removed from it's session.
      • setDisabledDuringTimeWindow

        void setDisabledDuringTimeWindow​(TimeWindow newDisabledDuringTimeWindow)
        Set the value for DisabledDuringTimeWindow. This value is optional.
        Parameters:
        newDisabledDuringTimeWindow - is the object to set DisabledDuringTimeWindow to. A time window during which a time window interval is closed
      • setEnabledDuringTimeWindow

        void setEnabledDuringTimeWindow​(TimeWindow newEnabledDuringTimeWindow)
        Set the value for EnabledDuringTimeWindow. This value is optional.
        Parameters:
        newEnabledDuringTimeWindow - is the object to set EnabledDuringTimeWindow to. A time window during which a time window interval is open.
      • setPeriodFunction

        void setPeriodFunction​(PeriodFunction newPeriodFunction)
        Set the value for PeriodFunction. This value is optional.
        Parameters:
        newPeriodFunction - is the object to set PeriodFunction to. The period function defined for a time window interval
      • setTimeZone

        void setTimeZone​(TimeZone newTimeZone)
        Set the value for TimeZone. This value is optional.
        Parameters:
        newTimeZone - is the object to set TimeZone to. The timezone for the timewindowinterval