Search in sources :

Example 1 with SyncType

use of org.apache.openmeetings.db.entity.calendar.OmCalendar.SyncType in project openmeetings by apache.

the class AppointmentManager method deleteItem.

/**
 * Delete Appointment on the CalDAV server.
 * Delete's on the Server only if the ETag of the Appointment is the one on the server,
 * i.e. only if the Event hasn't changed on the Server.
 *
 * @param client - {@link HttpClient} to discover calendar
 * @param appointment Appointment to Delete
 * @return <code>true</code> in case item was deleted
 */
public boolean deleteItem(HttpClient client, Appointment appointment) {
    cleanupIdleConnections();
    OmCalendar calendar = appointment.getCalendar();
    SyncType type = calendar.getSyncType();
    if (type != SyncType.NONE && type != SyncType.GOOGLE_CALENDAR) {
        CalendarHandler calendarHandler;
        String path = getPathfromCalendar(client, calendar);
        switch(type) {
            case WEBDAV_SYNC:
            case CTAG:
            case ETAG:
                calendarHandler = new EtagsHandler(path, calendar, client, appointmentDao, utils);
                break;
            default:
                return false;
        }
        return calendarHandler.deleteItem(appointment);
    }
    return false;
}
Also used : SyncType(org.apache.openmeetings.db.entity.calendar.OmCalendar.SyncType) EtagsHandler(org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler) OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar) CalendarHandler(org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler)

Example 2 with SyncType

use of org.apache.openmeetings.db.entity.calendar.OmCalendar.SyncType in project openmeetings by apache.

the class AppointmentManager method updateItem.

/**
 * Function for create/updating multiple appointment on the server.
 * Performs modification alongside of creation new events on the server.
 *
 * @param client - {@link HttpClient} to discover calendar
 * @param appointment Appointment to create/update.
 * @return <code>true</code> in case item was updated
 */
public boolean updateItem(HttpClient client, Appointment appointment) {
    cleanupIdleConnections();
    OmCalendar calendar = appointment.getCalendar();
    SyncType type = calendar.getSyncType();
    if (type != SyncType.NONE && type != SyncType.GOOGLE_CALENDAR) {
        CalendarHandler calendarHandler;
        String path = ensureTrailingSlash(getPathfromCalendar(client, calendar));
        switch(type) {
            case WEBDAV_SYNC:
            case CTAG:
            case ETAG:
                calendarHandler = new EtagsHandler(path, calendar, client, appointmentDao, utils);
                break;
            default:
                return false;
        }
        return calendarHandler.updateItem(appointment);
    }
    return false;
}
Also used : SyncType(org.apache.openmeetings.db.entity.calendar.OmCalendar.SyncType) EtagsHandler(org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler) OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar) CalendarHandler(org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler)

Aggregations

OmCalendar (org.apache.openmeetings.db.entity.calendar.OmCalendar)2 SyncType (org.apache.openmeetings.db.entity.calendar.OmCalendar.SyncType)2 CalendarHandler (org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler)2 EtagsHandler (org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler)2