net.sf.basedb.util.biomaterial
Class SampleToExtractTransformer
java.lang.Object
net.sf.basedb.util.biomaterial.SampleToExtractTransformer
- All Implemented Interfaces:
- CollectionTransformer<Sample,Extract>
public class SampleToExtractTransformer
- extends Object
- implements CollectionTransformer<Sample,Extract>
Collection transformer that given a collection of samples finds
child extracts which has the samples as parents. Note that this
transformer is only capable of finding extracts that are immediate
children to the samples. If you want to include extracts that are
children to pooled samples, you should combine this transformer
with a PooledChildrenTransformer
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 final DbControl dc
SampleToExtractTransformer
public SampleToExtractTransformer(DbControl dc)
- Create a new Sample-to-extract transformer.
- Parameters:
dc
- The DbControl to use for database access
transform
public int transform(Collection<? extends Sample> samples,
Collection<? super Extract> extracts)
- Add all extracts that are children to any of the samples in the
source collection.
- Specified by:
transform
in interface CollectionTransformer<Sample,Extract>
- Parameters:
samples
- The source collectionextracts
- The destination collection
- Returns:
- The number of extracts added
createQuery
protected ItemQuery<Extract> createQuery()
- Create a query for loading extracts. The default implemenation will
simply load all extracts. The restriction needed to locate the samples
that are parents 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