net.sf.basedb.util.biomaterial
Class SampleToBioSourceTransformer
java.lang.Object
net.sf.basedb.util.biomaterial.SampleToBioSourceTransformer
- All Implemented Interfaces:
- CollectionTransformer<Sample,BioSource>
public class SampleToBioSourceTransformer
- extends Object
- implements CollectionTransformer<Sample,BioSource>
Collection transformer that given a collection of samples finds
their parent biosources. Note that this transformer is only capable
of finding the biosources that are immediate
parents to the samples. If you want to follow pooled samples up
to biosources, you should combine this transformer
and a PooledParentsTransformer
with the help of a
MultiStepCollectionTransformer
.
- Version:
- 2.10
- Author:
- Nicklas
- Last modified
- $Date: 2009-01-13 09:20:26 +0100 (Tue, 13 Jan 2009) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dc
private DbControl dc
SampleToBioSourceTransformer
public SampleToBioSourceTransformer(DbControl dc)
transform
public int transform(Collection<? extends Sample> samples,
Collection<? super BioSource> bioSources)
- Add all biosources that are parents to any of the samples in the
source collection.
- Specified by:
transform
in interface CollectionTransformer<Sample,BioSource>
- Parameters:
samples
- The source collectionbioSources
- The destination collection
- Returns:
- The number of biosources added
createQuery
protected ItemQuery<BioSource> createQuery()
- Create a query for loading biosources. The default implemenation will
simply load all biosources. The restriction needed to locate the child
samples is automatically applied by the
transform
method. Subclasses may override this method to create an alternate query
(for example, with more filters).
- Returns:
- A query object