Class A_CmsSerialDateBean

java.lang.Object
org.opencms.widgets.serialdate.A_CmsSerialDateBean
All Implemented Interfaces:
I_CmsSerialDateBean
Direct Known Subclasses:
CmsSerialDateBeanDaily, CmsSerialDateBeanIndividual, CmsSerialDateBeanMonthly, CmsSerialDateBeanMonthlyWeeks, CmsSerialDateBeanSingle, CmsSerialDateBeanWeekly, CmsSerialDateBeanWorkingDays, CmsSerialDateBeanYearly, CmsSerialDateBeanYearlyWeekday

public abstract class A_CmsSerialDateBean extends Object implements I_CmsSerialDateBean
Abstract base class for serial date beans. It deals with information common for all serial dates and already provides part of the implementation for calculating all dates of the series.
  • Field Details

  • Constructor Details

    • A_CmsSerialDateBean

      public A_CmsSerialDateBean(Date startDate, Date endDate, boolean isWholeDay, I_CmsSerialDateValue.EndType endType, Date serialEndDate, int occurrences, SortedSet<Date> exceptions)
      Constructor for the abstract class for serial date beans. It takes all the arguments that are common for serial dates and should be called from each sub-class.
      Parameters:
      startDate - the start date of the series as provided by the serial date widget.
      endDate - the end date of the series as provided by the serial date widget.
      isWholeDay - flag, indicating if the event lasts the whole day.
      endType - the end type of the series as provided by the serial date widget.
      serialEndDate - the end date of the series as provided by the serial date widget.
      occurrences - the maximal number of occurrences of the event as provided by the serial date widget. If endType is DATE, this parameter is ignored.
      exceptions - the dates not part of the list.
  • Method Details

    • getDates

      public SortedSet<Date> getDates()
      Description copied from interface: I_CmsSerialDateBean
      Returns all dates of the whole series as Date objects, sorted ascendingly.
      Specified by:
      getDates in interface I_CmsSerialDateBean
      Returns:
      all dates of the whole series as Date objects, sorted ascendingly.
      See Also:
    • getDatesAsLong

      Description copied from interface: I_CmsSerialDateBean
      Returns all dates of the whole series in milliseconds, sorted ascendingly.
      Specified by:
      getDatesAsLong in interface I_CmsSerialDateBean
      Returns:
      all dates of the whole series in milliseconds, sorted ascendingly.
      See Also:
    • getEventDuration

      Description copied from interface: I_CmsSerialDateBean
      Returns the duration of a single event in milliseconds, or null if no end date is specified.
      Specified by:
      getEventDuration in interface I_CmsSerialDateBean
      Returns:
      the duration of a single event in milliseconds, or null if no end date is specified.
      See Also:
    • getExceptions

      Description copied from interface: I_CmsSerialDateBean
      Returns all exceptions from the series, sorted ascendingly.
      Specified by:
      getExceptions in interface I_CmsSerialDateBean
      Returns:
      all exceptions from the series, sorted ascendingly.
      See Also:
    • getOccurrences

      public int getOccurrences()
      Returns the occurrences of a defined series interval, used for the series end type.

      Returns:
      the occurrences of a defined series interval, used for the series end type
    • getSerialEndDate

      Returns the serial end date if the series is of type: ending at specific date.

      Returns:
      the serial end date if the series is of type: ending at specific date
    • getSerialEndType

      Returns the end type of the date series (never, n times, specific date).

      Returns:
      the end type of the date series
    • getStartDate

      Returns the date provided as the earliest date the event should take place. The time is set to the starting time of the event.
      Returns:
      date where the event should take place earliest with time set to the date's starting time.
    • hasTooManyDates

      public boolean hasTooManyDates()
      Description copied from interface: I_CmsSerialDateBean
      Returns a flag, indicating if the series has more dates than allowed.
      Specified by:
      hasTooManyDates in interface I_CmsSerialDateBean
      Returns:
      a flag, indicating if the series has more dates than allowed.
      See Also:
    • getFirstDate

      protected abstract Calendar getFirstDate()
      Generates the first date of the series.
      Returns:
      the first date of the series.
    • isAnyDatePossible

      protected abstract boolean isAnyDatePossible()
      Check, if the series can have at least one event/date.
      Returns:
      true if the series can be non-empty, false otherwise.
    • showMoreEntries

      protected boolean showMoreEntries(Calendar nextDate, int previousOccurrences)
      Check if the provided date or any date after it are part of the series.
      Parameters:
      nextDate - the current date to check.
      previousOccurrences - the number of events of the series that took place before the date to check.
      Returns:
      true if more dates (including the provided one) could be in the series, false otherwise.
    • toNextDate

      protected abstract void toNextDate(Calendar date)
      Starting with a date that's in the series, the next date is created.
      Parameters:
      date - the current event date for a event in the series, which is adjusted to the next date potentially in the series.