public Photoset getInfo ( String photosetId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_INFO ) ; parameters . put ( "photoset_id" , photosetId ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosetElement = response . getPayload ( ) ; Photoset photoset = new Photoset ( ) ; photoset . setId ( photosetElement . getAttribute ( "id" ) ) ; User owner = new User ( ) ; owner . setId ( photosetElement . getAttribute ( "owner" ) ) ; photoset . setOwner ( owner ) ; Photo primaryPhoto = new Photo ( ) ; primaryPhoto . setId ( photosetElement . getAttribute ( "primary" ) ) ; primaryPhoto . setSecret ( photosetElement . getAttribute ( "secret" ) ) ; // TODO verify that this is the secret for the photo primaryPhoto . setServer ( photosetElement . getAttribute ( "server" ) ) ; // TODO verify that this is the server for the photo primaryPhoto . setFarm ( photosetElement . getAttribute ( "farm" ) ) ; photoset . setPrimaryPhoto ( primaryPhoto ) ; // TODO remove secret/server/farm from photoset? // It's rather related to the primaryPhoto, then to the photoset itself. photoset . setSecret ( photosetElement . getAttribute ( "secret" ) ) ; photoset . setServer ( photosetElement . getAttribute ( "server" ) ) ; photoset . setFarm ( photosetElement . getAttribute ( "farm" ) ) ; photoset . setPhotoCount ( photosetElement . getAttribute ( "count_photos" ) ) ; photoset . setVideoCount ( Integer . parseInt ( photosetElement . getAttribute ( "count_videos" ) ) ) ; photoset . setViewCount ( Integer . parseInt ( photosetElement . getAttribute ( "count_views" ) ) ) ; photoset . setCommentCount ( Integer . parseInt ( photosetElement . getAttribute ( "count_comments" ) ) ) ; photoset . setDateCreate ( photosetElement . getAttribute ( "date_create" ) ) ; photoset . setDateUpdate ( photosetElement . getAttribute ( "date_update" ) ) ; photoset . setIsCanComment ( "1" . equals ( photosetElement . getAttribute ( "can_comment" ) ) ) ; photoset . setTitle ( XMLUtilities . getChildValue ( photosetElement , "title" ) ) ; photoset . setDescription ( XMLUtilities . getChildValue ( photosetElement , "description" ) ) ; photoset . setPrimaryPhoto ( primaryPhoto ) ; return photoset ; }
Get the information for a specified photoset .