Package com.google.gdata.data.calendar

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


    GoogleService myService = new GoogleService("cl", "tvbrowser-tvbrowsercalenderplugin-" + CalendarExportPlugin.getInstance().getInfo().getVersion().toString());
    myService.setUserCredentials(settings.getExporterProperty(GoogleExporter.USERNAME).trim(), password);

    // Send the request and print the response
    URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/owncalendars/full");
    CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);

    DefaultComboBoxModel model = (DefaultComboBoxModel) mCalendarChooser.getModel();
    model.removeAllElements();

    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      CalendarEntry entry = resultFeed.getEntries().get(i);

      String id = entry.getId();
      id = StringUtils.substringAfterLast(id, "/");

      model.addElement(new GoogleComboboxItem(id, entry.getTitle().getPlainText()));
View Full Code Here


  if (oPrec.lines().size()>0) {
    if (DebugFile.trace)
      DebugFile.writeln("CalendarService.setUserCredentials("+oPrec.getValueOf("user")+", ...)");
      oCalSrv.setUserCredentials(oPrec.getValueOf("user"), oPrec.getValueOf("pwd"));
    URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/allcalendars/full");
    CalendarFeed oFeed = oCalSrv.getFeed(feedUrl, CalendarFeed.class);
    for (int i = 0; i < oFeed.getEntries().size() && !bCalendarFound; i++) {
        CalendarEntry oCalendar = oFeed.getEntries().get(i);
        bCalendarFound = oCalendar.getTitle().getPlainText().equals(oPrec.getValueOf("cal"));
    } // next
    if (bCalendarFound) {
      sEMail = oPrec.getValueOf("user");
    } else {
View Full Code Here

      URL calUrl = new URL ( CALENDAR_FEED_URL );

      // Get Number of calendars 
      Query calQuery = new Query(calUrl);
      calQuery.setMaxResults(1);    
      CalendarFeed calFeed = calService.query(calQuery, CalendarFeed.class);
      if (calFeed.getTotalResults() == 0) {
        System.out.println("No Calendars");
      } else {
        // Set Number of calendars for query
        calQuery.setMaxResults(calFeed.getTotalResults());
        calFeed = calService.query(calQuery, CalendarFeed.class)
      }
     
      // Search calendar
      System.out.println("Calendar to use for birthdays");
      for (CalendarEntry entry : calFeed.getEntries()) {
        if ( entry.getTitle().getPlainText().equals( CALENDAR_NAME ) ) {
          calEntry = entry;
        }
      }
      if (calEntry == null) {
        // No calendar found - Add a birthday calendar
        calEntry = new CalendarEntry();
        calEntry.setTitle(new PlainTextConstruct( CALENDAR_NAME ));
        calEntry.setSummary(new PlainTextConstruct( CALENDAR_SUMMARY ));
        calEntry.setTimeZone(calFeed.getEntries().get(0).getTimeZone());
        calEntry.setHidden(HiddenProperty.FALSE);
        calEntry.setColor(new ColorProperty( CALENDAR_COLOR ));
        calEntry.setSelected(SelectedProperty.TRUE);
        //calEntry.addLocation(new Where("", "", "Oakland"));
        //calEntry.addLocation(calFeed.getEntries().get(0).getLocations().);

          // Insert the calendar
        calService.insert(calUrl, calEntry);
        System.out.println("\tCreated: " + calEntry.getTitle().getPlainText());
        //Thread.sleep(5000);
        calQuery.setMaxResults(calFeed.getTotalResults()+1);
        calFeed = calService.query(calQuery, CalendarFeed.class)
        for (CalendarEntry entry : calFeed.getEntries()) {
          if ( entry.getTitle().getPlainText().equals( CALENDAR_NAME ) ) {
            calEntry = entry;
          }
        }
      }
View Full Code Here

   * @throws ServiceException If the service is unable to handle the request.
   * @throws IOException Error communicating with the server.
   */
  private static void printAclList(CalendarService service)
      throws ServiceException, IOException {
    CalendarFeed calendarFeed = service
        .getFeed(metafeedUrl, CalendarFeed.class);

    // After accessing the meta-feed, get the ACL link for each calendar.
    System.out.println("Access control lists for your calendars:");
    for (CalendarEntry calEntry : calendarFeed.getEntries()) {
      Link link = calEntry.getLink(AclNamespace.LINK_REL_ACCESS_CONTROL_LIST,
          Link.Type.ATOM);

      // For each calendar that exposes an access control list, retrieve its ACL
      // feed. If link is null, then we are not the owner of that calendar
View Full Code Here

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

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

   */
  private static void printUserCalendars(CalendarService service, URL feedUrl)
      throws IOException, ServiceException {

    // Send the request and receive the response:
    CalendarFeed resultFeed = service.getFeed(feedUrl, CalendarFeed.class);

    // Print the title of each calendar
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      CalendarEntry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }
  }
View Full Code Here

    public List<String> getCalendarNames(String accessToken, String accessTokenSecret) throws Exception {
        CalendarService calendarService = new CalendarService("apache-camel-2.3");
        OAuthParameters params = getOAuthParams(accessToken, accessTokenSecret);
        calendarService.setOAuthCredentials(params, new OAuthHmacSha1Signer());
        URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/");
        CalendarFeed resultFeed = calendarService.getFeed(feedUrl, CalendarFeed.class);

        ArrayList<String> result = new ArrayList<String>();
        for (int i = 0; i < resultFeed.getEntries().size(); i++) {
            CalendarEntry entry = resultFeed.getEntries().get(i);
            result.add(entry.getTitle().getPlainText());
        }
        return result;
    }
View Full Code Here

    public List<String> getCalendarNames(String accessToken, String accessTokenSecret) throws Exception {
        CalendarService calendarService = new CalendarService("apache-camel-2.3");
        OAuthParameters params = getOAuthParams(accessToken, accessTokenSecret);
        calendarService.setOAuthCredentials(params, new OAuthHmacSha1Signer());
        URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/");
        CalendarFeed resultFeed = calendarService.getFeed(feedUrl, CalendarFeed.class);

        List<String> result = new ArrayList<String>();
        for (int i = 0; i < resultFeed.getEntries().size(); i++) {
            CalendarEntry entry = resultFeed.getEntries().get(i);
            result.add(entry.getTitle().getPlainText());
        }
        return result;
    }
View Full Code Here

            service.setUserCredentials(username, password);

            CalendarQuery calendarQuery = new CalendarQuery(
                new URL(
                    "https://www.google.com/calendar/feeds/default/owncalendars/full"));
            CalendarFeed calendarFeed = service.query(
                calendarQuery, CalendarFeed.class);
            for (CalendarEntry curCalendar : calendarFeed
                .getEntries()) {
              if (curCalendar.getId().endsWith(
                  calendarId.replaceAll("@", "%40"))
                  && curCalendar.getColor() != null) {
                colorkey.setColor(curCalendar.getColor()
View Full Code Here

TOP

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

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.