Package org.opencms.acacia.shared
Class A_CmsSerialDateValue
- java.lang.Object
-
- org.opencms.acacia.shared.A_CmsSerialDateValue
-
- All Implemented Interfaces:
I_CmsSerialDateValue
- Direct Known Subclasses:
CmsSerialDateValue
public class A_CmsSerialDateValue extends java.lang.Object implements I_CmsSerialDateValue
The base class for implementations of serial date values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opencms.acacia.shared.I_CmsSerialDateValue
I_CmsSerialDateValue.DateType, I_CmsSerialDateValue.EndType, I_CmsSerialDateValue.JsonKey, I_CmsSerialDateValue.Month, I_CmsSerialDateValue.PatternType, I_CmsSerialDateValue.WeekDay, I_CmsSerialDateValue.WeekOfMonth
-
-
Field Summary
-
Fields inherited from interface org.opencms.acacia.shared.I_CmsSerialDateValue
DAY_IN_MILLIS, NUM_OF_WEEKDAYS
-
-
Constructor Summary
Constructors Constructor Description A_CmsSerialDateValue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addException(java.util.Date date)
Add a date where the event should not take place, even if they are part of the series.void
addWeekOfMonth(I_CmsSerialDateValue.WeekOfMonth week)
Add a week of month.void
clearExceptions()
Clear the exceptions.void
clearIndividualDates()
Clear the individual dates.void
clearWeekDays()
Clear the week days.void
clearWeeksOfMonth()
Clear the weeks of month.boolean
endsAtMidNight()
Returns a flag, indicating if the event ends at midnight.boolean
equals(java.lang.Object o)
I_CmsSerialDateValue.DateType
getDateType()
Returns the type of the specified date.int
getDayOfMonth()
Returns the day of the month, the events should take place.java.util.Date
getEnd()
Returns the end time of the events.I_CmsSerialDateValue.EndType
getEndType()
Returns the end type of the event series.java.util.SortedSet<java.util.Date>
getExceptions()
Returns the dates, where the event should not take place.java.util.SortedSet<java.util.Date>
getIndividualDates()
Returns the dates of an individual date series.int
getInterval()
Returns the pattern type specific interval of the event.I_CmsSerialDateValue.Month
getMonth()
Returns the month in which the events take place.int
getOccurrences()
Returns the number of occurrences of the event.CmsUUID
getParentSeriesId()
Returns the uuid of the content that holds the series, the current event was extracted from.I_CmsSerialDateValue.PatternType
getPatternType()
Returns the pattern type of the event series.java.util.Date
getSeriesEndDate()
Returns the date of the last day, events of the series should take place.java.util.Date
getStart()
Returns the start time of the events.I_CmsSerialDateValue.WeekDay
getWeekDay()
Returns the week day where the event should take place.java.util.SortedSet<I_CmsSerialDateValue.WeekDay>
getWeekDays()
Returns the week days where the event should take place.I_CmsSerialDateValue.WeekOfMonth
getWeekOfMonth()
Returns the week of the month, the event should take place.java.util.SortedSet<I_CmsSerialDateValue.WeekOfMonth>
getWeeksOfMonth()
Returns the weeks of the month, the event should take place.boolean
hasExceptions()
Returns a flag, indicating if exceptions are present.int
hashCode()
boolean
isCurrentTillEnd()
Returns a flag, indicating if the events should be treated as "current" till they end (or only till they start).protected boolean
isDayOfMonthValid()
Checks, if a valid day of month is set.protected boolean
isDurationValid()
Checks if the duration option is valid.protected boolean
isEndValid()
Check, if the end date of the single event is valid, i.e., either not set or not before the start date.boolean
isEveryWorkingDay()
Returns a flag, indicating if the event should take place every working day.boolean
isFromOtherSeries()
Returns a flag, indicating if the event is extracted from another series.protected boolean
isIntervalValid()
Checks, if a valid interval is specified.protected boolean
isMonthSet()
Checks, if a month is specified.protected boolean
isPatternValid()
Checks, if all values necessary for a specific pattern are valid.protected boolean
isStartSet()
Check, if the start time stamp is set.boolean
isValid()
Returns a flag, indicating if the value specifies a valid date (series).protected boolean
isValidEndTypeForPattern()
Checks, if the end type is valid for the set pattern type.protected boolean
isWeekDaySet()
Checks if at least one weekday is specified.protected boolean
isWeekOfMonthSet()
Checks, if at least one week of month is set.boolean
isWholeDay()
Returns a flag, indicating if the event last the whole day/whole days.void
removeWeekOfMonth(I_CmsSerialDateValue.WeekOfMonth week)
Remove a week of month.void
setCurrentTillEnd(java.lang.Boolean isCurrentTillEnd)
Set the flag, indicating if the event is treated as "current" till the end.void
setDayOfMonth(int dayOfMonth)
Set the day of month.protected void
setDefaultValue()
Sets the value to a default.protected void
setDerivedEndType()
Set the end type as derived from other values.void
setEnd(java.util.Date date)
Set the end time for the event.void
setEndType(I_CmsSerialDateValue.EndType endType)
Set the end type of the series.void
setEveryWorkingDay(java.lang.Boolean isEveryWorkingDay)
Set the flag, indicating if the event should take place every working day.void
setExceptions(java.util.SortedSet<java.util.Date> dates)
Set dates where the event should not take place, even if they are part of the series.void
setIndividualDates(java.util.SortedSet<java.util.Date> dates)
Set the individual dates where the event should take place.void
setInterval(int interval)
Set the pattern type specific interval between two events, e.g., number of days, weeks, month, years.void
setMonth(I_CmsSerialDateValue.Month month)
Set the month in which the event should take place.void
setOccurrences(int occurrences)
Set the number of occurrences of the event.void
setParentSeriesId(CmsUUID structureId)
Set the series, the current event (series) is extracted from.void
setPatternType(I_CmsSerialDateValue.PatternType type)
Set the pattern type of the event series.void
setSeriesEndDate(java.util.Date date)
Set the last day events of the series should occur.void
setStart(java.util.Date date)
Set the start time of the events.void
setWeekDay(I_CmsSerialDateValue.WeekDay weekDay)
Set the week day the events should occur.void
setWeekDays(java.util.SortedSet<I_CmsSerialDateValue.WeekDay> weekDays)
Set the week days the events should occur.void
setWeekOfMonth(I_CmsSerialDateValue.WeekOfMonth weekOfMonth)
Set the week of the month the events should occur.void
setWeeksOfMonth(java.util.SortedSet<I_CmsSerialDateValue.WeekOfMonth> weeksOfMonth)
Set the weeks of the month the events should occur.void
setWholeDay(java.lang.Boolean isWholeDay)
Set the flag, indicating if the event last the whole day/whole days.
-
-
-
Constructor Detail
-
A_CmsSerialDateValue
public A_CmsSerialDateValue()
-
-
Method Detail
-
addException
public void addException(java.util.Date date)
Add a date where the event should not take place, even if they are part of the series.- Parameters:
date
- the date to add as exception.
-
addWeekOfMonth
public final void addWeekOfMonth(I_CmsSerialDateValue.WeekOfMonth week)
Add a week of month.- Parameters:
week
- the week to add.
-
clearExceptions
public final void clearExceptions()
Clear the exceptions.
-
clearIndividualDates
public final void clearIndividualDates()
Clear the individual dates.
-
clearWeekDays
public final void clearWeekDays()
Clear the week days.
-
clearWeeksOfMonth
public final void clearWeeksOfMonth()
Clear the weeks of month.
-
endsAtMidNight
public boolean endsAtMidNight()
Description copied from interface:I_CmsSerialDateValue
Returns a flag, indicating if the event ends at midnight.- Specified by:
endsAtMidNight
in interfaceI_CmsSerialDateValue
- Returns:
- a flag, indicating if the event ends at midnight.
- See Also:
I_CmsSerialDateValue.endsAtMidNight()
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getDateType
public I_CmsSerialDateValue.DateType getDateType()
Description copied from interface:I_CmsSerialDateValue
Returns the type of the specified date.- Specified by:
getDateType
in interfaceI_CmsSerialDateValue
- Returns:
- the type of the specified date.
- See Also:
I_CmsSerialDateValue.getDateType()
-
getDayOfMonth
public final int getDayOfMonth()
Description copied from interface:I_CmsSerialDateValue
Returns the day of the month, the events should take place.- Specified by:
getDayOfMonth
in interfaceI_CmsSerialDateValue
- Returns:
- the day of the month, the events should take place.
- See Also:
I_CmsSerialDateValue.getDayOfMonth()
-
getEnd
public final java.util.Date getEnd()
Description copied from interface:I_CmsSerialDateValue
Returns the end time of the events.- Specified by:
getEnd
in interfaceI_CmsSerialDateValue
- Returns:
- the end time of the events.
- See Also:
I_CmsSerialDateValue.getEnd()
-
getEndType
public final I_CmsSerialDateValue.EndType getEndType()
Description copied from interface:I_CmsSerialDateValue
Returns the end type of the event series.- Specified by:
getEndType
in interfaceI_CmsSerialDateValue
- Returns:
- the end type of the event series.
- See Also:
I_CmsSerialDateValue.getEndType()
-
getExceptions
public final java.util.SortedSet<java.util.Date> getExceptions()
Description copied from interface:I_CmsSerialDateValue
Returns the dates, where the event should not take place.- Specified by:
getExceptions
in interfaceI_CmsSerialDateValue
- Returns:
- the dates, where the event should not take place.
- See Also:
I_CmsSerialDateValue.getExceptions()
-
getIndividualDates
public final java.util.SortedSet<java.util.Date> getIndividualDates()
Description copied from interface:I_CmsSerialDateValue
Returns the dates of an individual date series.- Specified by:
getIndividualDates
in interfaceI_CmsSerialDateValue
- Returns:
- the dates of an individual date series.
- See Also:
I_CmsSerialDateValue.getIndividualDates()
-
getInterval
public final int getInterval()
Description copied from interface:I_CmsSerialDateValue
Returns the pattern type specific interval of the event.- Specified by:
getInterval
in interfaceI_CmsSerialDateValue
- Returns:
- the pattern type specific interval of the event.
- See Also:
I_CmsSerialDateValue.getInterval()
-
getMonth
public final I_CmsSerialDateValue.Month getMonth()
Description copied from interface:I_CmsSerialDateValue
Returns the month in which the events take place.- Specified by:
getMonth
in interfaceI_CmsSerialDateValue
- Returns:
- the month in which the events take place.
- See Also:
I_CmsSerialDateValue.getMonth()
-
getOccurrences
public final int getOccurrences()
Description copied from interface:I_CmsSerialDateValue
Returns the number of occurrences of the event.- Specified by:
getOccurrences
in interfaceI_CmsSerialDateValue
- Returns:
- the number of occurrences of the event.
- See Also:
I_CmsSerialDateValue.getOccurrences()
-
getParentSeriesId
public CmsUUID getParentSeriesId()
Description copied from interface:I_CmsSerialDateValue
Returns the uuid of the content that holds the series, the current event was extracted from. Ornull
if the current event series was not extracted from another one.- Specified by:
getParentSeriesId
in interfaceI_CmsSerialDateValue
- Returns:
- the uuid of the original series' content,
or
null
, if the event is not extracted from another event series.
- See Also:
I_CmsSerialDateValue.getParentSeriesId()
-
getPatternType
public final I_CmsSerialDateValue.PatternType getPatternType()
Description copied from interface:I_CmsSerialDateValue
Returns the pattern type of the event series.- Specified by:
getPatternType
in interfaceI_CmsSerialDateValue
- Returns:
- the pattern type of the event series.
- See Also:
I_CmsSerialDateValue.getPatternType()
-
getSeriesEndDate
public final java.util.Date getSeriesEndDate()
Description copied from interface:I_CmsSerialDateValue
Returns the date of the last day, events of the series should take place.- Specified by:
getSeriesEndDate
in interfaceI_CmsSerialDateValue
- Returns:
- the date of the last day, events of the series should take place.
- See Also:
I_CmsSerialDateValue.getSeriesEndDate()
-
getStart
public final java.util.Date getStart()
Description copied from interface:I_CmsSerialDateValue
Returns the start time of the events.- Specified by:
getStart
in interfaceI_CmsSerialDateValue
- Returns:
- the start time of the events.
- See Also:
I_CmsSerialDateValue.getStart()
-
getWeekDay
public final I_CmsSerialDateValue.WeekDay getWeekDay()
Description copied from interface:I_CmsSerialDateValue
Returns the week day where the event should take place.- Specified by:
getWeekDay
in interfaceI_CmsSerialDateValue
- Returns:
- the week day where the event should take place.
- See Also:
I_CmsSerialDateValue.getWeekDay()
-
getWeekDays
public final java.util.SortedSet<I_CmsSerialDateValue.WeekDay> getWeekDays()
Description copied from interface:I_CmsSerialDateValue
Returns the week days where the event should take place.- Specified by:
getWeekDays
in interfaceI_CmsSerialDateValue
- Returns:
- the week days where the event should take place.
- See Also:
I_CmsSerialDateValue.getWeekDays()
-
getWeekOfMonth
public final I_CmsSerialDateValue.WeekOfMonth getWeekOfMonth()
Description copied from interface:I_CmsSerialDateValue
Returns the week of the month, the event should take place.- Specified by:
getWeekOfMonth
in interfaceI_CmsSerialDateValue
- Returns:
- the week of the month, the event should take place.
- See Also:
I_CmsSerialDateValue.getWeekOfMonth()
-
getWeeksOfMonth
public final java.util.SortedSet<I_CmsSerialDateValue.WeekOfMonth> getWeeksOfMonth()
Description copied from interface:I_CmsSerialDateValue
Returns the weeks of the month, the event should take place.- Specified by:
getWeeksOfMonth
in interfaceI_CmsSerialDateValue
- Returns:
- the weeks of the month, the event should take place.
- See Also:
I_CmsSerialDateValue.getWeeksOfMonth()
-
hasExceptions
public final boolean hasExceptions()
Returns a flag, indicating if exceptions are present.- Returns:
- a flag, indicating if exceptions are present.
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
isCurrentTillEnd
public boolean isCurrentTillEnd()
Description copied from interface:I_CmsSerialDateValue
Returns a flag, indicating if the events should be treated as "current" till they end (or only till they start).- Specified by:
isCurrentTillEnd
in interfaceI_CmsSerialDateValue
- Returns:
true
if the event is "current" till it ends,false
if it is current till it starts.- See Also:
I_CmsSerialDateValue.isCurrentTillEnd()
-
isEveryWorkingDay
public final boolean isEveryWorkingDay()
Description copied from interface:I_CmsSerialDateValue
Returns a flag, indicating if the event should take place every working day.- Specified by:
isEveryWorkingDay
in interfaceI_CmsSerialDateValue
- Returns:
- a flag, indicating if the event should take place every working day.
- See Also:
I_CmsSerialDateValue.isEveryWorkingDay()
-
isFromOtherSeries
public boolean isFromOtherSeries()
Description copied from interface:I_CmsSerialDateValue
Returns a flag, indicating if the event is extracted from another series.- Specified by:
isFromOtherSeries
in interfaceI_CmsSerialDateValue
- Returns:
- a flag, indicating if the event is extracted from another series.
- See Also:
I_CmsSerialDateValue.isFromOtherSeries()
-
isValid
public final boolean isValid()
Description copied from interface:I_CmsSerialDateValue
Returns a flag, indicating if the value specifies a valid date (series).- Specified by:
isValid
in interfaceI_CmsSerialDateValue
- Returns:
- a flag, indicating if the value specifies a valid date (series).
- See Also:
I_CmsSerialDateValue.isValid()
-
isWholeDay
public final boolean isWholeDay()
Description copied from interface:I_CmsSerialDateValue
Returns a flag, indicating if the event last the whole day/whole days.- Specified by:
isWholeDay
in interfaceI_CmsSerialDateValue
- Returns:
- a flag, indicating if the event last the whole day/whole days.
- See Also:
I_CmsSerialDateValue.isWholeDay()
-
removeWeekOfMonth
public final void removeWeekOfMonth(I_CmsSerialDateValue.WeekOfMonth week)
Remove a week of month.- Parameters:
week
- the week to remove.
-
setCurrentTillEnd
public final void setCurrentTillEnd(java.lang.Boolean isCurrentTillEnd)
Set the flag, indicating if the event is treated as "current" till the end.- Parameters:
isCurrentTillEnd
- the flag, indicating if the event is treated as "current" till the end.
-
setDayOfMonth
public final void setDayOfMonth(int dayOfMonth)
Set the day of month.- Parameters:
dayOfMonth
- the day of month to set.
-
setEnd
public final void setEnd(java.util.Date date)
Set the end time for the event.- Parameters:
date
- the end time to set.
-
setEndType
public final void setEndType(I_CmsSerialDateValue.EndType endType)
Set the end type of the series.- Parameters:
endType
- the end type to set.
-
setEveryWorkingDay
public final void setEveryWorkingDay(java.lang.Boolean isEveryWorkingDay)
Set the flag, indicating if the event should take place every working day.- Parameters:
isEveryWorkingDay
- the flag, indicating if the event should take place every working day.
-
setExceptions
public final void setExceptions(java.util.SortedSet<java.util.Date> dates)
Set dates where the event should not take place, even if they are part of the series.- Parameters:
dates
- dates to set.
-
setIndividualDates
public final void setIndividualDates(java.util.SortedSet<java.util.Date> dates)
Set the individual dates where the event should take place.- Parameters:
dates
- the dates to set.
-
setInterval
public final void setInterval(int interval)
Set the pattern type specific interval between two events, e.g., number of days, weeks, month, years.- Parameters:
interval
- the interval to set.
-
setMonth
public final void setMonth(I_CmsSerialDateValue.Month month)
Set the month in which the event should take place.- Parameters:
month
- the month to set.
-
setOccurrences
public final void setOccurrences(int occurrences)
Set the number of occurrences of the event.- Parameters:
occurrences
- the number of occurrences to set.
-
setParentSeriesId
public final void setParentSeriesId(CmsUUID structureId)
Set the series, the current event (series) is extracted from.- Parameters:
structureId
- the structure id of the series content, the event is extracted from.
-
setPatternType
public final void setPatternType(I_CmsSerialDateValue.PatternType type)
Set the pattern type of the event series.All pattern specific values are reset.
- Parameters:
type
- the pattern type to set.
-
setSeriesEndDate
public final void setSeriesEndDate(java.util.Date date)
Set the last day events of the series should occur.- Parameters:
date
- the day to set.
-
setStart
public final void setStart(java.util.Date date)
Set the start time of the events. Unless you specify a single event, the day information is discarded.- Parameters:
date
- the time to set.
-
setWeekDay
public final void setWeekDay(I_CmsSerialDateValue.WeekDay weekDay)
Set the week day the events should occur.- Parameters:
weekDay
- the week day to set.
-
setWeekDays
public final void setWeekDays(java.util.SortedSet<I_CmsSerialDateValue.WeekDay> weekDays)
Set the week days the events should occur.- Parameters:
weekDays
- the week days to set.
-
setWeekOfMonth
public final void setWeekOfMonth(I_CmsSerialDateValue.WeekOfMonth weekOfMonth)
Set the week of the month the events should occur.- Parameters:
weekOfMonth
- the week of month to set (first to fifth, where fifth means last).
-
setWeeksOfMonth
public final void setWeeksOfMonth(java.util.SortedSet<I_CmsSerialDateValue.WeekOfMonth> weeksOfMonth)
Set the weeks of the month the events should occur.- Parameters:
weeksOfMonth
- the weeks of month to set (first to fifth, where fifth means last).
-
setWholeDay
public final void setWholeDay(java.lang.Boolean isWholeDay)
Set the flag, indicating if the event last the whole day/whole days.- Parameters:
isWholeDay
- the flag to set
-
isDayOfMonthValid
protected final boolean isDayOfMonthValid()
Checks, if a valid day of month is set.- Returns:
- a flag, indicating if the set day of month is valid.
-
isDurationValid
protected final boolean isDurationValid()
Checks if the duration option is valid. NOTE: This does NOT check, if too many events are specified.- Returns:
- a flag, indicating if the duration option is valid.
-
isEndValid
protected final boolean isEndValid()
Check, if the end date of the single event is valid, i.e., either not set or not before the start date.- Returns:
- a flag, indicating if the end date is set.
-
isIntervalValid
protected final boolean isIntervalValid()
Checks, if a valid interval is specified.- Returns:
- a flag, indicating if the specified interval is valid.
-
isMonthSet
protected final boolean isMonthSet()
Checks, if a month is specified.- Returns:
- flag, indicating if a month is specified.
-
isPatternValid
protected final boolean isPatternValid()
Checks, if all values necessary for a specific pattern are valid.- Returns:
- a flag, indicating if all values required for the pattern are valid.
-
isStartSet
protected final boolean isStartSet()
Check, if the start time stamp is set.- Returns:
- a flag, indicating if a start date is set.
-
isValidEndTypeForPattern
protected final boolean isValidEndTypeForPattern()
Checks, if the end type is valid for the set pattern type.- Returns:
- a flag, indicating if the end type is valid for the pattern type.
-
isWeekDaySet
protected final boolean isWeekDaySet()
Checks if at least one weekday is specified.- Returns:
- a flag, indicating if at least one weekday is specified.
-
isWeekOfMonthSet
protected final boolean isWeekOfMonthSet()
Checks, if at least one week of month is set.- Returns:
- a flag, indicating if at least one week of month is set.
-
setDefaultValue
protected final void setDefaultValue()
Sets the value to a default.
-
setDerivedEndType
protected final void setDerivedEndType()
Set the end type as derived from other values.
-
-