Class CalendarManagerImpl
java.lang.Object
ch.tocco.nice2.optional.calendar.impl.ical.CalendarManagerImpl
- All Implemented Interfaces:
CalendarManager
-
Constructor Summary
ConstructorsConstructorDescriptionCalendarManagerImpl(CalendarDao dao, CalendarManagerListenerService listenerService) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateCalendar(String name, String entityModel, String relationName) Creates a new empty calendar object with the specified name, entity type and relation name.createCalendar(String name, String entityModel, String relationName, org.joda.time.DateTimeZone timezone) Creates a new empty calendar object with the specified name.Creates a new builder forRecurrences.@Nullable CalendargetCalendar(EntityFilter calendarEntityFilter, EntityFilter calendarEventEntityFilter, @Nullable Context ctx) Finds one single calendar depending on the specified filters.getCalendar(Entity target) Returns the default calendar for the type of the specified entity containing only events that are linked to the specifie dentity.getCalendar(String entityModel, EntityFilter calendarEventEntityFilter, @Nullable Context ctx) Gets the default calendar for the specified entity type.getCalendar(String entityModel, String relationName, Entity target) Returns the calendar for the specified entity model containing only events that are linked to the specified target entity with the specified relation name.getCalendars(EntityFilter calendarFilter, EntityFilter calendarEventEntityFilter, @Nullable Context ctx) Returns calendars depending on the specified calendarEntityFilter.getEndDate(CalendarEvent event) Returns either the end date of the event, if not null.mapCalendarEntity(Entity calendarEntity, EntityFilter calendarEventEntityFilter) Creates a calendar object from the specified calendar entity.mapCalendarEventEntity(Entity calendarEventEntity, EntityFilter calendarEventEntityFilter) Creates a calendar event object from the specified "Calendar_event" entity.requireCalendar(EntityFilter calendarEntityFilter, EntityFilter calendarEventEntityFilter, @Nullable Context ctx) Finds one single calendar depending on the specified filters.voidsaveCalendar(Calendar cal, @Nullable Context ctx) Saves the calendar to the database.Exports the specified calendar object into the ical format.toICal(String name, @Nullable String description, Iterable<CalendarEvent> events) Exports the set of calendar events to the iCal format.
-
Constructor Details
-
CalendarManagerImpl
-
-
Method Details
-
addCalendarManagerListener
- Specified by:
addCalendarManagerListenerin interfaceCalendarManager
-
getCalendars
public List<Calendar> getCalendars(EntityFilter calendarFilter, EntityFilter calendarEventEntityFilter, @Nullable @Nullable Context ctx) Description copied from interface:CalendarManagerReturns calendars depending on the specified calendarEntityFilter. Also a calendarEventEntityFilter may be specified to narrow the list of calendar events of each calendar.- Specified by:
getCalendarsin interfaceCalendarManager
-
getCalendar
@Nullable public @Nullable Calendar getCalendar(EntityFilter calendarEntityFilter, EntityFilter calendarEventEntityFilter, @Nullable @Nullable Context ctx) Description copied from interface:CalendarManagerFinds one single calendar depending on the specified filters. It expects the calendarEntityFilter to create query for one or no result; throwing an exception if more than one result is returned. Returns null if nothing is found.- Specified by:
getCalendarin interfaceCalendarManager
-
requireCalendar
public Calendar requireCalendar(EntityFilter calendarEntityFilter, EntityFilter calendarEventEntityFilter, @Nullable @Nullable Context ctx) Description copied from interface:CalendarManagerFinds one single calendar depending on the specified filters. It expects the calendarEntityFilter to create query for exaclty one result; throwing an exception if more than one result is returned or nothing is found.- Specified by:
requireCalendarin interfaceCalendarManager
-
getCalendar
public Calendar getCalendar(String entityModel, EntityFilter calendarEventEntityFilter, @Nullable @Nullable Context ctx) Description copied from interface:CalendarManagerGets the default calendar for the specified entity type.- Specified by:
getCalendarin interfaceCalendarManager
-
getCalendar
Description copied from interface:CalendarManagerReturns the default calendar for the type of the specified entity containing only events that are linked to the specifie dentity.- Specified by:
getCalendarin interfaceCalendarManager
-
getCalendar
Description copied from interface:CalendarManagerReturns the calendar for the specified entity model containing only events that are linked to the specified target entity with the specified relation name.- Specified by:
getCalendarin interfaceCalendarManager- Parameters:
entityModel- the entity model the calendar is associated torelationName- the name of the relation that yields in the target entitytarget- the target of the relation
-
createCalendar
Description copied from interface:CalendarManagerCreates a new empty calendar object with the specified name, entity type and relation name.
The entity type and relation name specifies the relation type of each calendar event in this calendar. The relation name is the name of the relation from the calendar event (source entity) to a target entity specified by entityType.
The calendar is created with UTC time zone.
- Specified by:
createCalendarin interfaceCalendarManager- Parameters:
name- the name of the calendarentityModel- the target entity type for the linked entities from calendar eventsrelationName- the name of the relation to the target entity
-
createCalendar
public Calendar createCalendar(String name, String entityModel, String relationName, org.joda.time.DateTimeZone timezone) Description copied from interface:CalendarManagerCreates a new empty calendar object with the specified name.- Specified by:
createCalendarin interfaceCalendarManager- Parameters:
name- name the name of the calendarentityModel- entityType the target entity type for the linked entities from calendar eventsrelationName- relationName the name of the relation to the target entitytimezone- a time zone for the calendar
-
mapCalendarEntity
Description copied from interface:CalendarManagerCreates a calendar object from the specified calendar entity. The calendarEventEntityFilter can be specified to control what calendar events to include.- Specified by:
mapCalendarEntityin interfaceCalendarManager
-
mapCalendarEventEntity
public CalendarEvent mapCalendarEventEntity(Entity calendarEventEntity, EntityFilter calendarEventEntityFilter) Description copied from interface:CalendarManagerCreates a calendar event object from the specified "Calendar_event" entity. The returned calendar event object is attached to its calendar, which is also loaded from the database. The calendarEventEntityFilter is used to obtain the list of events (additional to the returned) of the calendar.- Specified by:
mapCalendarEventEntityin interfaceCalendarManager
-
saveCalendar
Description copied from interface:CalendarManagerSaves the calendar to the database. If it already exists, all new events are saved, but no event is deleted, so the event lists are not fully synchronized.- Specified by:
saveCalendarin interfaceCalendarManager
-
toICal
Description copied from interface:CalendarManagerExports the specified calendar object into the ical format.- Specified by:
toICalin interfaceCalendarManager
-
toICal
public String toICal(String name, @Nullable @Nullable String description, Iterable<CalendarEvent> events) Description copied from interface:CalendarManagerExports the set of calendar events to the iCal format.- Specified by:
toICalin interfaceCalendarManager- Parameters:
name- the name used as calendar namedescription- an optional descriptionevents- the set of events to export- Returns:
- the iCal formatted string
-
createRecurrenceRuleBuilder
Description copied from interface:CalendarManagerCreates a new builder forRecurrences.- Specified by:
createRecurrenceRuleBuilderin interfaceCalendarManager- Parameters:
freq- mandatory parameter for a recurrence
-
getEndDate
Description copied from interface:CalendarManagerReturns either the end date of the event, if not null. otherwise it checks whether it is an allday event, and returns the datetime of the end of the day. If its not and the end date is null, the start date is returned.- Specified by:
getEndDatein interfaceCalendarManager
-