public ImplRaceDriverService() throws IOException, ServiceException { drivers = new ArrayList<RaceDriver>(); Query myQuery = new Query(feedURL); myQuery.setStringCustomParameter("kind", "photo"); myQuery.setStringCustomParameter("tag", "Driver"); AlbumFeed feed = picasawebService.query(myQuery, AlbumFeed.class); for (PhotoEntry photo : feed.getPhotoEntries()) { RaceDriver driver = new RaceDriver(); driver.setName(photo.getDescription().getPlainText()); driver.setUrl(photo.getMediaContents().get(0).getUrl()); Query tagQuery = new Query( new URL( "https://picasaweb.google.com/data/feed/api/user/107302466601293793664/albumid/" + photo.getAlbumId() + "/photoid/" + photo.getGphotoId() + "?kind=tag")); AlbumFeed tags = picasawebService.query(tagQuery, AlbumFeed.class); for (TagEntry tag : tags.getTagEntries()) { if (tag.getTitle().getPlainText().startsWith("wiki:")) { driver.setWikiUrl(tag.getTitle().getPlainText().substring(5)); } } drivers.add(driver); } }
public void printAllContacts() throws ServiceException, IOException { // Request the feed setService(); URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/[email protected]/full"); Query myQuery = new Query(feedUrl); myQuery.setMaxResults(8); myQuery.setStringCustomParameter("group", "Business Contacts"); ContactFeed resultFeed = myService.query(myQuery, ContactFeed.class); // Print the results System.out.println(resultFeed.getTitle().getPlainText()); for (int i = 0; i < resultFeed.getEntries().size(); i++) { ContactEntry entry = resultFeed.getEntries().get(i); Name test = entry.getName(); FullName namee = test.getFullName(); People person = peopleRepo.save( new People(23, entry.getTitle().getPlainText(), entry.getTitle().getPlainText())); System.out.println(person.getNodeId().toString()); System.out.println("\t" + entry.getTitle().getPlainText()); System.out.println("Email addresses:"); for (com.google.gdata.data.extensions.Email email : entry.getEmailAddresses()) { System.out.print(" " + email.getAddress()); if (email.getRel() != null) { System.out.print(" rel:" + email.getRel()); } if (email.getLabel() != null) { System.out.print(" label:" + email.getLabel()); } if (email.getPrimary()) { System.out.print(" (primary) "); } System.out.print("\n"); } System.out.println("IM addresses:"); for (Im im : entry.getImAddresses()) { System.out.print(" " + im.getAddress()); if (im.getLabel() != null) { System.out.print(" label:" + im.getLabel()); } if (im.getRel() != null) { System.out.print(" rel:" + im.getRel()); } if (im.getProtocol() != null) { System.out.print(" protocol:" + im.getProtocol()); } if (im.getPrimary()) { System.out.print(" (primary) "); } System.out.print("\n"); } System.out.println("Groups:"); for (GroupMembershipInfo group : entry.getGroupMembershipInfos()) { String groupHref = group.getHref(); System.out.println(" Id: " + groupHref); } System.out.println("Extended Properties:"); for (ExtendedProperty property : entry.getExtendedProperties()) { if (property.getValue() != null) { System.out.println(" " + property.getName() + "(value) = " + property.getValue()); } else if (property.getXmlBlob() != null) { System.out.println( " " + property.getName() + "(xmlBlob)= " + property.getXmlBlob().getBlob()); } } String photoLink = entry.getContactPhotoLink().getHref(); System.out.println("Photo Link: " + photoLink); System.out.println("Contact's ETag: " + entry.getEtag()); } }