Package com.google.gdata.data.calendar

Examples of com.google.gdata.data.calendar.CalendarEventFeed


    DateTime startTime = DateTime.now();
    partialQuery.setMinimumStartTime(startTime);
    partialQuery.setMaximumStartTime(
        new DateTime(startTime.getValue() + 604800000, startTime.getTzShift()));

    CalendarEventFeed events = service.query(
        partialQuery, CalendarEventFeed.class);
    for (CalendarEventEntry event : events.getEntries()) {
      String eventId = event.getId()
          .substring(event.getId().lastIndexOf("/") + 1);
      String attendeeStatus =
          event.getParticipants().get(0).getAttendeeStatus();
      OUT.println(eventId + ": " + event.getTitle().getPlainText()
View Full Code Here


   * @throws IOException Error communicating with the server.
   */
  private static void printAllEvents(CalendarService service)
      throws ServiceException, IOException {
    // Send the request and receive the response:
    CalendarEventFeed resultFeed = service.getFeed(eventFeedUrl,
        CalendarEventFeed.class);

    System.out.println("All events on your calendar:");
    System.out.println();
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      CalendarEventEntry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }
    System.out.println();
  }
View Full Code Here

  private static void fullTextQuery(CalendarService service, String query)
      throws ServiceException, IOException {
    Query myQuery = new Query(eventFeedUrl);
    myQuery.setFullTextQuery("Tennis");

    CalendarEventFeed resultFeed = service.query(myQuery,
        CalendarEventFeed.class);

    System.out.println("Events matching " + query + ":");
    System.out.println();
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      CalendarEventEntry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }
    System.out.println();
  }
View Full Code Here

    CalendarQuery myQuery = new CalendarQuery(eventFeedUrl);
    myQuery.setMinimumStartTime(startTime);
    myQuery.setMaximumStartTime(endTime);

    // Send the request and receive the response:
    CalendarEventFeed resultFeed = service.query(myQuery,
        CalendarEventFeed.class);

    System.out.println("Events from " + startTime.toString() + " to "
        + endTime.toString() + ":");
    System.out.println();
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      CalendarEventEntry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }
    System.out.println();
  }
View Full Code Here

  private static void deleteEvents(CalendarService service,
      List<CalendarEventEntry> eventsToDelete) throws ServiceException,
      IOException {

    // Add each item in eventsToDelete to the batch request.
    CalendarEventFeed batchRequest = new CalendarEventFeed();
    for (int i = 0; i < eventsToDelete.size(); i++) {
      CalendarEventEntry toDelete = eventsToDelete.get(i);
      // Modify the entry toDelete with batch ID and operation type.
      BatchUtils.setBatchId(toDelete, String.valueOf(i));
      BatchUtils.setBatchOperationType(toDelete, BatchOperationType.DELETE);
      batchRequest.getEntries().add(toDelete);
    }

    // Get the URL to make batch requests to
    CalendarEventFeed feed = service.getFeed(eventFeedUrl,
        CalendarEventFeed.class);
    Link batchLink = feed.getLink(Link.Rel.FEED_BATCH, Link.Type.ATOM);
    URL batchUrl = new URL(batchLink.getHref());

    // Submit the batch request
    CalendarEventFeed batchResponse = service.batch(batchUrl, batchRequest);

    // Ensure that all the operations were successful.
    boolean isSuccess = true;
    for (CalendarEventEntry entry : batchResponse.getEntries()) {
      String batchId = BatchUtils.getBatchId(entry);
      if (!BatchUtils.isSuccess(entry)) {
        isSuccess = false;
        BatchStatus status = BatchUtils.getBatchStatus(entry);
        System.out.println("\n" + batchId + " failed (" + status.getReason()
View Full Code Here

          cal.add(Calendar.MONTH, -2);
          myQuery.setMaxResults(100);
          myQuery.setIntegerCustomParameter("max-results", 100);

          // Send the request and receive the response:
          CalendarEventFeed resultFeed = service.query(myQuery,
              CalendarEventFeed.class);

          for (CalendarEventEntry eventEntry : resultFeed
              .getEntries()) {
            for (When curTime : eventEntry.getTimes()) {
              Event event = new Event();
              event.setKey(curSettingEntry.getKey());
              event.setTitle(eventEntry.getTitle().getPlainText());
View Full Code Here

  /**
   * @{inheritDoc}
   */
  @Override
  protected void execute() {
    CalendarEventFeed myFeed = downloadEventFeed(username, password, url, refreshInterval);
    if (myFeed != null) {
      List<CalendarEventEntry> entries = myFeed.getEntries();
     
      if (entries.size() > 0) {
        logger.debug("found {} calendar events to process", entries.size());
       
        try {
View Full Code Here

      if (StringUtils.isNotBlank(filter)) {
        myQuery.setFullTextQuery(filter);
      }
 
      logger.debug("Downloading calendar feed for time interval: {} to  {} ", start, end);
      CalendarEventFeed feed = myService.getFeed(myQuery, CalendarEventFeed.class);
      if (feed != null) {
        checkIfFullCalendarFeed(feed.getEntries());
      }
     
      return feed;
    }
    catch (AuthenticationException ae) {
View Full Code Here

TOP

Related Classes of com.google.gdata.data.calendar.CalendarEventFeed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.