idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
147,000
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 .
147,001
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 . v...
List the photos with the most views comments or favorites .
147,002
public synchronized GeoInterface getGeoInterface ( ) { if ( geoInterface == null ) { geoInterface = new GeoInterface ( apiKey , sharedSecret , transport ) ; } return geoInterface ; }
Get the geo interface .
147,003
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 , " " , tru...
Add tags to a photo .
147,004
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 , sha...
Delete a photo from flickr .
147,005
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 < Str...
Returns all visble sets and pools the photo belongs to .
147,006
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 photos from the user s contacts .
147,007
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 .
147,008
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 ( ) , parameter...
Get the context for the specified photo .
147,009
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 == n...
Gets a collection of photo counts for the given date ranges for the calling user .
147,010
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" , se...
Get the Exif data for the photo .
147,011
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...
Returns the list of people who have favorited a given photo .
147,012
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 ) ; } Res...
Get all info for the specified photo .
147,013
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 reques...
Return a collection of Photo objects not in part of any sets .
147,014
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 , a...
Get the permission information for the specified photo .
147,015
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 . KE...
Get a collection of recent photos .
147,016
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 ) ; R...
Get the available sizes of a Photo .
147,017
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 ...
Get the collection of untagged photos .
147,018
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 ...
Returns a list of your geo - tagged photos .
147,019
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 , sh...
Remove a tag from a photo .
147,020
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 ( para...
Search for photos which match the given search parameters .
147,021
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 ) ...
Search for interesting photos using the Flickr Interestingness algorithm .
147,022
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 ) ; ...
Set the content type of a photo .
147,023
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 != n...
Set the dates for the specified photo .
147,024
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 ....
Set the meta data for the photo .
147,025
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...
Set the permissions for the photo .
147,026
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 ...
Checks the status of one or more asynchronous photo upload tickets . This method does not require authentication .
147,027
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.prox...
Set a proxy for REST - requests .
147,028
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 .
147,029
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 ( ) ) { re...
Invoke an HTTP GET request on a remote host . You must close the InputStream after you are done with .
147,030
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 )...
Add a comment to a photoset . This method requires authentication with write permission .
147,031
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 ...
convert filename to clean filename
147,032
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 ...
Get permissions for who may view geo data for a photo .
147,033
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" : ...
Set the permission for who may view the geo data associated with a photo .
147,034
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_FO...
Return a list of photos for a user at a specific latitude longitude and accuracy .
147,035
private Collection parseCollection ( Element collectionElement ) { Collection collection = new Collection ( ) ; collection . setId ( collectionElement . getAttribute ( "id" ) ) ; collection . setServer ( collectionElement . getAttribute ( "server" ) ) ; collection . setSecret ( collectionElement . getAttribute ( "secre...
Parse the XML for a collection as returned by getInfo call .
147,036
private Collection parseTreeCollection ( Element collectionElement ) { Collection collection = new Collection ( ) ; parseCommonFields ( collectionElement , collection ) ; collection . setTitle ( collectionElement . getAttribute ( "title" ) ) ; collection . setDescription ( collectionElement . getAttribute ( "descriptio...
Parse the XML for a collection as returned by getTree call .
147,037
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 .
147,038
public static Element getChild ( Element element , String name ) { return ( Element ) element . getElementsByTagName ( name ) . item ( 0 ) ; }
Get the first child element with the given name .
147,039
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 .
147,040
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...
Find the user by their email address .
147,041
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 ) ; Res...
Get a collection of public groups for the user .
147,042
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_PHO...
Get a collection of public photos for the specified user ID .
147,043
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 . isEr...
Get upload status for the currently authenticated user .
147,044
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
147,045
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 .
147,046
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 ( ) ) { t...
Get s the user s current upload limits User object only contains user_id
147,047
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" , ...
Return the list of galleries created by a user . Sorted from newest to oldest .
147,048
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 (...
Add a note to a photo . The Note object bounds and text must be specified .
147,049
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_...
Update a note .
147,050
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 . isE...
Fetches a list of available photo licenses for Flickr .
147,051
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 ...
Sets the license for a photo .
147,052
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...
Returns the first 24 photos for a given tag cluster .
147,053
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 ( ) , param...
Get a list of tags for the specified photo .
147,054
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 ( )...
Get a collection of tags used by the specified user .
147,055
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 , ...
Get the related tags .
147,056
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 .
147,057
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 .
147,058
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 .
147,059
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 ( Leve...
Return the most appropriate log type . This should _never_ return null .
147,060
public void trace ( String msg ) { logIfEnabled ( Level . TRACE , null , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , null ) ; }
Log a trace message .
147,061
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 .
147,062
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 .
147,063
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 .
147,064
public void fatal ( String msg ) { logIfEnabled ( Level . FATAL , null , msg , UNKNOWN_ARG , UNKNOWN_ARG , UNKNOWN_ARG , null ) ; }
Log a fatal message .
147,065
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 .
147,066
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 .
147,067
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 .
147,068
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 ( connectionSou...
Helper method to lookup a DAO if it has already been associated with the class . Otherwise this returns null .
147,069
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 TableConfig...
Helper method to lookup a DAO if it has already been associated with the table - config . Otherwise this returns null .
147,070
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 .
147,071
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 .
147,072
public static synchronized void clearDaoCache ( ) { if ( classMap != null ) { classMap . clear ( ) ; classMap = null ; } if ( tableConfigMap != null ) { tableConfigMap . clear ( ) ; tableConfigMap = null ; } }
Clear out our DAO caches .
147,073
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 < ? > , Databas...
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 .
147,074
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 ) ...
Creates the DAO if we have config information cached and caches the DAO .
147,075
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 .
147,076
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 .
147,077
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 .
147,078
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 ( ) ; ...
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 .
147,079
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 .
147,080
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 .
147,081
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 .
147,082
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 .
147,083
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 .
147,084
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 .
147,085
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 .
147,086
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 .
147,087
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 .
147,088
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 .
147,089
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 .
147,090
public Where < T , ID > le ( String columnName , Object value ) throws SQLException { addClause ( new SimpleComparison ( columnName , findColumnFieldType ( columnName ) , value , SimpleComparison . LESS_THAN_EQUAL_TO_OPERATION ) ) ; return this ; }
Add a &lt ; = clause so the column must be less - than or equals - to the value .
147,091
public Where < T , ID > lt ( String columnName , Object value ) throws SQLException { addClause ( new SimpleComparison ( columnName , findColumnFieldType ( columnName ) , value , SimpleComparison . LESS_THAN_OPERATION ) ) ; return this ; }
Add a &lt ; clause so the column must be less - than the value .
147,092
public Where < T , ID > like ( String columnName , Object value ) throws SQLException { addClause ( new SimpleComparison ( columnName , findColumnFieldType ( columnName ) , value , SimpleComparison . LIKE_OPERATION ) ) ; return this ; }
Add a LIKE clause so the column must mach the value using % patterns .
147,093
public Where < T , ID > ne ( String columnName , Object value ) throws SQLException { addClause ( new SimpleComparison ( columnName , findColumnFieldType ( columnName ) , value , SimpleComparison . NOT_EQUAL_TO_OPERATION ) ) ; return this ; }
Add a &lt ; &gt ; clause so the column must be not - equal - to the value .
147,094
public Where < T , ID > not ( ) { Not not = new Not ( ) ; addClause ( not ) ; addNeedsFuture ( not ) ; return this ; }
Used to NOT the next clause specified .
147,095
public Where < T , ID > not ( Where < T , ID > comparison ) { addClause ( new Not ( pop ( "NOT" ) ) ) ; return this ; }
Used to NOT the argument clause specified .
147,096
public Where < T , ID > or ( ) { ManyClause clause = new ManyClause ( pop ( "OR" ) , ManyClause . OR_OPERATION ) ; push ( clause ) ; addNeedsFuture ( clause ) ; return this ; }
OR operation which takes the previous clause and the next clause and OR s them together .
147,097
public Where < T , ID > or ( Where < T , ID > left , Where < T , ID > right , Where < T , ID > ... others ) { Clause [ ] clauses = buildClauseArray ( others , "OR" ) ; Clause secondClause = pop ( "OR" ) ; Clause firstClause = pop ( "OR" ) ; addClause ( new ManyClause ( firstClause , secondClause , clauses , ManyClause ...
OR operation which takes 2 arguments and OR s them together .
147,098
public Where < T , ID > idEq ( ID id ) throws SQLException { if ( idColumnName == null ) { throw new SQLException ( "Object has no id column specified" ) ; } addClause ( new SimpleComparison ( idColumnName , idFieldType , id , SimpleComparison . EQUAL_TO_OPERATION ) ) ; return this ; }
Add a clause where the ID is equal to the argument .
147,099
public < OD > Where < T , ID > idEq ( Dao < OD , ? > dataDao , OD data ) throws SQLException { if ( idColumnName == null ) { throw new SQLException ( "Object has no id column specified" ) ; } addClause ( new SimpleComparison ( idColumnName , idFieldType , dataDao . extractId ( data ) , SimpleComparison . EQUAL_TO_OPERA...
Add a clause where the ID is from an existing object .