Package org.opencms.widgets.serialdate
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
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 Summary
FieldsModifier and TypeFieldDescriptionVariable for caching the dates of the event after lazy calculation.Variable for caching the dates of the event after lazy calculation.Variable for caching the dates as long.protected CalendarThe end date and time of the (potentially) first event of the series.protected longThe exact time the event should occur latest (in milliseconds).protected I_CmsSerialDateValue.EndTypeThe end type of the series.The list of exceptions.protected intThe maximal number of occurrences of the event.protected CalendarThe date of the last day, the event should occur.protected CalendarThe start date and time of the (potentially) first event of the series.static final intThe maximal number of occurrences that is allowed. -
Constructor Summary
ConstructorsConstructorDescriptionA_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. -
Method Summary
Modifier and TypeMethodDescriptiongetDates()Returns all dates of the whole series asDateobjects, sorted ascendingly.Returns all dates of the whole series in milliseconds, sorted ascendingly.Returns the duration of a single event in milliseconds, ornullif no end date is specified.Returns all exceptions from the series, sorted ascendingly.protected abstract CalendarGenerates the first date of the series.intReturns the occurrences of a defined series interval, used for the series end type.Returns the serial end date if the series is of type: ending at specific date.Returns the end type of the date series (never, n times, specific date).Returns the date provided as the earliest date the event should take place.booleanReturns a flag, indicating if the series has more dates than allowed.protected abstract booleanCheck, if the series can have at least one event/date.protected booleanshowMoreEntries(Calendar nextDate, int previousOccurrences) Check if the provided date or any date after it are part of the series.protected abstract voidtoNextDate(Calendar date) Starting with a date that's in the series, the next date is created.
-
Field Details
-
MAX_OCCURRENCES
The maximal number of occurrences that is allowed.- See Also:
-
m_startDate
The start date and time of the (potentially) first event of the series. -
m_endDate
The end date and time of the (potentially) first event of the series. -
m_occurrences
The maximal number of occurrences of the event. -
m_serialEndDate
The date of the last day, the event should occur. -
m_endMillis
The exact time the event should occur latest (in milliseconds). -
m_endType
The end type of the series. -
m_dates
Variable for caching the dates of the event after lazy calculation. -
m_allDates
Variable for caching the dates of the event after lazy calculation. -
m_datesInMillis
Variable for caching the dates as long. -
m_exceptions
The list of exceptions.
-
-
Constructor Details
-
Method Details
-
getDates
Description copied from interface:I_CmsSerialDateBeanReturns all dates of the whole series asDateobjects, sorted ascendingly.- Specified by:
getDatesin interfaceI_CmsSerialDateBean- Returns:
- all dates of the whole series as
Dateobjects, sorted ascendingly. - See Also:
-
getDatesAsLong
Description copied from interface:I_CmsSerialDateBeanReturns all dates of the whole series in milliseconds, sorted ascendingly.- Specified by:
getDatesAsLongin interfaceI_CmsSerialDateBean- Returns:
- all dates of the whole series in milliseconds, sorted ascendingly.
- See Also:
-
getEventDuration
Description copied from interface:I_CmsSerialDateBeanReturns the duration of a single event in milliseconds, ornullif no end date is specified.- Specified by:
getEventDurationin interfaceI_CmsSerialDateBean- Returns:
- the duration of a single event in milliseconds, or
nullif no end date is specified. - See Also:
-
getExceptions
Description copied from interface:I_CmsSerialDateBeanReturns all exceptions from the series, sorted ascendingly.- Specified by:
getExceptionsin interfaceI_CmsSerialDateBean- Returns:
- all exceptions from the series, sorted ascendingly.
- See Also:
-
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
Description copied from interface:I_CmsSerialDateBeanReturns a flag, indicating if the series has more dates than allowed.- Specified by:
hasTooManyDatesin interfaceI_CmsSerialDateBean- Returns:
- a flag, indicating if the series has more dates than allowed.
- See Also:
-
getFirstDate
Generates the first date of the series.- Returns:
- the first date of the series.
-
isAnyDatePossible
Check, if the series can have at least one event/date.- Returns:
trueif the series can be non-empty,falseotherwise.
-
showMoreEntries
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:
trueif more dates (including the provided one) could be in the series,falseotherwise.
-
toNextDate
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.
-