use of fi.otavanopisto.muikku.calendar.CalendarServiceProvider in project muikku by otavanopisto.
the class CalendarController method updateCalendarEvent.
public CalendarEvent updateCalendarEvent(UserCalendar userCalendar, CalendarEvent calendarEvent) throws CalendarServiceException {
CalendarServiceProvider provider = getCalendarServiceProvider(userCalendar.getCalendarProvider());
Calendar calendar = provider.findCalendar(userCalendar.getCalendarId());
if (calendar == null) {
throw new CalendarServiceException("Could not find calendar for user calendar #" + userCalendar.getId());
}
if (StringUtils.isBlank(calendarEvent.getId())) {
throw new CalendarServiceException("Cannot update event without id");
}
return provider.updateEvent(calendarEvent);
}
use of fi.otavanopisto.muikku.calendar.CalendarServiceProvider in project muikku by otavanopisto.
the class CalendarController method findCalendarEvent.
public fi.otavanopisto.muikku.calendar.CalendarEvent findCalendarEvent(UserCalendar userCalendar, String eventId) throws CalendarServiceException {
CalendarServiceProvider provider = getCalendarServiceProvider(userCalendar.getCalendarProvider());
Calendar calendar = provider.findCalendar(userCalendar.getCalendarId());
if (calendar == null) {
throw new CalendarServiceException("Could not find calendar for user calendar #" + userCalendar.getId());
}
return provider.findEvent(calendar, eventId);
}
use of fi.otavanopisto.muikku.calendar.CalendarServiceProvider in project muikku by otavanopisto.
the class CalendarController method createCalendarEvent.
public CalendarEvent createCalendarEvent(UserCalendar userCalendar, String summary, String description, CalendarEventStatus status, Date start, TimeZone startTimeZone, Date end, TimeZone endTimeZone, List<CalendarEventAttendee> attendees, List<CalendarEventReminder> reminders, String recurrence, boolean allDay, Map<String, String> extendedProperties) throws CalendarServiceException {
CalendarServiceProvider provider = getCalendarServiceProvider(userCalendar.getCalendarProvider());
Calendar calendar = provider.findCalendar(userCalendar.getCalendarId());
if (calendar == null) {
throw new CalendarServiceException("Could not find calendar for user calendar #" + userCalendar.getId());
}
return provider.createEvent(calendar.getId(), summary, description, status, attendees, new DefaultCalendarEventTemporalField(start, startTimeZone), new DefaultCalendarEventTemporalField(end, endTimeZone), reminders, recurrence, allDay);
}
use of fi.otavanopisto.muikku.calendar.CalendarServiceProvider in project muikku by otavanopisto.
the class CalendarController method listCalendarEvents.
public List<fi.otavanopisto.muikku.calendar.CalendarEvent> listCalendarEvents(UserCalendar userCalendar, OffsetDateTime timeMin, OffsetDateTime timeMax) throws CalendarServiceException {
CalendarServiceProvider provider = getCalendarServiceProvider(userCalendar.getCalendarProvider());
Calendar calendar = provider.findCalendar(userCalendar.getCalendarId());
if (calendar == null) {
throw new CalendarServiceException("Could not find calendar for user calendar #" + userCalendar.getId());
}
if (timeMin != null || timeMax != null) {
return provider.listEvents(timeMin, timeMax, calendar.getId());
} else {
return provider.listEvents(calendar.getId());
}
}
use of fi.otavanopisto.muikku.calendar.CalendarServiceProvider in project muikku by otavanopisto.
the class CalendarController method deleteCalendarEvent.
public void deleteCalendarEvent(UserCalendar userCalendar, String eventId) throws CalendarServiceException {
CalendarServiceProvider provider = getCalendarServiceProvider(userCalendar.getCalendarProvider());
Calendar calendar = provider.findCalendar(userCalendar.getCalendarId());
if (calendar == null) {
throw new CalendarServiceException("Could not find calendar for user calendar #" + userCalendar.getId());
}
provider.deleteEvent(calendar, eventId);
}
Aggregations