Package com.google.gdata.data.calendar

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


        "@gd:etag,title,gd:who[@email='" + uname + "']";

    Query partialQuery = new Query(new URL(eventEntryUrl));
    partialQuery.setFields(selectAttendee);

    CalendarEventEntry event = service.getEntry(partialQuery.getUrl(),
        CalendarEventEntry.class);
    // The participant list will contain exactly one attendee matching
    // above partial query selection criteria.
    event.getParticipants().get(0).setAttendeeStatus(selection);

    // Field selection to update attendeeStatus only.
    String toUpdateFields = "gd:who/gd:attendeeStatus";

    // Make patch request which returns full representation for the event.
    event = service.patch(
        new URL(eventEntryUrl), toUpdateFields, event);

    // Print the updated attendee status.
    OUT.println(event.getTitle().getPlainText() + " updated to: "
        + event.getParticipants().get(0).getAttendeeStatus());
  }
View Full Code Here


        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

        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

    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

   * @throws IOException Error communicating with the server.
   */
  private static CalendarEventEntry createEvent(CalendarService service,
      String eventTitle, String eventContent, String recurData,
      boolean isQuickAdd, WebContent wc) throws ServiceException, IOException {
    CalendarEventEntry myEntry = new CalendarEventEntry();

    myEntry.setTitle(new PlainTextConstruct(eventTitle));
    myEntry.setContent(new PlainTextConstruct(eventContent));
    myEntry.setQuickAdd(isQuickAdd);
    myEntry.setWebContent(wc);

    // If a recurrence was requested, add it. Otherwise, set the
    // time (the current date and time) and duration (30 minutes)
    // of the event.
    if (recurData == null) {
      Calendar calendar = new GregorianCalendar();
      DateTime startTime = new DateTime(calendar.getTime(), TimeZone
          .getDefault());

      calendar.add(Calendar.MINUTE, 30);
      DateTime endTime = new DateTime(calendar.getTime(),
          TimeZone.getDefault());

      When eventTimes = new When();
      eventTimes.setStartTime(startTime);
      eventTimes.setEndTime(endTime);
      myEntry.addTime(eventTimes);
    } else {
      Recurrence recur = new Recurrence();
      recur.setValue(recurData);
      myEntry.setRecurrence(recur);
    }

    // Send the request and receive the response:
    return service.insert(eventFeedUrl, myEntry);
  }
View Full Code Here

      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);
    }
View Full Code Here

      fullTextQuery(myService, "Tennis");
      dateRangeQuery(myService, DateTime.parseDate("2007-01-05"), DateTime
          .parseDate("2007-01-07"));

      // Demonstrate creating a single-occurrence event.
      CalendarEventEntry singleEvent = createSingleEvent(myService,
          "Tennis with Mike", "Meet for a quick lesson.");
      System.out.println("Successfully created event "
          + singleEvent.getTitle().getPlainText());

      // Demonstrate creating a quick add event.
      CalendarEventEntry quickAddEvent = createQuickAddEvent(myService,
          "Tennis with John April 11 3pm-3:30pm");
      System.out.println("Successfully created quick add event "
          + quickAddEvent.getTitle().getPlainText());

      // Demonstrate creating a web content event.
      CalendarEventEntry webContentEvent = createWebContentEvent(myService,
          "World Cup", "image/gif",
          "http://www.google.com/logos/worldcup06.gif",
          "http://www.google.com/calendar/images/google-holiday.gif", "276",
          "120");
      System.out.println("Successfully created web content event "
          + webContentEvent.getTitle().getPlainText());

      // Demonstrate creating a recurring event.
      CalendarEventEntry recurringEvent = createRecurringEvent(myService,
          "Tennis with Dan", "Weekly tennis lesson.");
      System.out.println("Successfully created recurring event "
          + recurringEvent.getTitle().getPlainText());

      // Demonstrate updating the event's text.
      singleEvent = updateTitle(singleEvent, "Important meeting");
      System.out.println("Event's new title is \""
          + singleEvent.getTitle().getPlainText() + "\".");
View Full Code Here

    }
   
    private void upload(CalendarEventEntry entry) {
      try {
        long startTime = System.currentTimeMillis();
        CalendarEventEntry createdEvent = createCalendarEvent(username, password, url, entry);
        logger.debug("succesfully created new calendar event (title='{}', date='{}', content='{}') in {}ms",
          new Object[] { createdEvent.getTitle().getPlainText(),
          createdEvent.getTimes().get(0).getStartTime().toString(),
          createdEvent.getPlainTextContent(),
          System.currentTimeMillis() - startTime});
      }
      catch (AuthenticationException ae) {
        logger.error("authentication failed: {}", ae.getMessage());
      }
View Full Code Here

   */
  public void store(final Item item, final String alias) {
    if (initialized) {
      String newAlias = alias != null ? alias : item.getName();
     
      CalendarEventEntry myEntry = new CalendarEventEntry();
        myEntry.setTitle(new PlainTextConstruct("[PresenceSimulation] " + newAlias));
        myEntry.setContent(new PlainTextConstruct(String.format(
          executeScript, item.getName(), item.getState().toString())));

      DateTime nowPlusOffset = new DateTime().plusDays(offset);
     
      com.google.gdata.data.DateTime time =
        com.google.gdata.data.DateTime.parseDateTime(nowPlusOffset.toString());
      When eventTimes = new When();
        eventTimes.setStartTime(time);
        eventTimes.setEndTime(time);
      myEntry.addTime(eventTimes);
     
      entries.offer(myEntry);
     
      logger.trace("added new entry '{}' for item '{}' to upload queue", myEntry.getTitle().getPlainText(), item.getName());
    } else {
      logger.debug("GCal PresenceSimulation Service isn't initialized properly! No entries will be uploaded to your Google Calendar");
    }
  }
View Full Code Here

   *
   * @param entries the set to check
   */
  private static void checkIfFullCalendarFeed(List<CalendarEventEntry> entries) {
    if (entries != null && !entries.isEmpty()) {
      CalendarEventEntry referenceEvent = entries.get(0);
      if (referenceEvent.getIcalUID() == null || referenceEvent.getTimes().isEmpty()) {
        logger.warn("calender entries are incomplete - please make sure to use the full calendar feed");
      }
     
    }
  }
View Full Code Here

TOP

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

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.