public PhotoContext getContext ( String photoId , String groupId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_CONTEXT ) ; parameters . put ( "photo_id" , photoId ) ; parameters . put ( "group_id" , groupId ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Collection < Element > payload = response . getPayloadCollection ( ) ; PhotoContext photoContext = new PhotoContext ( ) ; for ( Element element : payload ) { String elementName = element . getTagName ( ) ; if ( elementName . equals ( "prevphoto" ) ) { Photo photo = new Photo ( ) ; photo . setId ( element . getAttribute ( "id" ) ) ; photoContext . setPreviousPhoto ( photo ) ; } else if ( elementName . equals ( "nextphoto" ) ) { Photo photo = new Photo ( ) ; photo . setId ( element . getAttribute ( "id" ) ) ; photoContext . setNextPhoto ( photo ) ; } else if ( ! elementName . equals ( "count" ) ) { _log . warn ( "unsupported element name: " + elementName ) ; } } return photoContext ; }
Get the context for a photo in the group pool .