idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
23,300
public ReferrerList getCollectionReferrers ( Date date , String domain , String collectionId , int perPage , int page ) throws FlickrException { return getReferrers ( METHOD_GET_COLLECTION_REFERRERS , domain , "collection_id" , collectionId , date , perPage , page ) ; }
Get a list of referrers from a given domain to a collection .
23,301
public Stats getCollectionStats ( String collectionId , Date date ) throws FlickrException { return getStats ( METHOD_GET_COLLECTION_STATS , "collection_id" , collectionId , date ) ; }
Get the number of views comments and favorites on a collection for a given date .
23,302
public DomainList getPhotoDomains ( Date date , String photoId , int perPage , int page ) throws FlickrException { return getDomains ( METHOD_GET_PHOTO_DOMAINS , "photo_id" , photoId , date , perPage , page ) ; }
Get a list of referring domains for a photo .
23,303
public ReferrerList getPhotoReferrers ( Date date , String domain , String photoId , int perPage , int page ) throws FlickrException { return getReferrers ( METHOD_GET_PHOTO_REFERRERS , domain , "photo_id" , photoId , date , perPage , page ) ; }
Get a list of referrers from a given domain to a photo .
23,304
public Stats getPhotoStats ( String photoId , Date date ) throws FlickrException { return getStats ( METHOD_GET_PHOTO_STATS , "photo_id" , photoId , date ) ; }
Get the number of views comments and favorites on a photo for a given date .
23,305
public DomainList getPhotosetDomains ( Date date , String photosetId , int perPage , int page ) throws FlickrException { return getDomains ( METHOD_GET_PHOTOSET_DOMAINS , "photoset_id" , photosetId , date , perPage , page ) ; }
Get a list of referring domains for a photoset .
23,306
public ReferrerList getPhotosetReferrers ( Date date , String domain , String photosetId , int perPage , int page ) throws FlickrException { return getReferrers ( METHOD_GET_PHOTOSET_REFERRERS , domain , "photoset_id" , photosetId , date , perPage , page ) ; }
Get a list of referrers from a given domain to a photoset .
23,307
public Stats getPhotosetStats ( String photosetId , Date date ) throws FlickrException { return getStats ( METHOD_GET_PHOTOSET_STATS , "photoset_id" , photosetId , date ) ; }
Get the number of views comments and favorites on a photoset for a given date .
23,308
public DomainList getPhotostreamDomains ( Date date , int perPage , int page ) throws FlickrException { return getDomains ( METHOD_GET_PHOTOSTREAM_DOMAINS , null , null , date , perPage , page ) ; }
Get a list of referring domains for a photostream .
23,309
public ReferrerList getPhotostreamReferrers ( Date date , String domain , int perPage , int page ) throws FlickrException { return getReferrers ( METHOD_GET_PHOTOSTREAM_REFERRERS , domain , null , null , date , perPage , page ) ; }
Get a list of referrers from a given domain to a user s photostream .
23,310
public Stats getPhotostreamStats ( Date date ) throws FlickrException { return getStats ( METHOD_GET_PHOTOSTREAM_STATS , null , null , date ) ; }
Get the number of views comments and favorites on a photostream for a given date .
23,311
public PhotoList < Photo > getPopularPhotos ( Date date , StatsSort sort , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_POPULAR_PHOTOS ) ; if ( date != null ) { parameters . put ( "date" , String . valueOf ( date . getTime ( ) / 1000L ) ) ; } if ( sort != null ) { parameters . put ( "sort" , sort . name ( ) ) ; } addPaginationParameters ( parameters , perPage , page ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } return parsePopularPhotos ( response ) ; }
List the photos with the most views comments or favorites .
23,312
public synchronized GeoInterface getGeoInterface ( ) { if ( geoInterface == null ) { geoInterface = new GeoInterface ( apiKey , sharedSecret , transport ) ; } return geoInterface ; }
Get the geo interface .
23,313
public void addTags ( String photoId , String [ ] tags ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_ADD_TAGS ) ; parameters . put ( "photo_id" , photoId ) ; parameters . put ( "tags" , StringUtilities . join ( tags , " " , true ) ) ; Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Add tags to a photo .
23,314
public void delete ( String photoId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_DELETE ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Delete a photo from flickr .
23,315
public PhotoAllContext getAllContexts ( String photoId ) throws FlickrException { PhotoSetList < PhotoSet > setList = new PhotoSetList < PhotoSet > ( ) ; PoolList < Pool > poolList = new PoolList < Pool > ( ) ; PhotoAllContext allContext = new PhotoAllContext ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_ALL_CONTEXTS ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Collection < Element > photosElement = response . getPayloadCollection ( ) ; for ( Element setElement : photosElement ) { if ( setElement . getTagName ( ) . equals ( "set" ) ) { PhotoSet pset = new PhotoSet ( ) ; pset . setTitle ( setElement . getAttribute ( "title" ) ) ; pset . setSecret ( setElement . getAttribute ( "secret" ) ) ; pset . setId ( setElement . getAttribute ( "id" ) ) ; pset . setFarm ( setElement . getAttribute ( "farm" ) ) ; pset . setPrimary ( setElement . getAttribute ( "primary" ) ) ; pset . setServer ( setElement . getAttribute ( "server" ) ) ; pset . setViewCount ( Integer . parseInt ( setElement . getAttribute ( "view_count" ) ) ) ; pset . setCommentCount ( Integer . parseInt ( setElement . getAttribute ( "comment_count" ) ) ) ; pset . setCountPhoto ( Integer . parseInt ( setElement . getAttribute ( "count_photo" ) ) ) ; pset . setCountVideo ( Integer . parseInt ( setElement . getAttribute ( "count_video" ) ) ) ; setList . add ( pset ) ; allContext . setPhotoSetList ( setList ) ; } else if ( setElement . getTagName ( ) . equals ( "pool" ) ) { Pool pool = new Pool ( ) ; pool . setTitle ( setElement . getAttribute ( "title" ) ) ; pool . setId ( setElement . getAttribute ( "id" ) ) ; pool . setUrl ( setElement . getAttribute ( "url" ) ) ; pool . setIconServer ( setElement . getAttribute ( "iconserver" ) ) ; pool . setIconFarm ( setElement . getAttribute ( "iconfarm" ) ) ; pool . setMemberCount ( Integer . parseInt ( setElement . getAttribute ( "members" ) ) ) ; pool . setPoolCount ( Integer . parseInt ( setElement . getAttribute ( "pool_count" ) ) ) ; poolList . add ( pool ) ; allContext . setPoolList ( poolList ) ; } } return allContext ; }
Returns all visble sets and pools the photo belongs to .
23,316
public PhotoList < Photo > getContactsPhotos ( int count , boolean justFriends , boolean singlePhoto , boolean includeSelf ) throws FlickrException { PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_CONTACTS_PHOTOS ) ; if ( count > 0 ) { parameters . put ( "count" , Integer . toString ( count ) ) ; } if ( justFriends ) { parameters . put ( "just_friends" , "1" ) ; } if ( singlePhoto ) { parameters . put ( "single_photo" , "1" ) ; } if ( includeSelf ) { parameters . put ( "include_self" , "1" ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; NodeList photoNodes = photosElement . getElementsByTagName ( "photo" ) ; photos . setPage ( "1" ) ; photos . setPages ( "1" ) ; photos . setPerPage ( "" + photoNodes . getLength ( ) ) ; photos . setTotal ( "" + photoNodes . getLength ( ) ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoNodes . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; }
Get photos from the user s contacts .
23,317
public PhotoList < Photo > getContactsPublicPhotos ( String userId , int count , boolean justFriends , boolean singlePhoto , boolean includeSelf ) throws FlickrException { return getContactsPublicPhotos ( userId , Extras . MIN_EXTRAS , count , justFriends , singlePhoto , includeSelf ) ; }
Get public photos from the user s contacts .
23,318
public PhotoContext getContext ( String photoId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_CONTEXT ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } PhotoContext photoContext = new PhotoContext ( ) ; Collection < Element > payload = response . getPayloadCollection ( ) ; for ( Element payloadElement : payload ) { String tagName = payloadElement . getTagName ( ) ; if ( tagName . equals ( "prevphoto" ) ) { Photo photo = new Photo ( ) ; photo . setId ( payloadElement . getAttribute ( "id" ) ) ; photo . setSecret ( payloadElement . getAttribute ( "secret" ) ) ; photo . setTitle ( payloadElement . getAttribute ( "title" ) ) ; photo . setFarm ( payloadElement . getAttribute ( "farm" ) ) ; photo . setUrl ( payloadElement . getAttribute ( "url" ) ) ; photoContext . setPreviousPhoto ( photo ) ; } else if ( tagName . equals ( "nextphoto" ) ) { Photo photo = new Photo ( ) ; photo . setId ( payloadElement . getAttribute ( "id" ) ) ; photo . setSecret ( payloadElement . getAttribute ( "secret" ) ) ; photo . setTitle ( payloadElement . getAttribute ( "title" ) ) ; photo . setFarm ( payloadElement . getAttribute ( "farm" ) ) ; photo . setUrl ( payloadElement . getAttribute ( "url" ) ) ; photoContext . setNextPhoto ( photo ) ; } } return photoContext ; }
Get the context for the specified photo .
23,319
public Collection < Photocount > getCounts ( Date [ ] dates , Date [ ] takenDates ) throws FlickrException { List < Photocount > photocounts = new ArrayList < Photocount > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_COUNTS ) ; if ( dates == null && takenDates == null ) { throw new IllegalArgumentException ( "You must provide a value for either dates or takenDates" ) ; } if ( dates != null ) { List < String > dateList = new ArrayList < String > ( ) ; for ( int i = 0 ; i < dates . length ; i ++ ) { dateList . add ( String . valueOf ( dates [ i ] . getTime ( ) / 1000L ) ) ; } parameters . put ( "dates" , StringUtilities . join ( dateList , "," ) ) ; } if ( takenDates != null ) { List < String > takenDateList = new ArrayList < String > ( ) ; for ( int i = 0 ; i < takenDates . length ; i ++ ) { takenDateList . add ( String . valueOf ( takenDates [ i ] . getTime ( ) / 1000L ) ) ; } parameters . put ( "taken_dates" , StringUtilities . join ( takenDateList , "," ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photocountsElement = response . getPayload ( ) ; NodeList photocountNodes = photocountsElement . getElementsByTagName ( "photocount" ) ; for ( int i = 0 ; i < photocountNodes . getLength ( ) ; i ++ ) { Element photocountElement = ( Element ) photocountNodes . item ( i ) ; Photocount photocount = new Photocount ( ) ; photocount . setCount ( photocountElement . getAttribute ( "count" ) ) ; photocount . setFromDate ( photocountElement . getAttribute ( "fromdate" ) ) ; photocount . setToDate ( photocountElement . getAttribute ( "todate" ) ) ; photocounts . add ( photocount ) ; } return photocounts ; }
Gets a collection of photo counts for the given date ranges for the calling user .
23,320
public Collection < Exif > getExif ( String photoId , String secret ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_EXIF ) ; parameters . put ( "photo_id" , photoId ) ; if ( secret != null ) { parameters . put ( "secret" , secret ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } List < Exif > exifs = new ArrayList < Exif > ( ) ; Element photoElement = response . getPayload ( ) ; NodeList exifElements = photoElement . getElementsByTagName ( "exif" ) ; for ( int i = 0 ; i < exifElements . getLength ( ) ; i ++ ) { Element exifElement = ( Element ) exifElements . item ( i ) ; Exif exif = new Exif ( ) ; exif . setTagspace ( exifElement . getAttribute ( "tagspace" ) ) ; exif . setTagspaceId ( exifElement . getAttribute ( "tagspaceid" ) ) ; exif . setTag ( exifElement . getAttribute ( "tag" ) ) ; exif . setLabel ( exifElement . getAttribute ( "label" ) ) ; exif . setRaw ( XMLUtilities . getChildValue ( exifElement , "raw" ) ) ; exif . setClean ( XMLUtilities . getChildValue ( exifElement , "clean" ) ) ; exifs . add ( exif ) ; } return exifs ; }
Get the Exif data for the photo .
23,321
public Collection < User > getFavorites ( String photoId , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_FAVORITES ) ; parameters . put ( "photo_id" , photoId ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } List < User > users = new ArrayList < User > ( ) ; Element userRoot = response . getPayload ( ) ; NodeList userNodes = userRoot . getElementsByTagName ( "person" ) ; for ( int i = 0 ; i < userNodes . getLength ( ) ; i ++ ) { Element userElement = ( Element ) userNodes . item ( i ) ; User user = new User ( ) ; user . setId ( userElement . getAttribute ( "nsid" ) ) ; user . setUsername ( userElement . getAttribute ( "username" ) ) ; user . setFaveDate ( userElement . getAttribute ( "favedate" ) ) ; users . add ( user ) ; } return users ; }
Returns the list of people who have favorited a given photo .
23,322
public Photo getInfo ( String photoId , String secret ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_INFO ) ; parameters . put ( "photo_id" , photoId ) ; if ( secret != null ) { parameters . put ( "secret" , secret ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photoElement = response . getPayload ( ) ; return PhotoUtils . createPhoto ( photoElement ) ; }
Get all info for the specified photo .
23,323
public PhotoList < Photo > getNotInSet ( int perPage , int page ) throws FlickrException { PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , PhotosInterface . METHOD_GET_NOT_IN_SET ) ; RequestContext requestContext = RequestContext . getRequestContext ( ) ; List < String > extras = requestContext . getExtras ( ) ; if ( extras . size ( ) > 0 ) { parameters . put ( "extras" , StringUtilities . join ( extras , "," ) ) ; } if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoElements = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoElements . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoElements . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; }
Return a collection of Photo objects not in part of any sets .
23,324
public Permissions getPerms ( String photoId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_PERMS ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element permissionsElement = response . getPayload ( ) ; Permissions permissions = new Permissions ( ) ; permissions . setId ( permissionsElement . getAttribute ( "id" ) ) ; permissions . setPublicFlag ( "1" . equals ( permissionsElement . getAttribute ( "ispublic" ) ) ) ; permissions . setFamilyFlag ( "1" . equals ( permissionsElement . getAttribute ( "isfamily" ) ) ) ; permissions . setFriendFlag ( "1" . equals ( permissionsElement . getAttribute ( "isfriend" ) ) ) ; permissions . setComment ( permissionsElement . getAttribute ( "permcomment" ) ) ; permissions . setAddmeta ( permissionsElement . getAttribute ( "permaddmeta" ) ) ; return permissions ; }
Get the permission information for the specified photo .
23,325
public PhotoList < Photo > getRecent ( Set < String > extras , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_RECENT ) ; if ( extras != null && ! extras . isEmpty ( ) ) { parameters . put ( Extras . KEY_EXTRAS , StringUtilities . join ( extras , "," ) ) ; } if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; PhotoList < Photo > photos = PhotoUtils . createPhotoList ( photosElement ) ; return photos ; }
Get a collection of recent photos .
23,326
public Collection < Size > getSizes ( String photoId , boolean sign ) throws FlickrException { SizeList < Size > sizes = new SizeList < Size > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_SIZES ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element sizesElement = response . getPayload ( ) ; sizes . setIsCanBlog ( "1" . equals ( sizesElement . getAttribute ( "canblog" ) ) ) ; sizes . setIsCanDownload ( "1" . equals ( sizesElement . getAttribute ( "candownload" ) ) ) ; sizes . setIsCanPrint ( "1" . equals ( sizesElement . getAttribute ( "canprint" ) ) ) ; NodeList sizeNodes = sizesElement . getElementsByTagName ( "size" ) ; for ( int i = 0 ; i < sizeNodes . getLength ( ) ; i ++ ) { Element sizeElement = ( Element ) sizeNodes . item ( i ) ; Size size = new Size ( ) ; size . setLabel ( sizeElement . getAttribute ( "label" ) ) ; size . setWidth ( sizeElement . getAttribute ( "width" ) ) ; size . setHeight ( sizeElement . getAttribute ( "height" ) ) ; size . setSource ( sizeElement . getAttribute ( "source" ) ) ; size . setUrl ( sizeElement . getAttribute ( "url" ) ) ; size . setMedia ( sizeElement . getAttribute ( "media" ) ) ; sizes . add ( size ) ; } return sizes ; }
Get the available sizes of a Photo .
23,327
public PhotoList < Photo > getUntagged ( int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_UNTAGGED ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; PhotoList < Photo > photos = PhotoUtils . createPhotoList ( photosElement ) ; return photos ; }
Get the collection of untagged photos .
23,328
public PhotoList < Photo > getWithGeoData ( Date minUploadDate , Date maxUploadDate , Date minTakenDate , Date maxTakenDate , int privacyFilter , String sort , Set < String > extras , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_WITH_GEO_DATA ) ; if ( minUploadDate != null ) { parameters . put ( "min_upload_date" , Long . toString ( minUploadDate . getTime ( ) / 1000L ) ) ; } if ( maxUploadDate != null ) { parameters . put ( "max_upload_date" , Long . toString ( maxUploadDate . getTime ( ) / 1000L ) ) ; } if ( minTakenDate != null ) { parameters . put ( "min_taken_date" , Long . toString ( minTakenDate . getTime ( ) / 1000L ) ) ; } if ( maxTakenDate != null ) { parameters . put ( "max_taken_date" , Long . toString ( maxTakenDate . getTime ( ) / 1000L ) ) ; } if ( privacyFilter > 0 ) { parameters . put ( "privacy_filter" , Integer . toString ( privacyFilter ) ) ; } if ( sort != null ) { parameters . put ( "sort" , sort ) ; } if ( extras != null && ! extras . isEmpty ( ) ) { parameters . put ( "extras" , StringUtilities . join ( extras , "," ) ) ; } if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; PhotoList < Photo > photos = PhotoUtils . createPhotoList ( photosElement ) ; return photos ; }
Returns a list of your geo - tagged photos .
23,329
public void removeTag ( String tagId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_REMOVE_TAG ) ; parameters . put ( "tag_id" , tagId ) ; Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Remove a tag from a photo .
23,330
public PhotoList < Photo > search ( SearchParameters params , int perPage , int page ) throws FlickrException { PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SEARCH ) ; parameters . putAll ( params . getAsParameters ( ) ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , "" + perPage ) ; } if ( page > 0 ) { parameters . put ( "page" , "" + page ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoNodes = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoNodes . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; }
Search for photos which match the given search parameters .
23,331
public PhotoList < Photo > searchInterestingness ( SearchParameters params , int perPage , int page ) throws FlickrException { PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_INTERESTINGNESS ) ; parameters . putAll ( params . getAsParameters ( ) ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoNodes = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoNodes . item ( i ) ; Photo photo = new Photo ( ) ; photo . setId ( photoElement . getAttribute ( "id" ) ) ; User owner = new User ( ) ; owner . setId ( photoElement . getAttribute ( "owner" ) ) ; photo . setOwner ( owner ) ; photo . setSecret ( photoElement . getAttribute ( "secret" ) ) ; photo . setServer ( photoElement . getAttribute ( "server" ) ) ; photo . setFarm ( photoElement . getAttribute ( "farm" ) ) ; photo . setTitle ( photoElement . getAttribute ( "title" ) ) ; photo . setPublicFlag ( "1" . equals ( photoElement . getAttribute ( "ispublic" ) ) ) ; photo . setFriendFlag ( "1" . equals ( photoElement . getAttribute ( "isfriend" ) ) ) ; photo . setFamilyFlag ( "1" . equals ( photoElement . getAttribute ( "isfamily" ) ) ) ; photos . add ( photo ) ; } return photos ; }
Search for interesting photos using the Flickr Interestingness algorithm .
23,332
public void setContentType ( String photoId , String contentType ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SET_CONTENTTYPE ) ; parameters . put ( "photo_id" , photoId ) ; parameters . put ( "content_type" , contentType ) ; Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Set the content type of a photo .
23,333
public void setDates ( String photoId , Date datePosted , Date dateTaken , String dateTakenGranularity ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SET_DATES ) ; parameters . put ( "photo_id" , photoId ) ; if ( datePosted != null ) { parameters . put ( "date_posted" , Long . toString ( datePosted . getTime ( ) / 1000 ) ) ; } if ( dateTaken != null ) { parameters . put ( "date_taken" , ( ( DateFormat ) DATE_FORMATS . get ( ) ) . format ( dateTaken ) ) ; } if ( dateTakenGranularity != null ) { parameters . put ( "date_taken_granularity" , dateTakenGranularity ) ; } Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Set the dates for the specified photo .
23,334
public void setMeta ( String photoId , String title , String description ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SET_META ) ; parameters . put ( "photo_id" , photoId ) ; parameters . put ( "title" , title ) ; parameters . put ( "description" , description ) ; Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Set the meta data for the photo .
23,335
public void setPerms ( String photoId , Permissions permissions ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SET_PERMS ) ; parameters . put ( "photo_id" , photoId ) ; parameters . put ( "is_public" , permissions . isPublicFlag ( ) ? "1" : "0" ) ; parameters . put ( "is_friend" , permissions . isFriendFlag ( ) ? "1" : "0" ) ; parameters . put ( "is_family" , permissions . isFamilyFlag ( ) ? "1" : "0" ) ; parameters . put ( "perm_comment" , Integer . toString ( permissions . getComment ( ) ) ) ; parameters . put ( "perm_addmeta" , Integer . toString ( permissions . getAddmeta ( ) ) ) ; Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Set the permissions for the photo .
23,336
public List < Ticket > checkTickets ( Set < String > tickets ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_CHECK_TICKETS ) ; StringBuffer sb = new StringBuffer ( ) ; Iterator < String > it = tickets . iterator ( ) ; while ( it . hasNext ( ) ) { if ( sb . length ( ) > 0 ) { sb . append ( "," ) ; } Object obj = it . next ( ) ; if ( obj instanceof Ticket ) { sb . append ( ( ( Ticket ) obj ) . getTicketId ( ) ) ; } else { sb . append ( obj ) ; } } parameters . put ( "tickets" , sb . toString ( ) ) ; Response response = transportAPI . post ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } List < Ticket > list = new ArrayList < Ticket > ( ) ; Element uploaderElement = response . getPayload ( ) ; NodeList ticketNodes = uploaderElement . getElementsByTagName ( "ticket" ) ; int n = ticketNodes . getLength ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Element ticketElement = ( Element ) ticketNodes . item ( i ) ; String id = ticketElement . getAttribute ( "id" ) ; String complete = ticketElement . getAttribute ( "complete" ) ; boolean invalid = "1" . equals ( ticketElement . getAttribute ( "invalid" ) ) ; String photoId = ticketElement . getAttribute ( "photoid" ) ; Ticket info = new Ticket ( ) ; info . setTicketId ( id ) ; info . setInvalid ( invalid ) ; info . setStatus ( Integer . parseInt ( complete ) ) ; info . setPhotoId ( photoId ) ; list . add ( info ) ; } return list ; }
Checks the status of one or more asynchronous photo upload tickets . This method does not require authentication .
23,337
public void setProxy ( String proxyHost , int proxyPort ) { System . setProperty ( "http.proxySet" , "true" ) ; System . setProperty ( "http.proxyHost" , proxyHost ) ; System . setProperty ( "http.proxyPort" , "" + proxyPort ) ; System . setProperty ( "https.proxyHost" , proxyHost ) ; System . setProperty ( "https.proxyPort" , "" + proxyPort ) ; }
Set a proxy for REST - requests .
23,338
public void setProxy ( String proxyHost , int proxyPort , String username , String password ) { setProxy ( proxyHost , proxyPort ) ; proxyAuth = true ; proxyUser = username ; proxyPassword = password ; }
Set a proxy with authentication for REST - requests .
23,339
public com . flickr4java . flickr . Response get ( String path , Map < String , Object > parameters , String apiKey , String sharedSecret ) throws FlickrException { OAuthRequest request = new OAuthRequest ( Verb . GET , buildUrl ( path ) ) ; for ( Map . Entry < String , Object > entry : parameters . entrySet ( ) ) { request . addQuerystringParameter ( entry . getKey ( ) , String . valueOf ( entry . getValue ( ) ) ) ; } if ( proxyAuth ) { request . addHeader ( "Proxy-Authorization" , "Basic " + getProxyCredentials ( ) ) ; } RequestContext requestContext = RequestContext . getRequestContext ( ) ; Auth auth = requestContext . getAuth ( ) ; OAuth10aService service = createOAuthService ( apiKey , sharedSecret ) ; if ( auth != null ) { OAuth1AccessToken requestToken = new OAuth1AccessToken ( auth . getToken ( ) , auth . getTokenSecret ( ) ) ; service . signRequest ( requestToken , request ) ; } else { if ( ! parameters . containsKey ( Flickr . API_KEY ) ) { request . addQuerystringParameter ( Flickr . API_KEY , apiKey ) ; } } if ( Flickr . debugRequest ) { logger . debug ( "GET: " + request . getCompleteUrl ( ) ) ; } try { return handleResponse ( request , service ) ; } catch ( IllegalAccessException | InstantiationException | SAXException | IOException | InterruptedException | ExecutionException | ParserConfigurationException e ) { throw new FlickrRuntimeException ( e ) ; } }
Invoke an HTTP GET request on a remote host . You must close the InputStream after you are done with .
23,340
public String addComment ( String photosetId , String commentText ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_ADD_COMMENT ) ; parameters . put ( "photoset_id" , photosetId ) ; parameters . put ( "comment_text" , commentText ) ; Response response = transportAPI . post ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element commentElement = response . getPayload ( ) ; return commentElement . getAttribute ( "id" ) ; }
Add a comment to a photoset . This method requires authentication with write permission .
23,341
public static String convertToFileSystemChar ( String name ) { String erg = "" ; Matcher m = Pattern . compile ( "[a-z0-9 _#&@\\[\\(\\)\\]\\-\\.]" , Pattern . CASE_INSENSITIVE ) . matcher ( name ) ; while ( m . find ( ) ) { erg += name . substring ( m . start ( ) , m . end ( ) ) ; } if ( erg . length ( ) > 200 ) { erg = erg . substring ( 0 , 200 ) ; System . out . println ( "cut filename: " + erg ) ; } return erg ; }
convert filename to clean filename
23,342
public GeoPermissions getPerms ( String photoId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_PERMS ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } GeoPermissions perms = new GeoPermissions ( ) ; Element permsElement = response . getPayload ( ) ; perms . setPublic ( "1" . equals ( permsElement . getAttribute ( "ispublic" ) ) ) ; perms . setContact ( "1" . equals ( permsElement . getAttribute ( "iscontact" ) ) ) ; perms . setFriend ( "1" . equals ( permsElement . getAttribute ( "isfriend" ) ) ) ; perms . setFamily ( "1" . equals ( permsElement . getAttribute ( "isfamily" ) ) ) ; perms . setId ( permsElement . getAttribute ( "id" ) ) ; return perms ; }
Get permissions for who may view geo data for a photo .
23,343
public void setPerms ( String photoId , GeoPermissions perms ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SET_PERMS ) ; parameters . put ( "photo_id" , photoId ) ; parameters . put ( "is_public" , perms . isPublic ( ) ? "1" : "0" ) ; parameters . put ( "is_contact" , perms . isContact ( ) ? "1" : "0" ) ; parameters . put ( "is_friend" , perms . isFriend ( ) ? "1" : "0" ) ; parameters . put ( "is_family" , perms . isFamily ( ) ? "1" : "0" ) ; Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Set the permission for who may view the geo data associated with a photo .
23,344
public PhotoList < Photo > photosForLocation ( GeoData location , Set < String > extras , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; parameters . put ( "method" , METHOD_PHOTOS_FOR_LOCATION ) ; if ( extras . size ( ) > 0 ) { parameters . put ( "extras" , StringUtilities . join ( extras , "," ) ) ; } if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } parameters . put ( "lat" , Float . toString ( location . getLatitude ( ) ) ) ; parameters . put ( "lon" , Float . toString ( location . getLongitude ( ) ) ) ; parameters . put ( "accuracy" , Integer . toString ( location . getAccuracy ( ) ) ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoElements = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoElements . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoElements . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; }
Return a list of photos for a user at a specific latitude longitude and accuracy .
23,345
private Collection parseCollection ( Element collectionElement ) { Collection collection = new Collection ( ) ; collection . setId ( collectionElement . getAttribute ( "id" ) ) ; collection . setServer ( collectionElement . getAttribute ( "server" ) ) ; collection . setSecret ( collectionElement . getAttribute ( "secret" ) ) ; collection . setChildCount ( collectionElement . getAttribute ( "child_count" ) ) ; collection . setIconLarge ( collectionElement . getAttribute ( "iconlarge" ) ) ; collection . setIconSmall ( collectionElement . getAttribute ( "iconsmall" ) ) ; collection . setDateCreated ( collectionElement . getAttribute ( "datecreate" ) ) ; collection . setTitle ( XMLUtilities . getChildValue ( collectionElement , "title" ) ) ; collection . setDescription ( XMLUtilities . getChildValue ( collectionElement , "description" ) ) ; Element iconPhotos = XMLUtilities . getChild ( collectionElement , "iconphotos" ) ; if ( iconPhotos != null ) { NodeList photoElements = iconPhotos . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoElements . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoElements . item ( i ) ; collection . addPhoto ( PhotoUtils . createPhoto ( photoElement ) ) ; } } return collection ; }
Parse the XML for a collection as returned by getInfo call .
23,346
private Collection parseTreeCollection ( Element collectionElement ) { Collection collection = new Collection ( ) ; parseCommonFields ( collectionElement , collection ) ; collection . setTitle ( collectionElement . getAttribute ( "title" ) ) ; collection . setDescription ( collectionElement . getAttribute ( "description" ) ) ; NodeList childCollectionElements = collectionElement . getElementsByTagName ( "collection" ) ; for ( int i = 0 ; i < childCollectionElements . getLength ( ) ; i ++ ) { Element childCollectionElement = ( Element ) childCollectionElements . item ( i ) ; collection . addCollection ( parseTreeCollection ( childCollectionElement ) ) ; } NodeList childPhotosetElements = collectionElement . getElementsByTagName ( "set" ) ; for ( int i = 0 ; i < childPhotosetElements . getLength ( ) ; i ++ ) { Element childPhotosetElement = ( Element ) childPhotosetElements . item ( i ) ; collection . addPhotoset ( createPhotoset ( childPhotosetElement ) ) ; } return collection ; }
Parse the XML for a collection as returned by getTree call .
23,347
public static String getValue ( Element element ) { if ( element != null ) { Node dataNode = element . getFirstChild ( ) ; if ( dataNode != null ) { return ( ( Text ) dataNode ) . getData ( ) ; } } return null ; }
Get the text value for the specified element . If the element is null or the element s body is empty then this method will return null .
23,348
public static Element getChild ( Element element , String name ) { return ( Element ) element . getElementsByTagName ( name ) . item ( 0 ) ; }
Get the first child element with the given name .
23,349
public static String getChildValue ( Element element , String name ) { return getValue ( getChild ( element , name ) ) ; }
Get the value of the fist child element with the given name .
23,350
public User findByEmail ( String email ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_FIND_BY_EMAIL ) ; parameters . put ( "find_email" , email ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element userElement = response . getPayload ( ) ; User user = new User ( ) ; user . setId ( userElement . getAttribute ( "nsid" ) ) ; user . setUsername ( XMLUtilities . getChildValue ( userElement , "username" ) ) ; return user ; }
Find the user by their email address .
23,351
public Collection < Group > getPublicGroups ( String userId ) throws FlickrException { List < Group > groups = new ArrayList < Group > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_PUBLIC_GROUPS ) ; parameters . put ( "user_id" , userId ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element groupsElement = response . getPayload ( ) ; NodeList groupNodes = groupsElement . getElementsByTagName ( "group" ) ; for ( int i = 0 ; i < groupNodes . getLength ( ) ; i ++ ) { Element groupElement = ( Element ) groupNodes . item ( i ) ; Group group = new Group ( ) ; group . setId ( groupElement . getAttribute ( "nsid" ) ) ; group . setName ( groupElement . getAttribute ( "name" ) ) ; group . setAdmin ( "1" . equals ( groupElement . getAttribute ( "admin" ) ) ) ; group . setEighteenPlus ( groupElement . getAttribute ( "eighteenplus" ) . equals ( "0" ) ? false : true ) ; groups . add ( group ) ; } return groups ; }
Get a collection of public groups for the user .
23,352
public PhotoList < Photo > getPublicPhotos ( String userId , Set < String > extras , int perPage , int page ) throws FlickrException { PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_PUBLIC_PHOTOS ) ; parameters . put ( "user_id" , userId ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , "" + perPage ) ; } if ( page > 0 ) { parameters . put ( "page" , "" + page ) ; } if ( extras != null ) { parameters . put ( Extras . KEY_EXTRAS , StringUtilities . join ( extras , "," ) ) ; } Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoNodes = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoNodes . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; }
Get a collection of public photos for the specified user ID .
23,353
public User getUploadStatus ( ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_UPLOAD_STATUS ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element userElement = response . getPayload ( ) ; User user = new User ( ) ; user . setId ( userElement . getAttribute ( "id" ) ) ; user . setPro ( "1" . equals ( userElement . getAttribute ( "ispro" ) ) ) ; user . setUsername ( XMLUtilities . getChildValue ( userElement , "username" ) ) ; Element bandwidthElement = XMLUtilities . getChild ( userElement , "bandwidth" ) ; user . setBandwidthMax ( bandwidthElement . getAttribute ( "max" ) ) ; user . setBandwidthUsed ( bandwidthElement . getAttribute ( "used" ) ) ; user . setIsBandwidthUnlimited ( "1" . equals ( bandwidthElement . getAttribute ( "unlimited" ) ) ) ; Element filesizeElement = XMLUtilities . getChild ( userElement , "filesize" ) ; user . setFilesizeMax ( filesizeElement . getAttribute ( "max" ) ) ; Element setsElement = XMLUtilities . getChild ( userElement , "sets" ) ; user . setSetsCreated ( setsElement . getAttribute ( "created" ) ) ; user . setSetsRemaining ( setsElement . getAttribute ( "remaining" ) ) ; Element videosElement = XMLUtilities . getChild ( userElement , "videos" ) ; user . setVideosUploaded ( videosElement . getAttribute ( "uploaded" ) ) ; user . setVideosRemaining ( videosElement . getAttribute ( "remaining" ) ) ; Element videoSizeElement = XMLUtilities . getChild ( userElement , "videosize" ) ; user . setVideoSizeMax ( videoSizeElement . getAttribute ( "maxbytes" ) ) ; return user ; }
Get upload status for the currently authenticated user .
23,354
public void add ( String photoId , String userId , Rectangle bounds ) throws FlickrException { com . flickr4java . flickr . photos . people . PeopleInterface pi = new com . flickr4java . flickr . photos . people . PeopleInterface ( apiKey , sharedSecret , transportAPI ) ; pi . add ( photoId , userId , bounds ) ; }
Add the given person to the photo . Optionally send in co - ordinates
23,355
public PersonTagList < PersonTag > getList ( String photoId ) throws FlickrException { com . flickr4java . flickr . photos . people . PeopleInterface pi = new com . flickr4java . flickr . photos . people . PeopleInterface ( apiKey , sharedSecret , transportAPI ) ; return pi . getList ( photoId ) ; }
Get a list of people in a given photo .
23,356
public User getLimits ( ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_LIMITS ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element userElement = response . getPayload ( ) ; User user = new User ( ) ; user . setId ( userElement . getAttribute ( "nsid" ) ) ; NodeList photoNodes = userElement . getElementsByTagName ( "photos" ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element plElement = ( Element ) photoNodes . item ( i ) ; PhotoLimits pl = new PhotoLimits ( ) ; user . setPhotoLimits ( pl ) ; pl . setMaxDisplay ( plElement . getAttribute ( "maxdisplaypx" ) ) ; pl . setMaxUpload ( plElement . getAttribute ( "maxupload" ) ) ; } NodeList videoNodes = userElement . getElementsByTagName ( "videos" ) ; for ( int i = 0 ; i < videoNodes . getLength ( ) ; i ++ ) { Element vlElement = ( Element ) videoNodes . item ( i ) ; VideoLimits vl = new VideoLimits ( ) ; user . setPhotoLimits ( vl ) ; vl . setMaxDuration ( vlElement . getAttribute ( "maxduration" ) ) ; vl . setMaxUpload ( vlElement . getAttribute ( "maxupload" ) ) ; } return user ; }
Get s the user s current upload limits User object only contains user_id
23,357
public List < Gallery > getList ( String userId , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_LIST ) ; parameters . put ( "user_id" , userId ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , String . valueOf ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , String . valueOf ( page ) ) ; } Response response = transport . post ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element element = response . getPayload ( ) ; GalleryList < Gallery > galleries = new GalleryList < Gallery > ( ) ; galleries . setPage ( element . getAttribute ( "page" ) ) ; galleries . setPages ( element . getAttribute ( "pages" ) ) ; galleries . setPerPage ( element . getAttribute ( "per_page" ) ) ; galleries . setTotal ( element . getAttribute ( "total" ) ) ; NodeList galleryNodes = element . getElementsByTagName ( "gallery" ) ; for ( int i = 0 ; i < galleryNodes . getLength ( ) ; i ++ ) { Element galleryElement = ( Element ) galleryNodes . item ( i ) ; Gallery gallery = new Gallery ( ) ; gallery . setId ( galleryElement . getAttribute ( "id" ) ) ; gallery . setUrl ( galleryElement . getAttribute ( "url" ) ) ; User owner = new User ( ) ; owner . setId ( galleryElement . getAttribute ( "owner" ) ) ; gallery . setOwner ( owner ) ; gallery . setCreateDate ( galleryElement . getAttribute ( "date_create" ) ) ; gallery . setUpdateDate ( galleryElement . getAttribute ( "date_update" ) ) ; gallery . setPrimaryPhotoId ( galleryElement . getAttribute ( "primary_photo_id" ) ) ; gallery . setPrimaryPhotoServer ( galleryElement . getAttribute ( "primary_photo_server" ) ) ; gallery . setPrimaryPhotoFarm ( galleryElement . getAttribute ( "primary_photo_farm" ) ) ; gallery . setPrimaryPhotoSecret ( galleryElement . getAttribute ( "primary_photo_secret" ) ) ; gallery . setPhotoCount ( galleryElement . getAttribute ( "count_photos" ) ) ; gallery . setVideoCount ( galleryElement . getAttribute ( "count_videos" ) ) ; galleries . add ( gallery ) ; } return galleries ; }
Return the list of galleries created by a user . Sorted from newest to oldest .
23,358
public Note add ( String photoId , Note note ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_ADD ) ; parameters . put ( "photo_id" , photoId ) ; Rectangle bounds = note . getBounds ( ) ; if ( bounds != null ) { parameters . put ( "note_x" , String . valueOf ( bounds . x ) ) ; parameters . put ( "note_y" , String . valueOf ( bounds . y ) ) ; parameters . put ( "note_w" , String . valueOf ( bounds . width ) ) ; parameters . put ( "note_h" , String . valueOf ( bounds . height ) ) ; } String text = note . getText ( ) ; if ( text != null ) { parameters . put ( "note_text" , text ) ; } Response response = transportAPI . post ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element noteElement = response . getPayload ( ) ; note . setId ( noteElement . getAttribute ( "id" ) ) ; return note ; }
Add a note to a photo . The Note object bounds and text must be specified .
23,359
public void edit ( Note note ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_EDIT ) ; parameters . put ( "note_id" , note . getId ( ) ) ; Rectangle bounds = note . getBounds ( ) ; if ( bounds != null ) { parameters . put ( "note_x" , String . valueOf ( bounds . x ) ) ; parameters . put ( "note_y" , String . valueOf ( bounds . y ) ) ; parameters . put ( "note_w" , String . valueOf ( bounds . width ) ) ; parameters . put ( "note_h" , String . valueOf ( bounds . height ) ) ; } String text = note . getText ( ) ; if ( text != null ) { parameters . put ( "note_text" , text ) ; } Response response = transportAPI . post ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Update a note .
23,360
public Collection < License > getInfo ( ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_INFO ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } List < License > licenses = new ArrayList < License > ( ) ; Element licensesElement = response . getPayload ( ) ; NodeList licenseElements = licensesElement . getElementsByTagName ( "license" ) ; for ( int i = 0 ; i < licenseElements . getLength ( ) ; i ++ ) { Element licenseElement = ( Element ) licenseElements . item ( i ) ; License license = new License ( ) ; license . setId ( licenseElement . getAttribute ( "id" ) ) ; license . setName ( licenseElement . getAttribute ( "name" ) ) ; license . setUrl ( licenseElement . getAttribute ( "url" ) ) ; licenses . add ( license ) ; } return licenses ; }
Fetches a list of available photo licenses for Flickr .
23,361
public void setLicense ( String photoId , int licenseId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_SET_LICENSE ) ; parameters . put ( "photo_id" , photoId ) ; parameters . put ( "license_id" , Integer . toString ( licenseId ) ) ; Response response = transportAPI . post ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } }
Sets the license for a photo .
23,362
public PhotoList < Photo > getClusterPhotos ( String tag , String clusterId ) throws FlickrException { PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_CLUSTER_PHOTOS ) ; parameters . put ( "tag" , tag ) ; parameters . put ( "cluster_id" , clusterId ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; NodeList photoNodes = photosElement . getElementsByTagName ( "photo" ) ; photos . setPage ( "1" ) ; photos . setPages ( "1" ) ; photos . setPerPage ( "" + photoNodes . getLength ( ) ) ; photos . setTotal ( "" + photoNodes . getLength ( ) ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoNodes . item ( i ) ; photos . add ( PhotoUtils . createPhoto ( photoElement ) ) ; } return photos ; }
Returns the first 24 photos for a given tag cluster .
23,363
public Photo getListPhoto ( String photoId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_LIST_PHOTO ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photoElement = response . getPayload ( ) ; Photo photo = new Photo ( ) ; photo . setId ( photoElement . getAttribute ( "id" ) ) ; List < Tag > tags = new ArrayList < Tag > ( ) ; Element tagsElement = ( Element ) photoElement . getElementsByTagName ( "tags" ) . item ( 0 ) ; NodeList tagElements = tagsElement . getElementsByTagName ( "tag" ) ; for ( int i = 0 ; i < tagElements . getLength ( ) ; i ++ ) { Element tagElement = ( Element ) tagElements . item ( i ) ; Tag tag = new Tag ( ) ; tag . setId ( tagElement . getAttribute ( "id" ) ) ; tag . setAuthor ( tagElement . getAttribute ( "author" ) ) ; tag . setAuthorName ( tagElement . getAttribute ( "authorname" ) ) ; tag . setRaw ( tagElement . getAttribute ( "raw" ) ) ; tag . setValue ( ( ( Text ) tagElement . getFirstChild ( ) ) . getData ( ) ) ; tags . add ( tag ) ; } photo . setTags ( tags ) ; return photo ; }
Get a list of tags for the specified photo .
23,364
public Collection < Tag > getListUser ( String userId ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_LIST_USER ) ; parameters . put ( "user_id" , userId ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element whoElement = response . getPayload ( ) ; List < Tag > tags = new ArrayList < Tag > ( ) ; Element tagsElement = ( Element ) whoElement . getElementsByTagName ( "tags" ) . item ( 0 ) ; NodeList tagElements = tagsElement . getElementsByTagName ( "tag" ) ; for ( int i = 0 ; i < tagElements . getLength ( ) ; i ++ ) { Element tagElement = ( Element ) tagElements . item ( i ) ; Tag tag = new Tag ( ) ; tag . setValue ( ( ( Text ) tagElement . getFirstChild ( ) ) . getData ( ) ) ; tags . add ( tag ) ; } return tags ; }
Get a collection of tags used by the specified user .
23,365
public RelatedTagsList getRelated ( String tag ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_RELATED ) ; parameters . put ( "tag" , tag ) ; Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element tagsElement = response . getPayload ( ) ; RelatedTagsList tags = new RelatedTagsList ( ) ; tags . setSource ( tagsElement . getAttribute ( "source" ) ) ; NodeList tagElements = tagsElement . getElementsByTagName ( "tag" ) ; for ( int i = 0 ; i < tagElements . getLength ( ) ; i ++ ) { Element tagElement = ( Element ) tagElements . item ( i ) ; Tag t = new Tag ( ) ; t . setValue ( XMLUtilities . getValue ( tagElement ) ) ; tags . add ( t ) ; } return tags ; }
Get the related tags .
23,366
public static void closeThrowSqlException ( Closeable closeable , String label ) throws SQLException { if ( closeable != null ) { try { closeable . close ( ) ; } catch ( IOException e ) { throw SqlExceptionUtil . create ( "could not close " + label , e ) ; } } }
Close it and ignore any exceptions .
23,367
public static Logger getLogger ( String className ) { if ( logType == null ) { logType = findLogType ( ) ; } return new Logger ( logType . createLog ( className ) ) ; }
Return a logger associated with a particular class name .
23,368
public static String getSimpleClassName ( String className ) { String [ ] parts = className . split ( "\\." ) ; if ( parts . length <= 1 ) { return className ; } else { return parts [ parts . length - 1 ] ; } }
Return the single class name from a class - name string .
23,369
private static LogType findLogType ( ) { String logTypeString = System . getProperty ( LOG_TYPE_SYSTEM_PROPERTY ) ; if ( logTypeString != null ) { try { return LogType . valueOf ( logTypeString ) ; } catch ( IllegalArgumentException e ) { Log log = new LocalLog ( LoggerFactory . class . getName ( ) ) ; log . log ( Level . WARNING , "Could not find valid log-type from system property '" + LOG_TYPE_SYSTEM_PROPERTY + "', value '" + logTypeString + "'" ) ; } } for ( LogType logType : LogType . values ( ) ) { if ( logType . isAvailable ( ) ) { return logType ; } } return LogType . LOCAL ; }
Return the most appropriate log type . This should _never_ return null .
23,370
public void trace ( String msg ) { logIfEnabled ( Level . TRACE , null , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , null ) ; }
Log a trace message .
23,371
public void trace ( Throwable throwable , String msg , Object [ ] argArray ) { logIfEnabled ( Level . TRACE , throwable , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , argArray ) ; }
Log a trace message with a throwable .
23,372
public void info ( Throwable throwable , String msg , Object [ ] argArray ) { logIfEnabled ( Level . INFO , throwable , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , argArray ) ; }
Log a info message with a throwable .
23,373
public void warn ( Throwable throwable , String msg , Object [ ] argArray ) { logIfEnabled ( Level . WARNING , throwable , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , argArray ) ; }
Log a warning message with a throwable .
23,374
public void fatal ( String msg ) { logIfEnabled ( Level . FATAL , null , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , null ) ; }
Log a fatal message .
23,375
public void fatal ( Throwable throwable , String msg , Object [ ] argArray ) { logIfEnabled ( Level . FATAL , throwable , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , argArray ) ; }
Log a fatal message with a throwable .
23,376
public void log ( Level level , String msg ) { logIfEnabled ( level , null , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , null ) ; }
Log a message at the provided level .
23,377
public void log ( Level level , Throwable throwable , String msg , Object [ ] argArray ) { logIfEnabled ( level , throwable , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , argArray ) ; }
Log a message with a throwable at the provided level .
23,378
public synchronized static < D extends Dao < T , ? > , T > D lookupDao ( ConnectionSource connectionSource , Class < T > clazz ) { if ( connectionSource == null ) { throw new IllegalArgumentException ( "connectionSource argument cannot be null" ) ; } ClassConnectionSource key = new ClassConnectionSource ( connectionSource , clazz ) ; Dao < ? , ? > dao = lookupDao ( key ) ; @ SuppressWarnings ( "unchecked" ) D castDao = ( D ) dao ; return castDao ; }
Helper method to lookup a DAO if it has already been associated with the class . Otherwise this returns null .
23,379
public synchronized static < D extends Dao < T , ? > , T > D lookupDao ( ConnectionSource connectionSource , DatabaseTableConfig < T > tableConfig ) { if ( connectionSource == null ) { throw new IllegalArgumentException ( "connectionSource argument cannot be null" ) ; } TableConfigConnectionSource key = new TableConfigConnectionSource ( connectionSource , tableConfig ) ; Dao < ? , ? > dao = lookupDao ( key ) ; if ( dao == null ) { return null ; } else { @ SuppressWarnings ( "unchecked" ) D castDao = ( D ) dao ; return castDao ; } }
Helper method to lookup a DAO if it has already been associated with the table - config . Otherwise this returns null .
23,380
public static synchronized void registerDao ( ConnectionSource connectionSource , Dao < ? , ? > dao ) { if ( connectionSource == null ) { throw new IllegalArgumentException ( "connectionSource argument cannot be null" ) ; } addDaoToClassMap ( new ClassConnectionSource ( connectionSource , dao . getDataClass ( ) ) , dao ) ; }
Register the DAO with the cache . This will allow folks to build a DAO externally and then register so it can be used internally as necessary .
23,381
public static synchronized void unregisterDao ( ConnectionSource connectionSource , Dao < ? , ? > dao ) { if ( connectionSource == null ) { throw new IllegalArgumentException ( "connectionSource argument cannot be null" ) ; } removeDaoToClassMap ( new ClassConnectionSource ( connectionSource , dao . getDataClass ( ) ) ) ; }
Remove a DAO from the cache . This is necessary if we ve registered it already but it throws an exception during configuration .
23,382
public static synchronized void clearDaoCache ( ) { if ( classMap != null ) { classMap . clear ( ) ; classMap = null ; } if ( tableConfigMap != null ) { tableConfigMap . clear ( ) ; tableConfigMap = null ; } }
Clear out our DAO caches .
23,383
public static synchronized void addCachedDatabaseConfigs ( Collection < DatabaseTableConfig < ? > > configs ) { Map < Class < ? > , DatabaseTableConfig < ? > > newMap ; if ( configMap == null ) { newMap = new HashMap < Class < ? > , DatabaseTableConfig < ? > > ( ) ; } else { newMap = new HashMap < Class < ? > , DatabaseTableConfig < ? > > ( configMap ) ; } for ( DatabaseTableConfig < ? > config : configs ) { newMap . put ( config . getDataClass ( ) , config ) ; logger . info ( "Loaded configuration for {}" , config . getDataClass ( ) ) ; } configMap = newMap ; }
This adds database table configurations to the internal cache which can be used to speed up DAO construction . This is especially true of Android and other mobile platforms .
23,384
private static < D , T > D createDaoFromConfig ( ConnectionSource connectionSource , Class < T > clazz ) throws SQLException { if ( configMap == null ) { return null ; } @ SuppressWarnings ( "unchecked" ) DatabaseTableConfig < T > config = ( DatabaseTableConfig < T > ) configMap . get ( clazz ) ; if ( config == null ) { return null ; } Dao < T , ? > configedDao = doCreateDao ( connectionSource , config ) ; @ SuppressWarnings ( "unchecked" ) D castDao = ( D ) configedDao ; return castDao ; }
Creates the DAO if we have config information cached and caches the DAO .
23,385
public < T > void cleanNullReferences ( Class < T > clazz ) { Map < Object , Reference < Object > > objectMap = getMapForClass ( clazz ) ; if ( objectMap != null ) { cleanMap ( objectMap ) ; } }
Run through the map and remove any references that have been null d out by the GC .
23,386
public < T > void cleanNullReferencesAll ( ) { for ( Map < Object , Reference < Object > > objectMap : classMaps . values ( ) ) { cleanMap ( objectMap ) ; } }
Run through all maps and remove any references that have been null d out by the GC .
23,387
public boolean addAll ( Collection < ? extends T > collection ) { boolean changed = false ; for ( T data : collection ) { try { if ( addElement ( data ) ) { changed = true ; } } catch ( SQLException e ) { throw new IllegalStateException ( "Could not create data elements in dao" , e ) ; } } return changed ; }
Add the collection of elements to this collection . This will also them to the associated database table .
23,388
public boolean retainAll ( Collection < ? > collection ) { if ( dao == null ) { return false ; } boolean changed = false ; CloseableIterator < T > iterator = closeableIterator ( ) ; try { while ( iterator . hasNext ( ) ) { T data = iterator . next ( ) ; if ( ! collection . contains ( data ) ) { iterator . remove ( ) ; changed = true ; } } return changed ; } finally { IOUtils . closeQuietly ( iterator ) ; } }
Uses the iterator to run through the dao and retain only the items that are in the passed in collection . This will remove the items from the associated database table as well .
23,389
public void clear ( ) { if ( dao == null ) { return ; } CloseableIterator < T > iterator = closeableIterator ( ) ; try { while ( iterator . hasNext ( ) ) { iterator . next ( ) ; iterator . remove ( ) ; } } finally { IOUtils . closeQuietly ( iterator ) ; } }
Clears the collection and uses the iterator to run through the dao and delete all of the items in the collection from the associated database table . This is different from removing all of the elements in the table since this iterator is across just one item s foreign objects .
23,390
public Where < T , ID > and ( ) { ManyClause clause = new ManyClause ( pop ( "AND" ) , ManyClause . AND_OPERATION ) ; push ( clause ) ; addNeedsFuture ( clause ) ; return this ; }
AND operation which takes the previous clause and the next clause and AND s them together .
23,391
public Where < T , ID > between ( String columnName , Object low , Object high ) throws SQLException { addClause ( new Between ( columnName , findColumnFieldType ( columnName ) , low , high ) ) ; return this ; }
Add a BETWEEN clause so the column must be between the low and high parameters .
23,392
public Where < T , ID > eq ( String columnName , Object value ) throws SQLException { addClause ( new SimpleComparison ( columnName , findColumnFieldType ( columnName ) , value , SimpleComparison . EQUAL_TO_OPERATION ) ) ; return this ; }
Add a = clause so the column must be equal to the value .
23,393
public Where < T , ID > ge ( String columnName , Object value ) throws SQLException { addClause ( new SimpleComparison ( columnName , findColumnFieldType ( columnName ) , value , SimpleComparison . GREATER_THAN_EQUAL_TO_OPERATION ) ) ; return this ; }
Add a &gt ; = clause so the column must be greater - than or equals - to the value .
23,394
public Where < T , ID > gt ( String columnName , Object value ) throws SQLException { addClause ( new SimpleComparison ( columnName , findColumnFieldType ( columnName ) , value , SimpleComparison . GREATER_THAN_OPERATION ) ) ; return this ; }
Add a &gt ; clause so the column must be greater - than the value .
23,395
public Where < T , ID > in ( String columnName , Iterable < ? > objects ) throws SQLException { addClause ( new In ( columnName , findColumnFieldType ( columnName ) , objects , true ) ) ; return this ; }
Add a IN clause so the column must be equal - to one of the objects from the list passed in .
23,396
public Where < T , ID > in ( String columnName , Object ... objects ) throws SQLException { return in ( true , columnName , objects ) ; }
Add a IN clause so the column must be equal - to one of the objects passed in .
23,397
public Where < T , ID > exists ( QueryBuilder < ? , ? > subQueryBuilder ) { subQueryBuilder . enableInnerQuery ( ) ; addClause ( new Exists ( new InternalQueryBuilderWrapper ( subQueryBuilder ) ) ) ; return this ; }
Add a EXISTS clause with a sub - query inside of parenthesis .
23,398
public Where < T , ID > isNull ( String columnName ) throws SQLException { addClause ( new IsNull ( columnName , findColumnFieldType ( columnName ) ) ) ; return this ; }
Add a IS NULL clause so the column must be null . = NULL does not work .
23,399
public Where < T , ID > isNotNull ( String columnName ) throws SQLException { addClause ( new IsNotNull ( columnName , findColumnFieldType ( columnName ) ) ) ; return this ; }
Add a IS NOT NULL clause so the column must not be null . &lt ; &gt ; NULL does not work .