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);
}
Aggregations