Search in sources :

Example 1 with CalendarHandler

use of org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler in project openmeetings by apache.

the class AppointmentManager method syncItem.

/**
 * Function which when called performs syncing based on the type of Syncing detected.
 *
 * @param client - {@link HttpClient} to discover calendar
 * @param calendar Calendar who's sync has to take place
 */
public void syncItem(HttpClient client, OmCalendar calendar) {
    cleanupIdleConnections();
    if (calendar.getSyncType() != SyncType.NONE) {
        CalendarHandler calendarHandler;
        String path = getPathfromCalendar(client, calendar);
        switch(calendar.getSyncType()) {
            case WEBDAV_SYNC:
                calendarHandler = new WebDAVSyncHandler(path, calendar, client, appointmentDao, utils);
                break;
            case CTAG:
                calendarHandler = new CtagHandler(path, calendar, client, appointmentDao, utils);
                break;
            case ETAG:
            default:
                // Default is the EtagsHandler.
                calendarHandler = new EtagsHandler(path, calendar, client, appointmentDao, utils);
                break;
        }
        calendarHandler.syncItems();
        calendarDao.update(calendar);
    }
}
Also used : EtagsHandler(org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler) WebDAVSyncHandler(org.apache.openmeetings.service.calendar.caldav.handler.WebDAVSyncHandler) CalendarHandler(org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler) CtagHandler(org.apache.openmeetings.service.calendar.caldav.handler.CtagHandler)

Example 2 with CalendarHandler

use of org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler 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 3 with CalendarHandler

use of org.apache.openmeetings.service.calendar.caldav.handler.CalendarHandler 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

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