com.stratelia.webactiv.almanach.model
Class EventOccurrence

java.lang.Object
  extended by com.stratelia.webactiv.almanach.model.EventOccurrence
All Implemented Interfaces:
Comparable<EventOccurrence>
Direct Known Subclasses:
DisplayableEventOccurrence

public class EventOccurrence
extends Object
implements Comparable<EventOccurrence>

An occurrence of an event in the time. Periodic events are made up of several of occurrences in the time up to their end date. The occurrences can be compared among them by the start date.


Constructor Summary
protected EventOccurrence(EventDetail event, com.silverpeas.calendar.Datable<?> startDate, com.silverpeas.calendar.Datable<?> endDate)
          Constructs a new occurrence of the specified event.
 
Method Summary
static EventOccurrence anOccurrenceOf(EventDetail event, com.silverpeas.calendar.Datable<?> startDate, com.silverpeas.calendar.Datable<?> endDate)
          Creates an occurrence of the specified event starting and ending at the specified date and optionally times.
static EventOccurrence anOccurrenceOf(EventDetail event, com.silverpeas.calendar.Date startDate, com.silverpeas.calendar.Date endDate)
          Creates an occurrence of the specified event starting and ending at the specified dates.
 int compareTo(EventOccurrence otherOccurrence)
           
static com.silverpeas.calendar.Datable<?> endingAt(com.silverpeas.calendar.Datable<?> endingDate)
          Convenient method to improve the readability when calling the anOccurrenceOf method.
 com.silverpeas.calendar.Datable<?> getEndDate()
          Gets the end date of this occurrence.
 String getEndDateTimeInISO()
          Gets the end date and time of this event in the ISO 8601 format (with minute precision).
 EventDetail getEventDetail()
          Gets the details about the event this occurrence belongs to.
 com.silverpeas.calendar.Datable<?> getStartDate()
          Gets the start date of this occurrence.
 String getStartDateTimeInISO()
          Gets the start date and time of this event in the ISO 8601 format (with minute precision).
 boolean isAllDay()
          Does this occurrence occur all the day defined?
 boolean isPriority()
          Is this event has a priority?
static com.silverpeas.calendar.Datable<?> startingAt(com.silverpeas.calendar.Datable<?> startingDate)
          Convenient method to improve the readability when calling the anOccurrenceOf method.
 EventOccurrence withPriority(boolean priority)
          Sets the priority of this event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventOccurrence

protected EventOccurrence(EventDetail event,
                          com.silverpeas.calendar.Datable<?> startDate,
                          com.silverpeas.calendar.Datable<?> endDate)
Constructs a new occurrence of the specified event.

Parameters:
event - the detail about the event for which an occurrence is constructed.
Method Detail

anOccurrenceOf

public static EventOccurrence anOccurrenceOf(EventDetail event,
                                             com.silverpeas.calendar.Datable<?> startDate,
                                             com.silverpeas.calendar.Datable<?> endDate)
Creates an occurrence of the specified event starting and ending at the specified date and optionally times. If the specified datables are just Date instances, then the occurrence is considered to occur all the day.

Parameters:
event - the event.
Returns:
an occurrence of the specified event.

anOccurrenceOf

public static EventOccurrence anOccurrenceOf(EventDetail event,
                                             com.silverpeas.calendar.Date startDate,
                                             com.silverpeas.calendar.Date endDate)
Creates an occurrence of the specified event starting and ending at the specified dates. The time at which the occurrences should occur is given by the specified event detail.

Parameters:
event - the event.
Returns:
an occurrence of the specified event.

startingAt

public static com.silverpeas.calendar.Datable<?> startingAt(com.silverpeas.calendar.Datable<?> startingDate)
Convenient method to improve the readability when calling the anOccurrenceOf method.

Parameters:
startingDate - the start date of the occurrence.
Returns:
the start date.

endingAt

public static com.silverpeas.calendar.Datable<?> endingAt(com.silverpeas.calendar.Datable<?> endingDate)
Convenient method to improve the readability when calling the anOccurrenceOf method.

Parameters:
endingDate - the end date of the occurrence.
Returns:
the end date.

getEndDate

public com.silverpeas.calendar.Datable<?> getEndDate()
Gets the end date of this occurrence.

Returns:
the end date.

getStartDate

public com.silverpeas.calendar.Datable<?> getStartDate()
Gets the start date of this occurrence.

Returns:
the start date.

getEventDetail

public EventDetail getEventDetail()
Gets the details about the event this occurrence belongs to.

Returns:
the detail of the event.

isPriority

public boolean isPriority()
Is this event has a priority?

Returns:
true if this event has a priority over others, false otherwise.

withPriority

public EventOccurrence withPriority(boolean priority)
Sets the priority of this event.

Parameters:
priority - the event priority.
Returns:
itself.

isAllDay

public boolean isAllDay()
Does this occurrence occur all the day defined? An occurrence occurs all the day if its start or its end date is a single date instead of a date time.

Returns:
true if the event is occurring all the day.

getStartDateTimeInISO

public String getStartDateTimeInISO()
Gets the start date and time of this event in the ISO 8601 format (with minute precision). For example: 2010-01-01T14:30.

Returns:
the ISO 8601 format of the start date and time of this event.

getEndDateTimeInISO

public String getEndDateTimeInISO()
Gets the end date and time of this event in the ISO 8601 format (with minute precision). For example: 2010-01-01T14:30.

Returns:
the ISO 8601 format of the end date and time of this event.

compareTo

public int compareTo(EventOccurrence otherOccurrence)
Specified by:
compareTo in interface Comparable<EventOccurrence>


Copyright © 2016 Silverpeas. All Rights Reserved.