use of org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler 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);
}
}
use of org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler 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;
}
use of org.apache.openmeetings.service.calendar.caldav.handler.EtagsHandler 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;
}
Aggregations