2.17.2: 2011-06-17

net.sf.basedb.util.biomaterial
Class SampleToExtractTransformer

java.lang.Object
  extended by 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) $

Field Summary
private  DbControl dc
           
 
Constructor Summary
SampleToExtractTransformer(DbControl dc)
          Create a new Sample-to-extract transformer.
 
Method Summary
protected  ItemQuery<Extract> createQuery()
          Create a query for loading extracts.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dc

private final DbControl dc
Constructor Detail

SampleToExtractTransformer

public SampleToExtractTransformer(DbControl dc)
Create a new Sample-to-extract transformer.

Parameters:
dc - The DbControl to use for database access
Method Detail

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 collection
extracts - 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

2.17.2: 2011-06-17