use of fi.otavanopisto.muikku.calendar.CalendarEvent in project muikku by otavanopisto.
the class GoogleCalendarClient method listEvents.
public List<CalendarEvent> listEvents(java.time.OffsetDateTime minTime, java.time.OffsetDateTime maxTime, String... calendarId) throws CalendarServiceException {
ArrayList<CalendarEvent> result = new ArrayList<>();
for (String calId : calendarId) {
try {
for (Event event : getClient().events().list(calId).setTimeMin(minTime != null ? new DateTime(minTime.toInstant().toEpochMilli()) : null).setTimeMax(maxTime != null ? new DateTime(maxTime.toInstant().toEpochMilli()) : null).execute().getItems()) {
result.add(toMuikkuEvent(calId, event));
logger.log(Level.INFO, event.toPrettyString());
}
} catch (GeneralSecurityException | IOException ex) {
throw new CalendarServiceException(ex);
}
}
return result;
}
Aggregations