Class A_CmsSerialDateBean

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.SortedSet<java.util.Date> m_allDates
      Variable for caching the dates of the event after lazy calculation.
      protected java.util.SortedSet<java.util.Date> m_dates
      Variable for caching the dates of the event after lazy calculation.
      protected java.util.SortedSet<java.lang.Long> m_datesInMillis
      Variable for caching the dates as long.
      protected java.util.Calendar m_endDate
      The end date and time of the (potentially) first event of the series.
      protected long m_endMillis
      The exact time the event should occur latest (in milliseconds).
      protected I_CmsSerialDateValue.EndType m_endType
      The end type of the series.
      protected java.util.SortedSet<java.util.Date> m_exceptions
      The list of exceptions.
      protected int m_occurrences
      The maximal number of occurrences of the event.
      protected java.util.Calendar m_serialEndDate
      The date of the last day, the event should occur.
      protected java.util.Calendar m_startDate
      The start date and time of the (potentially) first event of the series.
      static int MAX_OCCURRENCES
      The maximal number of occurrences that is allowed.
    • Constructor Summary

      Constructors 
      Constructor Description
      A_CmsSerialDateBean​(java.util.Date startDate, java.util.Date endDate, boolean isWholeDay, I_CmsSerialDateValue.EndType endType, java.util.Date serialEndDate, int occurrences, java.util.SortedSet<java.util.Date> exceptions)
      Constructor for the abstract class for serial date beans.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.SortedSet<java.util.Date> getDates()
      Returns all dates of the whole series as Date objects, sorted ascendingly.
      java.util.SortedSet<java.lang.Long> getDatesAsLong()
      Returns all dates of the whole series in milliseconds, sorted ascendingly.
      java.lang.Long getEventDuration()
      Returns the duration of a single event in milliseconds, or null if no end date is specified.
      java.util.SortedSet<java.util.Date> getExceptions()
      Returns all exceptions from the series, sorted ascendingly.
      protected abstract java.util.Calendar getFirstDate()
      Generates the first date of the series.
      int getOccurrences()
      Returns the occurrences of a defined series interval, used for the series end type.
      java.util.Calendar getSerialEndDate()
      Returns the serial end date if the series is of type: ending at specific date.
      I_CmsSerialDateValue.EndType getSerialEndType()
      Returns the end type of the date series (never, n times, specific date).
      java.util.Calendar getStartDate()
      Returns the date provided as the earliest date the event should take place.
      boolean hasTooManyDates()
      Returns a flag, indicating if the series has more dates than allowed.
      protected abstract boolean isAnyDatePossible()
      Check, if the series can have at least one event/date.
      protected boolean showMoreEntries​(java.util.Calendar nextDate, int previousOccurrences)
      Check if the provided date or any date after it are part of the series.
      protected abstract void toNextDate​(java.util.Calendar date)
      Starting with a date that's in the series, the next date is created.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_startDate

        protected java.util.Calendar m_startDate
        The start date and time of the (potentially) first event of the series.
      • m_endDate

        protected java.util.Calendar m_endDate
        The end date and time of the (potentially) first event of the series.
      • m_occurrences

        protected int m_occurrences
        The maximal number of occurrences of the event.
      • m_serialEndDate

        protected java.util.Calendar m_serialEndDate
        The date of the last day, the event should occur.
      • m_endMillis

        protected long m_endMillis
        The exact time the event should occur latest (in milliseconds).
      • m_dates

        protected java.util.SortedSet<java.util.Date> m_dates
        Variable for caching the dates of the event after lazy calculation.
      • m_allDates

        protected java.util.SortedSet<java.util.Date> m_allDates
        Variable for caching the dates of the event after lazy calculation.
      • m_datesInMillis

        protected java.util.SortedSet<java.lang.Long> m_datesInMillis
        Variable for caching the dates as long.
      • m_exceptions

        protected final java.util.SortedSet<java.util.Date> m_exceptions
        The list of exceptions.
    • Constructor Detail

      • A_CmsSerialDateBean

        public A_CmsSerialDateBean​(java.util.Date startDate,
                                   java.util.Date endDate,
                                   boolean isWholeDay,
                                   I_CmsSerialDateValue.EndType endType,
                                   java.util.Date serialEndDate,
                                   int occurrences,
                                   java.util.SortedSet<java.util.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 Detail

      • 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

        public java.util.Calendar 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
      • getStartDate

        public java.util.Calendar 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.
      • getFirstDate

        protected abstract java.util.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​(java.util.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​(java.util.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.