Search in sources :

Example 1 with Delete

use of com.google.api.services.calendar.Calendar.Events.Delete in project drbookings by DrBookings.

the class GoogleCalendarSync method clearEvent.

private static void clearEvent(final String calendarId, final Event event) throws IOException {
    if (isDrBookingEvent(event)) {
        if (logger.isInfoEnabled()) {
            logger.info("Deleting " + event.getSummary());
        }
        final Delete d = client.events().delete(calendarId, event.getId());
        d.execute();
    }
}
Also used : Delete(com.google.api.services.calendar.Calendar.Events.Delete)

Example 2 with Delete

use of com.google.api.services.calendar.Calendar.Events.Delete in project drbookings by DrBookings.

the class GoogleCalendarSync method clearEvent.

private static void clearEvent(final String calendarId, final BookingBean b) throws IOException {
    for (final Iterator<String> it = b.getCalendarIds().iterator(); it.hasNext(); ) {
        final String id = it.next();
        final Delete d = client.events().delete(calendarId, id);
        if (logger.isDebugEnabled()) {
            logger.debug("Deleting " + d.getEventId());
        }
        try {
            d.execute();
        } catch (final GoogleJsonResponseException e) {
            if (logger.isErrorEnabled()) {
                logger.error(e.toString());
            }
        }
        it.remove();
    }
}
Also used : Delete(com.google.api.services.calendar.Calendar.Events.Delete) GoogleJsonResponseException(com.google.api.client.googleapis.json.GoogleJsonResponseException)

Aggregations

Delete (com.google.api.services.calendar.Calendar.Events.Delete)2 GoogleJsonResponseException (com.google.api.client.googleapis.json.GoogleJsonResponseException)1