@Test public void extractG2PictureFromPropertiesTest() throws GalleryConnectionException { HashMap<String, String> fetchImages = new HashMap<String, String>(); fetchImages.put("image.thumb_height.393", "150"); fetchImages.put("image.title.393", "picture.jpg"); fetchImages.put("image.resizedName.393", "12600"); fetchImages.put("image.resized_width.393", "800"); fetchImages.put("image.resized_height.393", "600"); fetchImages.put("image.raw_height.393", "2848"); fetchImages.put("image.caption.393", ""); fetchImages.put("image.name.393", "12598"); fetchImages.put("image.thumbName.393", "12599"); fetchImages.put("image.thumb_width.393", "150"); fetchImages.put("image.raw_width.393", "4288"); fetchImages.put("image.raw_filesize.393", "3400643"); fetchImages.put("image.caption.393", "caption"); fetchImages.put("image.forceExtension.393", "jpg"); fetchImages.put("image.hidden.393", "true"); fetchImages.put("image.clicks.393", "45"); fetchImages.put("image.capturedate.year.393", "2009"); fetchImages.put("image.capturedate.mon.393", "10"); fetchImages.put("image.capturedate.mday.393", "19"); fetchImages.put("image.capturedate.hours.393", "22"); fetchImages.put("image.capturedate.minutes.393", "45"); fetchImages.put("image.capturedate.seconds.393", "48"); fetchImages.put("image_count", "437"); fetchImages .put("baseurl", "http: Collection<G2Picture> pictures = g2ConnectionUtils .extractG2PicturesFromProperties(fetchImages); G2Picture picture = pictures.iterator().next(); assertEquals(150, picture.getThumbHeight()); assertEquals("picture.jpg", picture.getTitle()); assertEquals("12600", picture.getResizedName()); assertEquals(800, picture.getResizedWidth()); assertEquals(2848, picture.getRawHeight()); assertEquals("12598", picture.getName()); assertEquals("12599", picture.getThumbName()); assertEquals(150, picture.getThumbWidth()); assertEquals(4288, picture.getRawWidth()); assertEquals("caption", picture.getCaption()); assertEquals("jpg", picture.getForceExtension()); assertEquals(true, picture.isHidden()); }
public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, String> entry : fetchImages.entrySet()) { if (entry.getKey().contains("image") && !entry.getKey().contains("image_count")) { imageNumber = new Integer(entry.getKey().substring( entry.getKey().lastIndexOf(".") + 1)); G2Picture picture = null; if (!tmpImageNumbers.contains(imageNumber)) { picture = new G2Picture(); picture.setId(imageNumber); picturesMap.put(imageNumber, picture); tmpImageNumbers.add(imageNumber); } else { picture = picturesMap.get(imageNumber); } try { if (entry.getKey().contains("image.title.")) { picture.setTitle(entry.getValue()); } else if (entry.getKey().contains("image.thumbName.")) { picture.setThumbName(entry.getValue()); } else if (entry.getKey().contains("image.thumb_width.")) { picture.setThumbWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.thumb_height.")) { picture.setThumbHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resizedName.")) { picture.setResizedName(entry.getValue()); } else if (entry.getKey().contains("image.resized_width.")) { picture.setResizedWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resized_height.")) { picture.setResizedHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.name.")) { picture.setName( entry.getValue()); } else if (entry.getKey().contains("image.raw_width.")) { picture.setRawWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_height.")) { picture.setRawHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_filesize.")) { picture.setRawFilesize(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.caption.")) { picture.setCaption(entry.getValue()); } else if (entry.getKey().contains("image.forceExtension.")) { picture.setForceExtension(entry.getValue()); } else if (entry.getKey().contains("image.hidden.")) { picture.setHidden(Boolean.valueOf(entry.getValue())); } } catch (NumberFormatException nfe) { throw new GalleryConnectionException(nfe); } } } return picturesMap.values(); }
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, String> entry : fetchImages.entrySet()) { if (entry.getKey().contains("image") && !entry.getKey().contains("image_count")) { imageNumber = new Integer(entry.getKey().substring( entry.getKey().lastIndexOf(".") + 1)); G2Picture picture = null; if (!tmpImageNumbers.contains(imageNumber)) { picture = new G2Picture(); picture.setId(imageNumber); picturesMap.put(imageNumber, picture); tmpImageNumbers.add(imageNumber); } else { picture = picturesMap.get(imageNumber); } try { if (entry.getKey().contains("image.title.")) { picture.setTitle(entry.getValue()); } else if (entry.getKey().contains("image.thumbName.")) { picture.setThumbName(entry.getValue()); } else if (entry.getKey().contains("image.thumb_width.")) { picture.setThumbWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.thumb_height.")) { picture.setThumbHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resizedName.")) { picture.setResizedName(entry.getValue()); } else if (entry.getKey().contains("image.resized_width.")) { picture.setResizedWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resized_height.")) { picture.setResizedHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.name.")) { picture.setName( entry.getValue()); } else if (entry.getKey().contains("image.raw_width.")) { picture.setRawWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_height.")) { picture.setRawHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_filesize.")) { picture.setRawFilesize(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.caption.")) { picture.setCaption(entry.getValue()); } else if (entry.getKey().contains("image.forceExtension.")) { picture.setForceExtension(entry.getValue()); } else if (entry.getKey().contains("image.hidden.")) { picture.setHidden(Boolean.valueOf(entry.getValue())); } } catch (NumberFormatException nfe) { throw new GalleryConnectionException(nfe); } } } return picturesMap.values(); } }
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, String> entry : fetchImages.entrySet()) { if (entry.getKey().contains("image") && !entry.getKey().contains("image_count")) { imageNumber = new Integer(entry.getKey().substring( entry.getKey().lastIndexOf(".") + 1)); G2Picture picture = null; if (!tmpImageNumbers.contains(imageNumber)) { picture = new G2Picture(); picture.setId(imageNumber); picturesMap.put(imageNumber, picture); tmpImageNumbers.add(imageNumber); } else { picture = picturesMap.get(imageNumber); } try { if (entry.getKey().contains("image.title.")) { picture.setTitle(entry.getValue()); } else if (entry.getKey().contains("image.thumbName.")) { picture.setThumbName(entry.getValue()); } else if (entry.getKey().contains("image.thumb_width.")) { picture.setThumbWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.thumb_height.")) { picture.setThumbHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resizedName.")) { picture.setResizedName(entry.getValue()); } else if (entry.getKey().contains("image.resized_width.")) { picture.setResizedWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resized_height.")) { picture.setResizedHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.name.")) { picture.setName( entry.getValue()); } else if (entry.getKey().contains("image.raw_width.")) { picture.setRawWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_height.")) { picture.setRawHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_filesize.")) { picture.setRawFilesize(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.caption.")) { picture.setCaption(entry.getValue()); } else if (entry.getKey().contains("image.forceExtension.")) { picture.setForceExtension(entry.getValue()); } else if (entry.getKey().contains("image.hidden.")) { picture.setHidden(Boolean.valueOf(entry.getValue())); } } catch (NumberFormatException nfe) { throw new GalleryConnectionException(nfe); } } } return picturesMap.values(); } G2Client(String userAgent); }
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, String> entry : fetchImages.entrySet()) { if (entry.getKey().contains("image") && !entry.getKey().contains("image_count")) { imageNumber = new Integer(entry.getKey().substring( entry.getKey().lastIndexOf(".") + 1)); G2Picture picture = null; if (!tmpImageNumbers.contains(imageNumber)) { picture = new G2Picture(); picture.setId(imageNumber); picturesMap.put(imageNumber, picture); tmpImageNumbers.add(imageNumber); } else { picture = picturesMap.get(imageNumber); } try { if (entry.getKey().contains("image.title.")) { picture.setTitle(entry.getValue()); } else if (entry.getKey().contains("image.thumbName.")) { picture.setThumbName(entry.getValue()); } else if (entry.getKey().contains("image.thumb_width.")) { picture.setThumbWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.thumb_height.")) { picture.setThumbHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resizedName.")) { picture.setResizedName(entry.getValue()); } else if (entry.getKey().contains("image.resized_width.")) { picture.setResizedWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resized_height.")) { picture.setResizedHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.name.")) { picture.setName( entry.getValue()); } else if (entry.getKey().contains("image.raw_width.")) { picture.setRawWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_height.")) { picture.setRawHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_filesize.")) { picture.setRawFilesize(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.caption.")) { picture.setCaption(entry.getValue()); } else if (entry.getKey().contains("image.forceExtension.")) { picture.setForceExtension(entry.getValue()); } else if (entry.getKey().contains("image.hidden.")) { picture.setHidden(Boolean.valueOf(entry.getValue())); } } catch (NumberFormatException nfe) { throw new GalleryConnectionException(nfe); } } } return picturesMap.values(); } G2Client(String userAgent); HashMap<String, String> fetchImages(String galleryUrl, int albumName); HashMap<String, String> fetchAlbums(String galleryUrl); void loginToGallery(String galleryUrl, String user, String password); InputStream getInputStreamFromUrl(String url); int createNewAlbum(String galleryUrl, int parentAlbumName,
			String albumName, String albumTitle, String albumDescription); int sendImageToGallery(String galleryUrl, int albumName,
			File imageFile, String imageName, String summary, String description); String getAuthToken(); void setAuthToken(String authToken); List<Cookie> getSessionCookies(); Collection<G2Picture> extractG2PicturesFromProperties(
			HashMap<String, String> fetchImages); Map<Integer, Album> getAllAlbums(String galleryUrl); Map<Integer, G2Album> extractAlbumFromProperties(
			HashMap<String, String> albumsProperties); Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums); void setRootAlbum(G2Album rootAlbum); G2Album getRootAlbum(); }
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, String> entry : fetchImages.entrySet()) { if (entry.getKey().contains("image") && !entry.getKey().contains("image_count")) { imageNumber = new Integer(entry.getKey().substring( entry.getKey().lastIndexOf(".") + 1)); G2Picture picture = null; if (!tmpImageNumbers.contains(imageNumber)) { picture = new G2Picture(); picture.setId(imageNumber); picturesMap.put(imageNumber, picture); tmpImageNumbers.add(imageNumber); } else { picture = picturesMap.get(imageNumber); } try { if (entry.getKey().contains("image.title.")) { picture.setTitle(entry.getValue()); } else if (entry.getKey().contains("image.thumbName.")) { picture.setThumbName(entry.getValue()); } else if (entry.getKey().contains("image.thumb_width.")) { picture.setThumbWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.thumb_height.")) { picture.setThumbHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resizedName.")) { picture.setResizedName(entry.getValue()); } else if (entry.getKey().contains("image.resized_width.")) { picture.setResizedWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.resized_height.")) { picture.setResizedHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.name.")) { picture.setName( entry.getValue()); } else if (entry.getKey().contains("image.raw_width.")) { picture.setRawWidth(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_height.")) { picture.setRawHeight(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.raw_filesize.")) { picture.setRawFilesize(new Integer(entry.getValue())); } else if (entry.getKey().contains("image.caption.")) { picture.setCaption(entry.getValue()); } else if (entry.getKey().contains("image.forceExtension.")) { picture.setForceExtension(entry.getValue()); } else if (entry.getKey().contains("image.hidden.")) { picture.setHidden(Boolean.valueOf(entry.getValue())); } } catch (NumberFormatException nfe) { throw new GalleryConnectionException(nfe); } } } return picturesMap.values(); } G2Client(String userAgent); HashMap<String, String> fetchImages(String galleryUrl, int albumName); HashMap<String, String> fetchAlbums(String galleryUrl); void loginToGallery(String galleryUrl, String user, String password); InputStream getInputStreamFromUrl(String url); int createNewAlbum(String galleryUrl, int parentAlbumName,
			String albumName, String albumTitle, String albumDescription); int sendImageToGallery(String galleryUrl, int albumName,
			File imageFile, String imageName, String summary, String description); String getAuthToken(); void setAuthToken(String authToken); List<Cookie> getSessionCookies(); Collection<G2Picture> extractG2PicturesFromProperties(
			HashMap<String, String> fetchImages); Map<Integer, Album> getAllAlbums(String galleryUrl); Map<Integer, G2Album> extractAlbumFromProperties(
			HashMap<String, String> albumsProperties); Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums); void setRootAlbum(G2Album rootAlbum); G2Album getRootAlbum();  }