Class Schedule

java.lang.Object
COM.TIBCO.hawk.config.rbengine.schedule.Schedule
All Implemented Interfaces:
Cloneable

public class Schedule extends Object implements Cloneable
A Schedule is configuration object that can be used to determine if a rulebase or part of the rulebase should be in-schedule or out-of-schedule at a given time. A Schedule can be specified in any rulebase element such as Rulebase, Rule, Test, or an Action. When an element of the rulebase is out-of-schedule, that element and all its nodes are out-of-schedule. For example, if a Test is out-of-schedule, then the Test and all its actions are out-of-schedule. When a rulebase element is out-of-schedule, the rulebase element is suspended and will not be be active until the element is back in-schedule.

A Schedule has a name, a list of inclusion periods and a list of exclusion periods. A Schedule is in-schedule if at least one of its inclusion periods is in-schedule and none of its exclusion periods are in-schedule. If a Schedule does not have any inclusion period, then it is in-schedule if none of its exclusion periods are in-schedule. If a Schedule does not have any inclusion period or exclusion period, then it is out-of-schedule.

The inclusion periods and exclusion periods may contain Period or PeriodGroupReference objects.

See Also:
  • Constructor Details

    • Schedule

      public Schedule(String name)
      Creates a schedule with the specified name. The new Schedule does not has any inclusion or exclusion period.

      Parameters:
      name - the schedule name
    • Schedule

      public Schedule(String name, Scheduleable[] inclusionPeriods, Scheduleable[] exclusionPeriods)
      Deprecated.
      Creates a schedule with the specified name, inclusion periods, and exclusion periods.

      Parameters:
      name - the schedule name
      inclusionPeriods - a list of inclusion Period or PeriodGroupReference
      exclusionPeriods - a list of exclusion Period or PeriodGroupReference
      Throws:
      IllegalArgumentException - if name, inclusionPeriods or inclusionPeriods is null
    • Schedule

      public Schedule(String name, Vector inclusionPeriods, Vector exclusionPeriods)
      Deprecated.
      Creates a schedule with the specified name, inclusion periods, and exclusion periods.

      Parameters:
      name - the schedule name
      inclusionPeriods - a list of inclusion Period or PeriodGroupReference
      exclusionPeriods - a list of exclusion Period or PeriodGroupReference
      Throws:
      IllegalArgumentException - if name, inclusionPeriods or inclusionPeriods is null
  • Method Details

    • inSchedule

      public boolean inSchedule(Date date)
      Checks to see if the schedule is in-schedule using the specified date.

      Parameters:
      date - date to be checked.
      Returns:
      true if date is in-schedule.
    • getSecondTillNextScheduleChange

      public long getSecondTillNextScheduleChange()
      Returns seconds until next schedule change. If the next schedule is after mid night (12:00 am), then seconds till mid night is returned.
      Returns:
      seconds until next schedule change.
    • setName

      public void setName(String name)
      Sets the name of the Schedule.

      Throws:
      IllegalArgumentException - if name is null
    • getName

      public String getName()
      Returns the name of the schedule.
    • setTimeZone

      public void setTimeZone(String timeZone)
      Sets the timezone of the Schedule.

      Note: In 4.7, timezone can be set to null. If timezone is null, local timezone is used for the schedule.

    • getTimeZone

      public String getTimeZone()
      Returns the TimeZone for this schedule.
    • setInclusionPeriods

      public void setInclusionPeriods(Vector periods)
      Deprecated.
      Replaces current inclusion periods in this Schedule with the given list.
    • getInclusionPeriods

      public Scheduleable[] getInclusionPeriods()
      Returns all inclusion periods in this Schedule.
    • getInclusionPeriodsAsVector

      public Vector getInclusionPeriodsAsVector()
      Deprecated.
      Returns a list of inclusion periods.

    • setExclusionPeriods

      public void setExclusionPeriods(Vector periods)
      Deprecated.
      Replaces current inclusion periods in this Schedule with the given list.
    • getExclusionPeriods

      public Scheduleable[] getExclusionPeriods()
      Returns all exclusion periods in this Schedule.
    • getExclusionPeriodsAsVector

      public Vector getExclusionPeriodsAsVector()
      Deprecated.
      Returns a list of exclusion periods.

    • addInclusionPeriod

      public void addInclusionPeriod(Scheduleable period)
      Adds an inclusion periods to existing a list of inclusion periods.
      Parameters:
      period - Period or PeriodGroupReference to be added.
      Throws:
      IllegalArgumentException - if period is null
    • addExclusionPeriod

      public void addExclusionPeriod(Scheduleable period)
      Adds an period to existing a list of exclusion periods.
      Parameters:
      period - Period or PeriodGroupReference to be added.
      Throws:
      IllegalArgumentException - if period is null
    • removeInclusionPeriod

      public void removeInclusionPeriod(Scheduleable period)
      Removes an period from existing a list of inclusion periods.
    • removeExclusionPeriod

      public void removeExclusionPeriod(Scheduleable period)
      Removes an period from existing a list of exclusion periods.
    • isUsingPeriodGroup

      public boolean isUsingPeriodGroup(String periodGroupName)
      Checks if the specified PeriodGroup is used by this schedules.

      Returns:
      true if this Schedule use the given PeriodGroup.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a copy of this Schedule.
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • equals

      public boolean equals(Object o)
      Compares with the specified schedule for equality. Note that two Schedule objects with identical inclusion and exclusion periods but with different comments and last modification string are consider equals.

      Overrides:
      equals in class Object
      Parameters:
      o - the Schedule to be compared.
      Returns:
      true if the Schedule objects are equal.
    • toString

      public String toString()
      Returns a string representation of the Schedule object.

      Overrides:
      toString in class Object