public static void showPicasaGallery(Long id, String name) {
    notFoundIfNull(id);
    PicasaGallery gallery = PicasaGallery.findById(id);
    notFoundIfNull(gallery);

    PicasawebService service = new PicasawebService("portfolio");
    List<PhotoEntry> photoEntries = Collections.emptyList();
    try {
      java.net.URL feedUrl = new java.net.URL(gallery.getFeedUrl());

      AlbumFeed feed = service.getFeed(feedUrl, AlbumFeed.class);
      photoEntries = feed.getPhotoEntries();
    } catch (MalformedURLException e) {
      Logger.error("Service URL for Picasa is not well formed");
      e.printStackTrace();
    } catch (IOException e) {
      Logger.error("Error I/O while communicating with Picasa Service");
      e.printStackTrace();
    } catch (ServiceException e) {
      Logger.error("Picasa service error");
      e.printStackTrace();
    }

    List<ImageView> images = new ArrayList<ImageView>();
    for (PhotoEntry entry : photoEntries) {
      ImageView image = new ImageView();
      // We take the largest
      image.thumbnail =
          entry.getMediaThumbnails().get(entry.getMediaThumbnails().size() - 1).getUrl();
      image.url = entry.getMediaContents().get(0).getUrl();
      images.add(image);
    }

    render("Application/gallery.html", images, gallery);
  }
 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);
   }
 }
 /**
  * @throws PicasaCommandException
  * @see com.jdevelop.jpicasa.commands.PicasaCommandInterface#execute()
  */
 public AlbumEntry execute() throws PicasaCommandException {
   try {
     final PicasawebService service = ctx.getService();
     final URL albumUrl = new URL(PicasaUrlBuilder.getUserURL(ctx));
     final AlbumEntry newAlbum = new AlbumEntry();
     newAlbum.setTitle(new PlainTextConstruct(albumName));
     final AlbumEntry insertedAlbum = service.insert(albumUrl, newAlbum);
     return insertedAlbum;
   } catch (final Exception e) {
     throw new PicasaCommandException(e);
   }
 }