Package org.silverpeas.core.calendar
Class CalendarComponent
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
-
- org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<CalendarComponent,UuidIdentifier>
-
- org.silverpeas.core.calendar.CalendarComponent
-
- All Implemented Interfaces:
Serializable
,Entity<CalendarComponent,UuidIdentifier>
,IdentifiableEntity
@Entity public class CalendarComponent extends SilverpeasJpaEntity<CalendarComponent,UuidIdentifier>
A calendar component is a set of properties that express a common semantic for all objects planned in a calendar. Those objects can be an event, a to-do, and so one and they share a common set of properties that are defined in this class. This class is dedicated to be used into an implementation composition by the more concrete representations of a calendar component (like for exampleCalendarEvent
). We recommend strongly to force the update of theCalendarComponent
instance when a property is modified in the outer object; this is a requirement for date properties (like the recurrence rule for a recurrent outer object).- Author:
- mmoquillon
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CalendarComponent()
Constructs an empty calendar component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CalendarComponent
copy()
Copies this calendar component.CalendarComponent
copyTo(CalendarComponent anotherComponent)
Copies the state of this calendar component to the specified other calendar component.AttendeeSet
getAttendees()
Gets the attendees in this calendar component.AttributeSet
getAttributes()
Gets the additional and custom attributes of this calendar component.Calendar
getCalendar()
Gets the calendar to which this component is related.String
getDescription()
Gets the description of this calendar component.String
getLocation()
Gets the location of this calendar component.Period
getPeriod()
Gets the period in the calendar of this calendar component.Priority
getPriority()
Gets the priority of this calendar component.long
getSequence()
Gets the revision sequence number of the calendar component within a sequence of revisions.String
getTitle()
Gets the title of this calendar component.protected boolean
isModifiedSince(CalendarComponent previous)
Is the properties of this calendar component was modified since its last specified state?protected void
performBeforeUpdate()
Performs some treatments before its counterpart in a repository is updated with the changes in this entity.void
setCalendar(Calendar calendar)
Sets a calendar to this component.void
setDescription(String description)
Sets a new description for this calendar component.void
setLocation(String location)
Sets a new location for calendar component.void
setPeriod(Period newPeriod)
Sets a new period for this calendar component.void
setPriority(Priority priority)
Sets a new priority for this calendar component.void
setTitle(String title)
Sets a new title for this calendar component.-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity
createdBy, createdBy, createdBy, equals, getCreationDate, getCreator, getCreatorId, getLastUpdateDate, getLastUpdater, getLastUpdaterId, getVersion, hasBeenModified, hashCode, lastUpdatedBy, markAsModified, performBeforePersist, performBeforeRemove, setCreationDate, setCreator, setLastUpdateDate, setLastUpdater, setVersion, updatedBy, updatedBy
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersisted, setId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.persistence.datasource.model.IdentifiableEntity
getId, isPersisted
-
-
-
-
Method Detail
-
getCalendar
public Calendar getCalendar()
Gets the calendar to which this component is related. A calendar component can only be in one existing calendar.- Returns:
- either the calendar into which this component is or null if this component wasn't yet put into a given calendar.
-
setCalendar
public void setCalendar(Calendar calendar)
Sets a calendar to this component. This puts this component into the specified calendar. If the component is already in another calendar, then this is like to move the component to the specified calendar.- Parameters:
calendar
- the calendar into which this component has to move.
-
getPeriod
public Period getPeriod()
Gets the period in the calendar of this calendar component.- Returns:
- a period of time this component occurs in the calendar.
-
setPeriod
public void setPeriod(Period newPeriod)
Sets a new period for this calendar component. This moves the component in the timeline of the calendar.- Parameters:
newPeriod
- a new period to set for this calendar component.
-
getTitle
public String getTitle()
Gets the title of this calendar component.- Returns:
- the title of this calendar component.
-
setTitle
public void setTitle(String title)
Sets a new title for this calendar component.- Parameters:
title
- the new title to set.
-
getDescription
public String getDescription()
Gets the description of this calendar component.- Returns:
- the description of this calendar component.
-
setDescription
public void setDescription(String description)
Sets a new description for this calendar component.- Parameters:
description
- the new description to set.
-
getLocation
public String getLocation()
Gets the location of this calendar component. The location is where this component takes place. It can be an address, a designation or a GPS coordinates. According to the semantic expressed by the component, the location can be meaningless.- Returns:
- the location where this component takes place.
-
setLocation
public void setLocation(String location)
Sets a new location for calendar component. The location is where this component takes place. It can be an address, a designation or a GPS coordinates. According to the semantic expressed by the component, the location can be meaningless.- Parameters:
location
- the new location to set.
-
getPriority
public Priority getPriority()
Gets the priority of this calendar component.- Returns:
- the priority of this calendar component.
-
setPriority
public void setPriority(Priority priority)
Sets a new priority for this calendar component.- Parameters:
priority
- the new priority to set.
-
getAttributes
public AttributeSet getAttributes()
Gets the additional and custom attributes of this calendar component. The attributes can be directly managed through the returnedAttributeSet
instance.- Returns:
- the additional attributes of this calendar component.
-
getAttendees
public AttendeeSet getAttendees()
Gets the attendees in this calendar component. An attendee can be either an internal user in Silverpeas (InternalAttendee
) or a user external from Silverpeas. (ExternalAttendee
). The creator of a calendar component isn't considered as an attendee and hence he's not present among the attendees of in the component. If his participation has to be explicit, then he should be added as a participant in the attendees in the calendar component.- Returns:
- the attendees in this calendar component.
-
getSequence
public long getSequence()
Gets the revision sequence number of the calendar component within a sequence of revisions. Any changes to some properties of a calendar component increment this sequence number. This number is mainly dedicated with the synchronization or syndication mechanism of calendar components with external calendars. Its meaning comes from the icalendar specification. The sequence number will be always incremented when a date property is modified (the period at which the component occurs in the calendar, the recurrence rule for a recurrent component). Nevertheless, it can also be incremented with the change of some other properties. Actually the sequence number has the same meaning than the version number (SilverpeasJpaEntity.getVersion()
) minus the sequence number can to be not incremented with the change of some properties. This means than the version number matches always the number of updates of the calendar component whereas the sequence number matches only a subset of update of the calendar component.- Returns:
- the revision number of this calendar component;
-
copy
public CalendarComponent copy()
Copies this calendar component. Only the state of this calendar component is cloned to a new calendar component. The returned calendar component is not planned in any calendar.- Returns:
- an unplanned clone of this calendar component.
- See Also:
copyTo(CalendarComponent)
-
copyTo
public CalendarComponent copyTo(CalendarComponent anotherComponent)
Copies the state of this calendar component to the specified other calendar component. The unique identifier, the calendar to which this component is planned and the sequence number aren't copied. Those are particular properties to each calendar component as they form both the identify of a calendar component.- Parameters:
anotherComponent
- another calendar component.- Returns:
- the calendar component valued with the state of this component.
-
performBeforeUpdate
protected void performBeforeUpdate()
Description copied from class:AbstractJpaEntity
Performs some treatments before its counterpart in a repository is updated with the changes in this entity.- Overrides:
performBeforeUpdate
in classSilverpeasJpaEntity<CalendarComponent,UuidIdentifier>
-
isModifiedSince
protected boolean isModifiedSince(CalendarComponent previous)
Is the properties of this calendar component was modified since its last specified state? The attendees in this component aren't taken into account as they aren't considered as a property of a calendar component.- Parameters:
previous
- a previous state of this calendar component.- Returns:
- true if the state of this calendar component is different with the specified one.
-
-