Package org.intermine.dataloader
Class HintingFetcher
- java.lang.Object
-
- org.intermine.dataloader.BaseEquivalentObjectFetcher
-
- org.intermine.dataloader.HintingFetcher
-
- All Implemented Interfaces:
EquivalentObjectFetcher
- Direct Known Subclasses:
BatchingFetcher
public class HintingFetcher extends BaseEquivalentObjectFetcher
Class providing EquivalentObjectFetcher functionality that makes use of hints to improve performance.- Author:
- Matthew Wakeling
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Class<?>,java.lang.Boolean>
allPkClassesEmptyForClass
protected java.util.Map<java.lang.String,java.lang.Integer>
savedCounts
protected java.util.Map<java.lang.String,java.lang.Long>
savedTimes
-
Fields inherited from class org.intermine.dataloader.BaseEquivalentObjectFetcher
idMap, lookupOs, model, summaryCallCounts, summaryCounts, summaryTimes
-
-
Constructor Summary
Constructors Constructor Description HintingFetcher(BaseEquivalentObjectFetcher fetcher)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close(Source source)
Close method - prints out summary data.java.util.Set<Query>
createPKQueriesForClass(InterMineObject obj, Source source, boolean queryNulls, ClassDescriptor cld)
Generates a query that searches for all objects in the database equivalent to a given example object, considering only one of it's classes.void
createPKQueryForPK(InterMineObject obj, boolean queryNulls, ClassDescriptor cld, PrimaryKey pk, Source source, java.util.Set<Query> returnSet)
Adds a Query to handle a primary key to a Set.protected java.lang.StringBuffer
getSummary(Source source)
Returns a StringBuffer containing summary information.java.util.Set<InterMineObject>
queryEquivalentObjects(InterMineObject obj, Source source)
Returns a Set of objects that are equivalent to the given object, according to the primary keys defined by the given Source.-
Methods inherited from class org.intermine.dataloader.BaseEquivalentObjectFetcher
createPKQuery, getIdMap, getLookupOs, getModel
-
-
-
-
Constructor Detail
-
HintingFetcher
public HintingFetcher(BaseEquivalentObjectFetcher fetcher)
Constructor- Parameters:
fetcher
- another EquivalentObjectFetcher
-
-
Method Detail
-
close
public void close(Source source)
Close method - prints out summary data.- Overrides:
close
in classBaseEquivalentObjectFetcher
- Parameters:
source
- the Source used
-
getSummary
protected java.lang.StringBuffer getSummary(Source source)
Returns a StringBuffer containing summary information.- Overrides:
getSummary
in classBaseEquivalentObjectFetcher
- Parameters:
source
- the Source used- Returns:
- a StringBuffer
-
queryEquivalentObjects
public java.util.Set<InterMineObject> queryEquivalentObjects(InterMineObject obj, Source source) throws ObjectStoreException
Returns a Set of objects that are equivalent to the given object, according to the primary keys defined by the given Source.- Specified by:
queryEquivalentObjects
in interfaceEquivalentObjectFetcher
- Overrides:
queryEquivalentObjects
in classBaseEquivalentObjectFetcher
- Parameters:
obj
- the Object to look forsource
- the data Source- Returns:
- a Set of InterMineObjects
- Throws:
ObjectStoreException
- if an error occurs
-
createPKQueriesForClass
public java.util.Set<Query> createPKQueriesForClass(InterMineObject obj, Source source, boolean queryNulls, ClassDescriptor cld) throws MetaDataException
Generates a query that searches for all objects in the database equivalent to a given example object, considering only one of it's classes.- Specified by:
createPKQueriesForClass
in interfaceEquivalentObjectFetcher
- Overrides:
createPKQueriesForClass
in classBaseEquivalentObjectFetcher
- Parameters:
obj
- the Object to take as an examplesource
- the Source databasequeryNulls
- if true allow primary keys to contain null values if the template obj has nulls. If false the Query will constrain only those keys that have a value in the template objcld
- one of the classes that obj is. Only primary keys for this classes will be considered- Returns:
- a new Query (or null if all the primary keys from obj contain a null)
- Throws:
MetaDataException
- if anything goes wrong
-
createPKQueryForPK
public void createPKQueryForPK(InterMineObject obj, boolean queryNulls, ClassDescriptor cld, PrimaryKey pk, Source source, java.util.Set<Query> returnSet) throws MetaDataException
Adds a Query to handle a primary key to a Set.- Overrides:
createPKQueryForPK
in classBaseEquivalentObjectFetcher
- Parameters:
obj
- an InterMineObjectqueryNulls
- true to make null a valid value, false to make null ignore the keycld
- the ClassDescriptor for the keypk
- the PrimaryKeysource
- the Source of the objectreturnSet
- the Set to which the Query will be added- Throws:
MetaDataException
- if something goes wrong
-
-