private String getFirstSync(AccessToken at, Request request, XmlResponder responder) throws ServerFault, NotAllowedException { EventChanges ret = binding.getFirstSync( at, getCalendar(request), DateHelper.asDate(request.getParameter("lastSync"))); return responder.sendCalendarChanges(ret); }
private String getAllEvents(AccessToken at, Request request, XmlResponder responder) throws ServerFault { List<Event> e = binding.getAllEvents( at, getCalendar(request), EventType.valueOf(request.getParameter("eventType"))); return responder.sendListEvent(e); }
private String getRefusedKeys(AccessToken at, Request request, XmlResponder responder) throws ServerFault, NotAllowedException { KeyList ret = binding.getRefusedKeys( at, getCalendar(request), DateHelper.asDate(request.getParameter("since"))); return responder.sendKeyList(ret); }
private String getFreeBusy(AccessToken at, Request request, XmlResponder responder) throws SAXException, IOException, FactoryConfigurationError, ServerFault { String fbAsString = request.getParameter("freebusyrequest"); Document doc = DOMUtils.parse(fbAsString); FreeBusyRequest fb = cip.parseFreeBusyRequest(doc.getDocumentElement()); List<FreeBusy> ev = binding.getFreeBusy(at, fb); return responder.sendListFreeBusy(ev); }
private String parseFreeBusyToICS(AccessToken at, Request request, XmlResponder responder) throws SAXException, IOException, FactoryConfigurationError, ServerFault { String fbAsString = request.getParameter("freebusy"); Document doc = DOMUtils.parse(fbAsString); FreeBusy fb = cip.parseFreeBusy(doc.getDocumentElement()); String ics = binding.parseFreeBusyToICS(at, fb); return responder.sendString(ics); }
private String importICalendar( final AccessToken token, final Request request, XmlResponder responder, String clientId) throws ImportICalendarException, ServerFault, NotAllowedException { final String calendar = request.getParameter("calendar"); final String ics = request.getParameter("ics"); int countEvent = binding.importICalendar(token, calendar, ics, clientId); return responder.sendInt(countEvent); }
private String getListEventsFromIntervalDate( AccessToken at, Request request, XmlResponder responder) throws ServerFault, NotAllowedException { List<Event> e = binding.getListEventsFromIntervalDate( at, getCalendar(request), DateHelper.asDate(request.getParameter("start")), DateHelper.asDate(request.getParameter("end"))); return responder.sendListEvent(e); }
private Boolean getRecursive(Request request) { String recursiveParam = request.getParameter("recursive"); if (recursiveParam != null) { return Boolean.valueOf(recursiveParam); } return true; }
private boolean getNotificationOption(Request request) { String notificationParam = request.getParameter("notification"); if (notificationParam != null) { return Boolean.valueOf(notificationParam); } return true; }
private String getSyncInRange(AccessToken at, Request request, XmlResponder responder) throws ServerFault, NotAllowedException { final Date after = DateHelper.asDate(request.getParameter("syncRangeAfter")); final Date before = DateHelper.asDate(request.getParameter("syncRangeBefore")); SyncRange syncRange = null; if (after != null || before != null) { syncRange = new SyncRange(before, after); } EventChanges ret = binding.getSyncInRange( at, getCalendar(request), DateHelper.asDate(request.getParameter("lastSync")), syncRange); return responder.sendCalendarChanges(ret); }
private RecurrenceId getRecurrenceId(Request request) { String recurrenceIdParam = request.getParameter("recurrenceId"); if (recurrenceIdParam != null) { return new RecurrenceId(recurrenceIdParam); } return null; }
private String modifyEvent(AccessToken at, Request request, XmlResponder responder) throws ServerFault, SAXException, IOException, FactoryConfigurationError, NotAllowedException, PermissionException { Event ev = binding.modifyEvent( at, getCalendar(request), getEvent(request), Boolean.valueOf(request.getParameter("updateAttendees")), getNotificationOption(request)); if (ev != null) { return responder.sendEvent(ev); } return responder.sendError("Event did not exist."); }
private EventObmId getObmId(Request request, String tagName) { return new EventObmId(request.getParameter(tagName)); }
private String getResourceMetadata(AccessToken at, Request request, XmlResponder responder) throws ServerFault { return responder.sendResourceInformation( binding.getResourceMetadata(at, request.getParameterValues("resource"))); }
private String parseICSFreeBusy(AccessToken at, Request request, XmlResponder responder) throws ServerFault { String ics = request.getParameter("ics"); FreeBusyRequest freeBusy = binding.parseICSFreeBusy(at, ics); return responder.sendFreeBusyRequest(freeBusy); }
private String getCalendarMetadata(AccessToken at, Request request, XmlResponder responder) throws ServerFault { return responder.sendCalendarInformations( binding.getCalendarMetadata(at, request.getParameterValues("calendar"))); }
private int getOffset(Request request) { String offset = request.getParameter("offset"); return Strings.isNullOrEmpty(offset) ? 0 : Integer.parseInt(offset); }
private Participation getParticipation(Request request) { return Participation.builder() .state(State.getValueOf(request.getParameter("state"))) .comment(request.getParameter("comment")) .build(); }
private String getCalendar(Request request) { return request.getParameter("calendar"); }
private String parseICS(AccessToken at, Request request, XmlResponder responder) throws ServerFault, Exception { String ics = request.getParameter("ics"); List<Event> events = binding.parseICS(at, ics); return responder.sendListEvent(events); }
private Integer getLimit(Request request) { String limit = request.getParameter("limit"); return Strings.isNullOrEmpty(limit) ? null : Integer.valueOf(limit); }
private String getClientId(Request request) { return request.getParameter("clientId"); }
private String getPattern(Request request) { return request.getParameter("pattern"); }
private String searchAndInvokeMethod(Request request, XmlResponder responder, AccessToken at) throws ServerFault, SAXException, IOException, FactoryConfigurationError, Exception { String method = request.getMethod(); if (method.equals("getSync")) { return getSync(at, request, responder); } else if (method.equals("getFirstSync")) { return getFirstSync(at, request, responder); } else if (method.equals("getSyncInRange")) { return getSyncInRange(at, request, responder); } else if (method.equals("getSyncWithSortedChanges")) { return getSyncWithSortedChanges(at, request, responder); } else if (method.equals("getSyncEventDate")) { return getSyncEventDate(at, request, responder); } else if (method.equals("getFirstSyncEventDate")) { return getFirstSyncEventDate(at, request, responder); } else if (method.equals("removeEvent")) { return removeEvent(at, request, responder); } else if (method.equals("removeEventByExtId")) { return removeEventByExtId(at, request, responder); } else if (method.equals("modifyEvent")) { return modifyEvent(at, request, responder); } else if (method.equals("createEvent")) { return createEvent(at, request, responder); } else if (method.equals("getEventFromId")) { return getEventFromId(at, request, responder); } else if (method.equals("listCalendars")) { return listCalendars(at, request, responder); } else if (method.equals("listResources")) { return listResources(at, request, responder); } else if (method.equals("listCategories")) { return listCategories(at, responder); } else if (method.equals("getEventTwinKeys")) { return getEventTwinKeys(at, request, responder); } else if (method.equals("getRefusedKeys")) { return getRefusedKeys(at, request, responder); } else if (method.equals("getUserEmail")) { return getUserEmail(at, responder); } else if (method.equals("getEventFromExtId")) { return getEventFromExtId(at, request, responder); } else if (method.equals("getEventObmIdFromExtId")) { return getEventObmIdFromExtId(at, request, responder); } else if (method.equals("getListEventsFromIntervalDate")) { return getListEventsFromIntervalDate(at, request, responder); } else if (method.equals("getAllEvents")) { return getAllEvents(at, request, responder); } else if (method.equals("parseEvent")) { return parseEvent(at, request, responder); } else if (method.equals("parseEvents")) { return parseEvents(at, request, responder); } else if (method.equals("parseICS")) { return parseICS(at, request, responder); } else if (method.equals("parseICSFreeBusy")) { return parseICSFreeBusy(at, request, responder); } else if (method.equals("getLastUpdate")) { return getLastUpdate(at, request, responder); } else if (method.equals("isWritableCalendar")) { return isWritableCalendar(at, request, responder); } else if (method.equals("getFreeBusy")) { return getFreeBusy(at, request, responder); } else if (method.equals("parseFreeBusyToICS")) { return parseFreeBusyToICS(at, request, responder); } else if (method.equals("changeParticipationState")) { return changeParticipationState(at, request, responder); } else if (method.equals("importICalendar")) { return importICalendar(at, request, responder, null); } else if (method.equals("purge")) { return purge(at, request, responder); } else if (method.equals("getCalendarMetadata")) { return getCalendarMetadata(at, request, responder); } else if (method.equals("getResourceMetadata")) { return getResourceMetadata(at, request, responder); } else if (method.equals("storeEvent")) { return storeEvent(at, request, responder); } else { logger.error("cannot handle method '" + method + "'"); return ""; } }