Beispiel #1
1
 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);
 }
Beispiel #2
1
 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);
 }
Beispiel #3
1
 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);
 }
Beispiel #4
1
 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);
 }
Beispiel #5
1
 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);
 }
Beispiel #6
0
  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);
  }
Beispiel #7
0
  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);
  }
Beispiel #8
0
 private Boolean getRecursive(Request request) {
   String recursiveParam = request.getParameter("recursive");
   if (recursiveParam != null) {
     return Boolean.valueOf(recursiveParam);
   }
   return true;
 }
Beispiel #9
0
 private boolean getNotificationOption(Request request) {
   String notificationParam = request.getParameter("notification");
   if (notificationParam != null) {
     return Boolean.valueOf(notificationParam);
   }
   return true;
 }
Beispiel #10
0
 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);
 }
Beispiel #11
0
 private RecurrenceId getRecurrenceId(Request request) {
   String recurrenceIdParam = request.getParameter("recurrenceId");
   if (recurrenceIdParam != null) {
     return new RecurrenceId(recurrenceIdParam);
   }
   return null;
 }
Beispiel #12
0
 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.");
 }
Beispiel #13
0
 private EventObmId getObmId(Request request, String tagName) {
   return new EventObmId(request.getParameter(tagName));
 }
Beispiel #14
0
 private String getResourceMetadata(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault {
   return responder.sendResourceInformation(
       binding.getResourceMetadata(at, request.getParameterValues("resource")));
 }
Beispiel #15
0
 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);
 }
Beispiel #16
0
 private String getCalendarMetadata(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault {
   return responder.sendCalendarInformations(
       binding.getCalendarMetadata(at, request.getParameterValues("calendar")));
 }
Beispiel #17
0
  private int getOffset(Request request) {
    String offset = request.getParameter("offset");

    return Strings.isNullOrEmpty(offset) ? 0 : Integer.parseInt(offset);
  }
Beispiel #18
0
 private Participation getParticipation(Request request) {
   return Participation.builder()
       .state(State.getValueOf(request.getParameter("state")))
       .comment(request.getParameter("comment"))
       .build();
 }
Beispiel #19
0
 private String getCalendar(Request request) {
   return request.getParameter("calendar");
 }
Beispiel #20
0
 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);
 }
Beispiel #21
0
  private Integer getLimit(Request request) {
    String limit = request.getParameter("limit");

    return Strings.isNullOrEmpty(limit) ? null : Integer.valueOf(limit);
  }
Beispiel #22
0
 private String getClientId(Request request) {
   return request.getParameter("clientId");
 }
Beispiel #23
0
 private String getPattern(Request request) {
   return request.getParameter("pattern");
 }
Beispiel #24
0
 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 "";
   }
 }