public class VEvent extends ICalComponent
Defines a scheduled activity, such as a two hour meeting.
Examples:
VEvent event = new VEvent(); Date start = ... event.setDateStart(start); Date end = ... event.setDateEnd(end); event.setSummary("Team Meeting"); event.setLocation("Room 21C"); event.setCreated(new Date()); event.setRecurrenceRule(new Recurrence.Builder(Frequency.WEEKLY).build());
components, properties
Constructor and Description |
---|
VEvent()
Creates a new event.
|
VEvent(VEvent original)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAlarm(VAlarm alarm)
Adds an alarm to this event.
|
void |
addAttachment(Attachment attachment)
Adds an attachment to the event.
|
void |
addAttendee(Attendee attendee)
Adds a person who is attending the event.
|
Attendee |
addAttendee(String email)
Adds a person who is attending the event.
|
void |
addCategories(Categories categories)
Adds a list of "tags" or "keywords" that describe the event.
|
Categories |
addCategories(List<String> categories)
Adds a list of "tags" or "keywords" that describe the event.
|
Categories |
addCategories(String... categories)
Adds a list of "tags" or "keywords" that describe the event.
|
void |
addComment(Comment comment)
Adds a comment to the event.
|
Comment |
addComment(String comment)
Adds a comment to the event.
|
void |
addConference(Conference conference)
Adds information related to the event's conference system.
|
void |
addContact(Contact contact)
Adds a contact to the event.
|
Contact |
addContact(String contact)
Adds a contact to the event.
|
void |
addExceptionDates(ExceptionDates exceptionDates)
Adds a list of exceptions to the recurrence rule defined in the event (if
one is defined).
|
void |
addExceptionRule(ExceptionRule exceptionRule)
Adds an exception for the
RecurrenceRule property. |
ExceptionRule |
addExceptionRule(Recurrence recur)
Adds an exception for the
RecurrenceRule property. |
void |
addImage(Image image)
Adds an image that is associated with the event.
|
void |
addRecurrenceDates(RecurrenceDates recurrenceDates)
Adds a list of dates/periods that help define the recurrence rule of this
event (if one is defined).
|
void |
addRelatedTo(RelatedTo relatedTo)
Adds a component that the event is related to.
|
RelatedTo |
addRelatedTo(String uid)
Adds a component that the event is related to.
|
Resources |
addResources(List<String> resources)
Adds a list of resources that are needed for the event.
|
void |
addResources(Resources resources)
Adds a list of resources that are needed for the event.
|
Resources |
addResources(String... resources)
Adds a list of resources that are needed for the event.
|
VEvent |
copy()
Creates a deep copy of this component object.
|
List<VAlarm> |
getAlarms()
Gets the alarms that are assigned to this event.
|
List<Attachment> |
getAttachments()
Gets any attachments that are associated with the event.
|
List<Attendee> |
getAttendees()
Gets the people who are attending the event.
|
List<Categories> |
getCategories()
Gets a list of "tags" or "keywords" that describe the event.
|
Classification |
getClassification()
Gets the level of sensitivity of the event data.
|
Color |
getColor()
Gets the color that clients may use when displaying the event (for
example, a background color).
|
List<Comment> |
getComments()
Gets the comments attached to the event.
|
List<Conference> |
getConferences()
Gets information related to the event's conference system.
|
List<Contact> |
getContacts()
Gets the contacts associated with the event.
|
Created |
getCreated()
Gets the date-time that the event was initially created.
|
DateEnd |
getDateEnd()
Gets the date that the event ends.
|
DateIterator |
getDateIterator(TimeZone timezone)
Creates an iterator that computes the dates defined by the
RecurrenceRule and RecurrenceDates properties (if
present), and excludes those dates which are defined by the
ExceptionRule and ExceptionDates properties (if present). |
DateStart |
getDateStart()
Gets the date that the event starts.
|
DateTimeStamp |
getDateTimeStamp()
Gets either (a) the creation date of the iCalendar object (if the
Method property is defined) or (b) the date that the event was
last modified (the LastModified property also holds this
information). |
Description |
getDescription()
Gets a detailed description of the event.
|
DurationProperty |
getDuration()
Gets the duration of the event.
|
List<ExceptionDates> |
getExceptionDates()
Gets the list of exceptions to the recurrence rule defined in the event
(if one is defined).
|
List<ExceptionRule> |
getExceptionRules()
Gets the exceptions for the
RecurrenceRule property. |
Geo |
getGeo()
Gets a set of geographical coordinates.
|
List<Image> |
getImages()
Gets the images that are associated with the event.
|
LastModified |
getLastModified()
Gets the date-time that the event was last changed.
|
Location |
getLocation()
Gets the physical location of the event.
|
Organizer |
getOrganizer()
Gets the organizer of the event.
|
Priority |
getPriority()
Gets the priority of the event.
|
List<RecurrenceDates> |
getRecurrenceDates()
Gets the list of dates/periods that help define the recurrence rule of
this event (if one is defined).
|
RecurrenceId |
getRecurrenceId()
Gets the original value of the
DateStart property if the event is
recurring and has been modified. |
RecurrenceRule |
getRecurrenceRule()
Gets how often the event repeats.
|
List<RelatedTo> |
getRelatedTo()
Gets the components that the event is related to.
|
RequestStatus |
getRequestStatus()
Gets the response to a scheduling request.
|
List<Resources> |
getResources()
Gets the resources that are needed for the event.
|
Sequence |
getSequence()
Gets the revision number of the event.
|
Status |
getStatus()
Gets the status of the event.
|
Summary |
getSummary()
Gets the summary of the event.
|
Transparency |
getTransparency()
Gets whether an event is visible to free/busy time searches.
|
Uid |
getUid()
Gets the unique identifier for this event.
|
Url |
getUrl()
Gets a URL to a resource that contains additional information about the
event.
|
void |
incrementSequence()
Increments the revision number of the event.
|
void |
setClassification(Classification classification)
Sets the level of sensitivity of the event data.
|
Classification |
setClassification(String classification)
Sets the level of sensitivity of the event data.
|
void |
setColor(Color color)
Sets the color that clients may use when displaying the event (for
example, a background color).
|
Color |
setColor(String color)
Sets the color that clients may use when displaying the event (for
example, a background color).
|
void |
setCreated(Created created)
Sets the date-time that the event was initially created.
|
Created |
setCreated(Date created)
Sets the date-time that the event was initially created.
|
DateEnd |
setDateEnd(Date dateEnd)
Sets the date that the event ends.
|
DateEnd |
setDateEnd(Date dateEnd,
boolean hasTime)
Sets the date that the event ends.
|
void |
setDateEnd(DateEnd dateEnd)
Sets the date that the event ends.
|
DateStart |
setDateStart(Date dateStart)
Sets the date that the event starts (required if no
Method
property is defined). |
DateStart |
setDateStart(Date dateStart,
boolean hasTime)
Sets the date that the event starts (required if no
Method
property is defined). |
void |
setDateStart(DateStart dateStart)
Sets the date that the event starts (required if no
Method
property is defined). |
DateTimeStamp |
setDateTimeStamp(Date dateTimeStamp)
Sets either (a) the creation date of the iCalendar object (if the
Method property is defined) or (b) the date that the event was
last modified (the LastModified property also holds this
information). |
void |
setDateTimeStamp(DateTimeStamp dateTimeStamp)
Sets either (a) the creation date of the iCalendar object (if the
Method property is defined) or (b) the date that the event was
last modified (the LastModified property also holds this
information). |
void |
setDescription(Description description)
Sets a detailed description of the event.
|
Description |
setDescription(String description)
Sets a detailed description of the event.
|
DurationProperty |
setDuration(Duration duration)
Sets the duration of the event.
|
void |
setDuration(DurationProperty duration)
Sets the duration of the event.
|
void |
setGeo(Geo geo)
Sets a set of geographical coordinates.
|
LastModified |
setLastModified(Date lastModified)
Sets the date-time that the event was last changed.
|
void |
setLastModified(LastModified lastModified)
Sets the date-time that event was last changed.
|
void |
setLocation(Location location)
Sets the physical location of the event.
|
Location |
setLocation(String location)
Sets the physical location of the event.
|
void |
setOrganizer(Organizer organizer)
Sets the organizer of the event.
|
Organizer |
setOrganizer(String email)
Sets the organizer of the event.
|
Priority |
setPriority(Integer priority)
Sets the priority of the event.
|
void |
setPriority(Priority priority)
Sets the priority of the event.
|
RecurrenceId |
setRecurrenceId(Date originalStartDate)
Sets the original value of the
DateStart property if the event is
recurring and has been modified. |
void |
setRecurrenceId(RecurrenceId recurrenceId)
Sets the original value of the
DateStart property if the event is
recurring and has been modified. |
RecurrenceRule |
setRecurrenceRule(Recurrence recur)
Sets how often the event repeats.
|
void |
setRecurrenceRule(RecurrenceRule recurrenceRule)
Sets how often the event repeats.
|
void |
setRequestStatus(RequestStatus requestStatus)
Sets the response to a scheduling request.
|
Sequence |
setSequence(Integer sequence)
Sets the revision number of the event.
|
void |
setSequence(Sequence sequence)
Sets the revision number of the event.
|
void |
setStatus(Status status)
Sets the status of the event.
|
Summary |
setSummary(String summary)
Sets the summary of the event.
|
void |
setSummary(Summary summary)
Sets the summary of the event.
|
Transparency |
setTransparency(Boolean transparent)
Sets whether an event is visible to free/busy time searches.
|
void |
setTransparency(Transparency transparency)
Sets whether an event is visible to free/busy time searches.
|
Uid |
setUid(String uid)
Sets the unique identifier for this event.
|
void |
setUid(Uid uid)
Sets the unique identifier for this event.
|
Url |
setUrl(String url)
Sets a URL to a resource that contains additional information about the
event.
|
void |
setUrl(Url url)
Sets a URL to a resource that contains additional information about the
event.
|
protected void |
validate(List<ICalComponent> components,
ICalVersion version,
List<Warning> warnings)
Checks the component for data consistency problems or deviations from the
spec.
|
addComponent, addExperimentalComponent, addExperimentalProperty, addExperimentalProperty, addProperty, checkOptionalCardinality, checkRequiredCardinality, checkStatus, equals, getComponent, getComponents, getComponents, getExperimentalComponent, getExperimentalComponents, getExperimentalComponents, getExperimentalProperties, getExperimentalProperties, getExperimentalProperty, getProperties, getProperties, getProperty, hashCode, removeComponent, removeComponents, removeExperimentalComponents, removeExperimentalProperties, removeProperties, removeProperty, setComponent, setComponent, setExperimentalComponent, setExperimentalProperty, setExperimentalProperty, setProperty, setProperty, toString, toStringValues, validate
public VEvent()
Creates a new event.
The following properties are added to the component when it is created:
Uid
: Set to a UUID.DateTimeStamp
: Set to the current time.public Uid getUid()
public void setUid(Uid uid)
uid
- the UID or null to removepublic Uid setUid(String uid)
uid
- the UID or null to removepublic DateTimeStamp getDateTimeStamp()
Method
property is defined) or (b) the date that the event was
last modified (the LastModified
property also holds this
information). This event object comes populated with a
DateTimeStamp
property that is set to the current time. This is a
required property.public void setDateTimeStamp(DateTimeStamp dateTimeStamp)
Method
property is defined) or (b) the date that the event was
last modified (the LastModified
property also holds this
information). This event object comes populated with a
DateTimeStamp
property that is set to the current time. This is a
required property.dateTimeStamp
- the date time stamp or null to removepublic DateTimeStamp setDateTimeStamp(Date dateTimeStamp)
Method
property is defined) or (b) the date that the event was
last modified (the LastModified
property also holds this
information). This event object comes populated with a
DateTimeStamp
property that is set to the current time. This is a
required property.dateTimeStamp
- the date time stamp or null to removepublic DateStart getDateStart()
public void setDateStart(DateStart dateStart)
Method
property is defined).dateStart
- the start date or null to removepublic DateStart setDateStart(Date dateStart)
Method
property is defined).dateStart
- the start date or null to removepublic DateStart setDateStart(Date dateStart, boolean hasTime)
Method
property is defined).dateStart
- the start date or null to removehasTime
- true if the date has a time component, false if it is
strictly a date (if false, the given Date object should be created by a
Calendar
object that uses the JVM's default
timezone)public Classification getClassification()
public void setClassification(Classification classification)
classification
- the classification level or null to removepublic Classification setClassification(String classification)
classification
- the classification level (e.g. "CONFIDENTIAL") or
null to removepublic Description getDescription()
Summary
property.public void setDescription(Description description)
Summary
property.description
- the description or null to removepublic Description setDescription(String description)
Summary
property.description
- the description or null to removepublic Geo getGeo()
public void setGeo(Geo geo)
geo
- the geographical coordinates or null to removepublic Location getLocation()
public void setLocation(Location location)
location
- the location or null to removepublic Location setLocation(String location)
location
- the location (e.g. "Room 101") or null to removepublic Priority getPriority()
public void setPriority(Priority priority)
priority
- the priority or null to removepublic Priority setPriority(Integer priority)
priority
- the priority ("0" is undefined, "1" is the highest, "9"
is the lowest) or null to removepublic Status getStatus()
public void setStatus(Status status)
Sets the status of the event.
Valid event status codes are:
status
- the status or null to removepublic Summary getSummary()
public void setSummary(Summary summary)
summary
- the summary or null to removepublic Summary setSummary(String summary)
summary
- the summary or null to removepublic Transparency getTransparency()
public void setTransparency(Transparency transparency)
transparency
- the transparency or null to removepublic Transparency setTransparency(Boolean transparent)
transparent
- true to hide the event, false to make it visible it,
or null to remove the propertypublic Organizer getOrganizer()
public void setOrganizer(Organizer organizer)
organizer
- the organizer or null to removepublic Organizer setOrganizer(String email)
email
- the organizer's email address (e.g. "johndoe@example.com")
or null to removepublic RecurrenceId getRecurrenceId()
DateStart
property if the event is
recurring and has been modified. Used in conjunction with the Uid
and Sequence
properties to uniquely identify a recurrence
instance.public void setRecurrenceId(RecurrenceId recurrenceId)
DateStart
property if the event is
recurring and has been modified. Used in conjunction with the Uid
and Sequence
properties to uniquely identify a recurrence
instance.recurrenceId
- the recurrence ID or null to removepublic RecurrenceId setRecurrenceId(Date originalStartDate)
DateStart
property if the event is
recurring and has been modified. Used in conjunction with the Uid
and Sequence
properties to uniquely identify a recurrence
instance.originalStartDate
- the original start date or null to removepublic Url getUrl()
public void setUrl(Url url)
url
- the URL or null to removepublic Url setUrl(String url)
url
- the URL (e.g. "http://example.com/resource.ics") or null to
removepublic RecurrenceRule getRecurrenceRule()
public RecurrenceRule setRecurrenceRule(Recurrence recur)
recur
- the recurrence rule or null to removepublic void setRecurrenceRule(RecurrenceRule recurrenceRule)
recurrenceRule
- the recurrence rule or null to removepublic DateEnd getDateEnd()
public void setDateEnd(DateEnd dateEnd)
DurationProperty
is defined.dateEnd
- the end date or null to removepublic DateEnd setDateEnd(Date dateEnd)
DurationProperty
is defined.dateEnd
- the end date or null to removepublic DateEnd setDateEnd(Date dateEnd, boolean hasTime)
DurationProperty
is defined.dateEnd
- the end date or null to removehasTime
- true if the date has a time component, false if it is
strictly a date (if false, the given Date object should be created by a
Calendar
object that uses the JVM's default
timezone)public DurationProperty getDuration()
public void setDuration(DurationProperty duration)
DateEnd
is defined.duration
- the duration or null to removepublic DurationProperty setDuration(Duration duration)
DateEnd
is defined.duration
- the duration or null to removepublic Created getCreated()
public void setCreated(Created created)
created
- the creation date-time or null to removepublic Created setCreated(Date created)
created
- the creation date-time or null to removepublic LastModified getLastModified()
public void setLastModified(LastModified lastModified)
lastModified
- the last modified date or null to removepublic LastModified setLastModified(Date lastModified)
lastModified
- the last modified date or null to removepublic Sequence getSequence()
public void setSequence(Sequence sequence)
sequence
- the sequence numberpublic Sequence setSequence(Integer sequence)
sequence
- the sequence numberpublic void incrementSequence()
public List<Attachment> getAttachments()
public void addAttachment(Attachment attachment)
attachment
- the attachment to addpublic List<Attendee> getAttendees()
public void addAttendee(Attendee attendee)
attendee
- the attendeepublic Attendee addAttendee(String email)
email
- the attendee's email addresspublic List<Categories> getCategories()
public void addCategories(Categories categories)
categories
- the categories to addpublic Categories addCategories(String... categories)
categories
- the categories to addpublic Categories addCategories(List<String> categories)
categories
- the categories to addpublic List<Comment> getComments()
public void addComment(Comment comment)
comment
- the comment to addpublic Comment addComment(String comment)
comment
- the comment to addpublic List<Contact> getContacts()
public void addContact(Contact contact)
contact
- the contactpublic Contact addContact(String contact)
contact
- the contact (e.g. "ACME Co - (123) 555-1234")public List<ExceptionDates> getExceptionDates()
public void addExceptionDates(ExceptionDates exceptionDates)
exceptionDates
- the list of exceptionspublic RequestStatus getRequestStatus()
public void setRequestStatus(RequestStatus requestStatus)
requestStatus
- the responsepublic List<RelatedTo> getRelatedTo()
public void addRelatedTo(RelatedTo relatedTo)
relatedTo
- the relationshippublic RelatedTo addRelatedTo(String uid)
uid
- the UID of the other componentpublic List<Resources> getResources()
public void addResources(Resources resources)
resources
- the resources to addpublic Resources addResources(String... resources)
resources
- the resources to add (e.g. "easel", "projector")public Resources addResources(List<String> resources)
resources
- the resources to add (e.g. "easel", "projector")public List<RecurrenceDates> getRecurrenceDates()
public void addRecurrenceDates(RecurrenceDates recurrenceDates)
recurrenceDates
- the recurrence datespublic List<VAlarm> getAlarms()
public void addAlarm(VAlarm alarm)
alarm
- the alarmpublic List<ExceptionRule> getExceptionRules()
Gets the exceptions for the RecurrenceRule
property.
Note that this property has been removed from the latest version of the iCal specification. Its use should be avoided.
public ExceptionRule addExceptionRule(Recurrence recur)
Adds an exception for the RecurrenceRule
property.
Note that this property has been removed from the latest version of the iCal specification. Its use should be avoided.
recur
- the exception rule to addpublic void addExceptionRule(ExceptionRule exceptionRule)
Adds an exception for the RecurrenceRule
property.
Note that this property has been removed from the latest version of the iCal specification. Its use should be avoided.
exceptionRule
- the exception rule to addpublic Color getColor()
public void setColor(Color color)
color
- the property or null to removepublic Color setColor(String color)
color
- the color name (case insensitive) or null to remove.
Acceptable values are defined in Section 4.3 of the CSS Color Module Level 3 Recommendation. For
example, "aliceblue", "green", "navy".public List<Image> getImages()
public void addImage(Image image)
image
- the imagepublic List<Conference> getConferences()
public void addConference(Conference conference)
conference
- the conferencepublic DateIterator getDateIterator(TimeZone timezone)
Creates an iterator that computes the dates defined by the
RecurrenceRule
and RecurrenceDates
properties (if
present), and excludes those dates which are defined by the
ExceptionRule
and ExceptionDates
properties (if present).
In order for RecurrenceRule
and ExceptionRule
properties
to be included in this iterator, a DateStart
property must be
defined.
Period
values in RecurrenceDates
properties are not
supported and are ignored.
timezone
- the timezone to iterate in. This is needed in order to
adjust for when the iterator passes over a daylight savings boundary.
This parameter is ignored if the start date does not have a time
component.protected void validate(List<ICalComponent> components, ICalVersion version, List<Warning> warnings)
ICalComponent
Checks the component for data consistency problems or deviations from the spec.
This method should be overridden by child classes that wish to provide validation logic. The default implementation of this method does nothing.
validate
in class ICalComponent
components
- the hierarchy of components that the component belongs
toversion
- the version to validate againstwarnings
- the list to add the warnings topublic VEvent copy()
ICalComponent
Creates a deep copy of this component object.
The default implementation of this method uses reflection to look for a copy constructor. Child classes SHOULD override this method to avoid the performance overhead involved in using reflection.
The child class's copy constructor, if present, MUST invoke the
ICalComponent.ICalComponent(ICalComponent)
super constructor to ensure that
the component's properties and sub-components are copied.
This method MUST be overridden by the child class if the child class does
not have a copy constructor. Otherwise, an
UnsupportedOperationException
will be thrown when an attempt is
made to copy the component (such as in the
ICalendar class's copy constructor
).
copy
in class ICalComponent
Copyright © 2013-2016 Michael Angstadt. All Rights Reserved.