Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 3
1
  private String changeParticipationState(AccessToken at, Request request, XmlResponder responder)
      throws ServerFault, ParseException, EventNotFoundException, NotAllowedException {

    boolean recursive = getRecursive(request);
    boolean success = false;

    if (recursive) {
      success =
          binding.changeParticipationState(
              at,
              getCalendar(request),
              getExtId(request, "extId"),
              getParticipation(request),
              i(request, "sequence", 0),
              getNotificationOption(request));
    } else {
      success =
          binding.changeParticipationState(
              at,
              getCalendar(request),
              getExtId(request, "extId"),
              getRecurrenceId(request),
              getParticipation(request),
              i(request, "sequence", 0),
              getNotificationOption(request));
    }
    return responder.sendBoolean(success);
  }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
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);
 }
Exemplo n.º 7
0
  private String getEventObmIdFromExtId(AccessToken at, Request request, XmlResponder responder)
      throws ServerFault, EventNotFoundException, NotAllowedException {

    EventObmId id =
        binding.getEventObmIdFromExtId(at, getCalendar(request), getExtId(request, "extId"));
    if (id != null) {
      return responder.sendInt(id.getObmId());
    }
    return responder.sendError("not found");
  }
Exemplo n.º 8
0
 private String removeEventByExtId(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault, NotAllowedException {
   Event ev =
       binding.removeEventByExtId(
           at,
           getCalendar(request),
           getExtId(request, "extId"),
           i(request, "sequence", 0),
           getNotificationOption(request));
   if (ev != null) {
     return responder.sendEvent(ev);
   }
   return responder.sendError("Event did not exist.");
 }
Exemplo n.º 9
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.");
 }
Exemplo n.º 10
0
  private String removeEvent(AccessToken at, Request request, XmlResponder responder)
      throws ServerFault, EventNotFoundException, NotAllowedException {

    String calendar = getCalendar(request);
    EventObmId obmId = getObmId(request, "id");
    int sequence = i(request, "sequence", 0);
    binding.removeEventById(at, calendar, obmId, sequence, getNotificationOption(request));
    return responder.sendBoolean(true);
  }
Exemplo n.º 11
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);
  }
Exemplo n.º 12
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);
  }
Exemplo n.º 13
0
 private String createEvent(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault, SAXException, IOException, FactoryConfigurationError,
         EventAlreadyExistException, NotAllowedException, PermissionException {
   EventObmId ev =
       binding.createEvent(
           at,
           getCalendar(request),
           getEvent(request),
           getNotificationOption(request),
           getClientId(request));
   return responder.sendInt(ev.getObmId());
 }
Exemplo n.º 14
0
  private String storeEvent(AccessToken at, Request request, XmlResponder responder)
      throws ServerFault, SAXException, IOException, FactoryConfigurationError, NotAllowedException,
          PermissionException {
    Event event =
        binding.storeEvent(
            at,
            getCalendar(request),
            getEvent(request),
            getNotificationOption(request),
            getClientId(request));

    return responder.sendEvent(event);
  }
Exemplo n.º 15
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);
 }
Exemplo n.º 16
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);
 }
Exemplo n.º 17
0
 private String isWritableCalendar(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault {
   boolean ret = binding.isWritableCalendar(at, getCalendar(request));
   logger.info("isWritable(" + at.getUserEmail() + ", " + getCalendar(request) + ") => " + ret);
   return responder.sendBoolean(ret);
 }
Exemplo n.º 18
0
 private String getLastUpdate(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault, NotAllowedException {
   Date d = binding.getLastUpdate(at, getCalendar(request));
   return responder.sendLong(d.getTime());
 }
Exemplo n.º 19
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);
 }
Exemplo n.º 20
0
 private String parseEvent(AccessToken at, Request request, XmlResponder responder)
     throws SAXException, IOException, FactoryConfigurationError, ServerFault {
   Event event = getEvent(request);
   String ics = binding.parseEvent(at, event);
   return responder.sendString(ics);
 }
Exemplo n.º 21
0
 private String getEventFromId(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault, EventNotFoundException, NotAllowedException {
   Event e = binding.getEventFromId(at, getCalendar(request), getObmId(request, "id"));
   return responder.sendEvent(e);
 }
Exemplo n.º 22
0
 private String listResources(AccessToken at, Request req, XmlResponder responder)
     throws ServerFault {
   return responder.sendResourceInformation(
       binding.listResources(at, getLimit(req), getOffset(req), getPattern(req)));
 }
Exemplo n.º 23
0
 private String getResourceMetadata(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault {
   return responder.sendResourceInformation(
       binding.getResourceMetadata(at, request.getParameterValues("resource")));
 }
Exemplo n.º 24
0
 private String purge(final AccessToken at, final Request request, final XmlResponder responder)
     throws ServerFault, NotAllowedException {
   binding.purge(at, getCalendar(request));
   return responder.sendBoolean(true);
 }
Exemplo n.º 25
0
 private String listCategories(AccessToken at, XmlResponder responder) throws ServerFault {
   List<Category> ret = binding.listCategories(at);
   return responder.sendCategories(ret);
 }
Exemplo n.º 26
0
 private String getUserEmail(AccessToken at, XmlResponder responder) throws ServerFault {
   String ue = binding.getUserEmail(at);
   return responder.sendString(ue);
 }
Exemplo n.º 27
0
 private String getEventTwinKeys(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault, SAXException, IOException, FactoryConfigurationError,
         NotAllowedException {
   KeyList kl = binding.getEventTwinKeys(at, getCalendar(request), getEvent(request));
   return responder.sendKeyList(kl);
 }
Exemplo n.º 28
0
 private String getCalendarMetadata(AccessToken at, Request request, XmlResponder responder)
     throws ServerFault {
   return responder.sendCalendarInformations(
       binding.getCalendarMetadata(at, request.getParameterValues("calendar")));
 }