Manages calendars and calendar events, including creating, copying and moving events and building their iCalendar representation. It also handles attendee invitations, acceptances and declines, sends confirmation and reminder emails for events, and resolves and caches time zone lookups by ID. A single instance is registered on the platform context and is reached from other server-side Java code via the request context.
Group: Managers
Properties
| Property | Returns | Description |
|---|---|---|
| defaultColor | String | The colour assigned to new calendars that do not specify one, as a CSS colour name (e.g. "blue"). |
| timezoneIdList | List<String> | The list of time zone IDs offered to users, filtered down to common regional groups (for example those starting with "America", "Europe" or "Pacific") rather than the full set known to the JVM. |
Methods
update(CalEvent event, String data) · delete(CalEvent event) · move(CalEvent event, Calendar destCalendar, String name) · newEvent(Calendar calendar) · newEvent(Calendar calendar, String newName) · newEvent(Calendar calendar, String newName, String title, Date start, Date finish) · getCalendar(CalEvent calEvent) · getTimezone(String id) · getDefaultColor() · _update(CalEvent event, String data) · generateSubject(String subject, CalEvent sourceEvent, Profile recipient) · getEventSummaryHtml(CalEvent event) · getTimezoneIdList() · getDefaultConfirmEmailTemplate(Organisation organisation) · getICalData(AttendeeRequest attendeeRequest) · getUpcomingEvents(Calendar calendar) · getUpcomingEvents(Calendar calendar, int afterDays) · findEvents(Calendar calendar, Date from, Date to) · findCalendar(String name)
update(CalEvent event, String data)
Returns: void
Parses the given iCalendar data and applies its start date, end date, summary and location onto the event, then saves the event and its calendar in a new transaction.
| Parameter | Description |
|---|---|
event | the event to update |
data | the iCalendar (ical) text to parse and apply to the event |
delete(CalEvent event)
Returns: void
Deletes a calendar event, along with any module-calendar-event links that reference it.
| Parameter | Description |
|---|---|
event | the event to delete |
move(CalEvent event, Calendar destCalendar, String name)
Returns: void
Renames an event if the given name differs from its current name, and moves it from its current calendar to the destination calendar if they differ, saving both calendars in a new transaction.
| Parameter | Description |
|---|---|
event | the event to move |
destCalendar | the calendar the event should belong to |
name | the name to give the event |
newEvent(Calendar calendar)
Returns: CalEvent
Creates a new, unsaved event in the given calendar with a randomly generated name.
| Parameter | Description |
|---|---|
calendar | the calendar the new event belongs to |
newEvent(Calendar calendar, String newName)
Returns: CalEvent
Creates a new, unsaved event with the given name in the given calendar and adds it to the calendar's event list.
| Parameter | Description |
|---|---|
calendar | the calendar the new event belongs to |
newName | the name to give the new event |
newEvent(Calendar calendar, String newName, String title, Date start, Date finish)
Returns: CalEvent
Creates and saves a new event with the given name and title, organised by the current user, sets its start and end date both to the given start date, and writes its iCalendar representation as a file into the calendar's virtual file store.
| Parameter | Description |
|---|---|
calendar | the calendar the new event belongs to |
newName | the name to give the new event |
title | the summary/title to give the new event |
start | the start date and time of the new event; also used as the end date |
finish | not used |
getCalendar(CalEvent calEvent)
Returns: String
Builds and returns the iCalendar (ical) text representation of the given event, including its time zone component. Falls back to GMT if the event's time zone cannot be resolved.
| Parameter | Description |
|---|---|
calEvent | the event to render as iCalendar data |
getTimezone(String id)
Returns: TimeZone
Resolves an ical4j time zone by ID, using a short-lived in-memory cache to avoid repeated registry lookups.
| Parameter | Description |
|---|---|
id | the time zone ID to resolve, e.g. "Pacific/Auckland", or null |
getDefaultColor()
Returns: String
The colour assigned to new calendars that do not specify one, as a CSS colour name (e.g. "blue").
_update(CalEvent event, String data)
Returns: void
Parses the given iCalendar data and applies its start date, end date, summary and location onto the event. Does not save the event.
| Parameter | Description |
|---|---|
event | the event to update |
data | the iCalendar (ical) text to parse and apply to the event |
generateSubject(String subject, CalEvent sourceEvent, Profile recipient)
Returns: String
Builds the subject line for a confirmation or reminder email. Falls back to a default "thank you for registering" subject if none is supplied, and evaluates any field placeholders in the subject against the event and recipient.
| Parameter | Description |
|---|---|
subject | the subject template to use, or null/blank to use the default |
sourceEvent | the event the email relates to, made available to field placeholders |
recipient | the profile the email is being sent to, made available to field placeholders |
getEventSummaryHtml(CalEvent event)
Returns: String
Builds an HTML summary table for an event, showing its date, location (if set) and organiser.
| Parameter | Description |
|---|---|
event | the event to summarise |
getTimezoneIdList()
Returns: List<String>
The list of time zone IDs offered to users, filtered down to common regional groups (for example those starting with "America", "Europe" or "Pacific") rather than the full set known to the JVM.
getDefaultConfirmEmailTemplate(Organisation organisation)
Returns: String
Builds the default HTML template used for attendance confirmation emails, with placeholders for the event's start date, location and organiser.
| Parameter | Description |
|---|---|
organisation | not used |
getICalData(AttendeeRequest attendeeRequest)
Returns: String
Not implemented. Intended to return the iCalendar data for an attendee's invitation, but currently always throws.
| Parameter | Description |
|---|---|
attendeeRequest | the attendee request the iCalendar data would be generated for |
getUpcomingEvents(Calendar calendar)
Returns: List<CalEvent>
Finds events starting between now and 30 days from now for the given calendar.
| Parameter | Description |
|---|---|
calendar | the calendar to search |
getUpcomingEvents(Calendar calendar, int afterDays)
Returns: List<CalEvent>
Finds events starting between now and the given number of days from now for the given calendar.
| Parameter | Description |
|---|---|
calendar | the calendar to search |
afterDays | the number of days ahead to search up to |
findEvents(Calendar calendar, Date from, Date to)
Returns: List<CalEvent>
Finds events starting within a date range, either in a specific calendar or, if no calendar is given, across all calendars for the current tenant organisation (excluding personal calendars).
| Parameter | Description |
|---|---|
calendar | the calendar to search, or null to search all of the tenant's calendars |
from | the date to search from |
to | the date to search up to |
findCalendar(String name)
Returns: Calendar
Finds a calendar by name within the current tenant organisation, with its events eagerly loaded.
| Parameter | Description |
|---|---|
name | the calendar's name |