Search in sources :

Example 1 with CalendarEventAttendee

use of fi.otavanopisto.muikku.plugins.calendar.rest.model.CalendarEventAttendee in project muikku by otavanopisto.

the class CalendarRESTService method createEventRestModel.

private CalendarEvent createEventRestModel(UserCalendar userCalendar, fi.otavanopisto.muikku.calendar.CalendarEvent calendarEvent) {
    List<CalendarEventAttendee> attendees = new ArrayList<>();
    List<CalendarEventReminder> reminders = new ArrayList<>();
    if (calendarEvent.getAttendees() != null) {
        for (fi.otavanopisto.muikku.calendar.CalendarEventAttendee calendarEventAttendee : calendarEvent.getAttendees()) {
            attendees.add(new CalendarEventAttendee(calendarEventAttendee.getEmail(), calendarEventAttendee.getDisplayName(), calendarEventAttendee.getStatus(), calendarEventAttendee.getComment()));
        }
    }
    if (calendarEvent.getEventReminders() != null) {
        for (fi.otavanopisto.muikku.calendar.CalendarEventReminder calendarEventReminder : calendarEvent.getEventReminders()) {
            reminders.add(new CalendarEventReminder(calendarEventReminder.getType(), calendarEventReminder.getMinutesBefore()));
        }
    }
    String recurrence = calendarEvent.getRecurrence();
    String location = calendarEvent.getLocation() != null ? calendarEvent.getLocation().getLocation() : null;
    String videoCallLink = calendarEvent.getLocation() != null ? calendarEvent.getLocation().getVideoCallLink() : null;
    BigDecimal longitude = calendarEvent.getLocation() != null ? calendarEvent.getLocation().getLongitude() : null;
    BigDecimal latitude = calendarEvent.getLocation() != null ? calendarEvent.getLocation().getLatitude() : null;
    return new CalendarEvent(userCalendar.getId(), calendarEvent.getId(), calendarEvent.getSummary(), calendarEvent.getDescription(), calendarEvent.getUrl(), location, videoCallLink, longitude, latitude, calendarEvent.getStatus(), calendarEvent.getStart().getDateTime(), calendarEvent.getStart().getTimeZone(), calendarEvent.getEnd().getDateTime(), calendarEvent.getEnd().getTimeZone(), calendarEvent.isAllDay(), calendarEvent.getCreated(), calendarEvent.getUpdated(), calendarEvent.getExtendedProperties(), attendees, reminders, recurrence);
}
Also used : CalendarEventReminder(fi.otavanopisto.muikku.plugins.calendar.rest.model.CalendarEventReminder) DefaultCalendarEventReminder(fi.otavanopisto.muikku.calendar.DefaultCalendarEventReminder) ArrayList(java.util.ArrayList) DefaultCalendarEvent(fi.otavanopisto.muikku.calendar.DefaultCalendarEvent) CalendarEvent(fi.otavanopisto.muikku.plugins.calendar.rest.model.CalendarEvent) CalendarEventAttendee(fi.otavanopisto.muikku.plugins.calendar.rest.model.CalendarEventAttendee) DefaultCalendarEventAttendee(fi.otavanopisto.muikku.calendar.DefaultCalendarEventAttendee) BigDecimal(java.math.BigDecimal)

Aggregations

DefaultCalendarEvent (fi.otavanopisto.muikku.calendar.DefaultCalendarEvent)1 DefaultCalendarEventAttendee (fi.otavanopisto.muikku.calendar.DefaultCalendarEventAttendee)1 DefaultCalendarEventReminder (fi.otavanopisto.muikku.calendar.DefaultCalendarEventReminder)1 CalendarEvent (fi.otavanopisto.muikku.plugins.calendar.rest.model.CalendarEvent)1 CalendarEventAttendee (fi.otavanopisto.muikku.plugins.calendar.rest.model.CalendarEventAttendee)1 CalendarEventReminder (fi.otavanopisto.muikku.plugins.calendar.rest.model.CalendarEventReminder)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1