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

PropertyReturnsDescription
defaultColorStringThe colour assigned to new calendars that do not specify one, as a CSS colour name (e.g. "blue").
timezoneIdListList<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.

ParameterDescription
eventthe event to update
datathe 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.

ParameterDescription
eventthe 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.

ParameterDescription
eventthe event to move
destCalendarthe calendar the event should belong to
namethe name to give the event

newEvent(Calendar calendar)

Returns: CalEvent

Creates a new, unsaved event in the given calendar with a randomly generated name.

ParameterDescription
calendarthe 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.

ParameterDescription
calendarthe calendar the new event belongs to
newNamethe 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.

ParameterDescription
calendarthe calendar the new event belongs to
newNamethe name to give the new event
titlethe summary/title to give the new event
startthe start date and time of the new event; also used as the end date
finishnot 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.

ParameterDescription
calEventthe 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.

ParameterDescription
idthe 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.

ParameterDescription
eventthe event to update
datathe 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.

ParameterDescription
subjectthe subject template to use, or null/blank to use the default
sourceEventthe event the email relates to, made available to field placeholders
recipientthe 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.

ParameterDescription
eventthe 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.

ParameterDescription
organisationnot used

getICalData(AttendeeRequest attendeeRequest)

Returns: String

Not implemented. Intended to return the iCalendar data for an attendee's invitation, but currently always throws.

ParameterDescription
attendeeRequestthe 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.

ParameterDescription
calendarthe 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.

ParameterDescription
calendarthe calendar to search
afterDaysthe 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).

ParameterDescription
calendarthe calendar to search, or null to search all of the tenant's calendars
fromthe date to search from
tothe 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.

ParameterDescription
namethe calendar's name
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.