2.17.2: 2011-06-17

net.sf.basedb.util.biomaterial
Class BioSourceToSampleTransformer

java.lang.Object
  extended by net.sf.basedb.util.biomaterial.BioSourceToSampleTransformer
All Implemented Interfaces:
CollectionTransformer<BioSource,Sample>

public class BioSourceToSampleTransformer
extends Object
implements CollectionTransformer<BioSource,Sample>

Collection transformer that given a collection of biosources finds all samples that has the biosources as parents.

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
BioSourceToSampleTransformer(DbControl dc)
           
 
Method Summary
protected  ItemQuery<Sample> createQuery()
          Create a query for loading samples.
 int transform(Collection<? extends BioSource> bioSources, Collection<? super Sample> samples)
          Add all samples that are children to any of the biosources 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 DbControl dc
Constructor Detail

BioSourceToSampleTransformer

public BioSourceToSampleTransformer(DbControl dc)
Method Detail

transform

public int transform(Collection<? extends BioSource> bioSources,
                     Collection<? super Sample> samples)
Add all samples that are children to any of the biosources in the source collection.

Specified by:
transform in interface CollectionTransformer<BioSource,Sample>
Parameters:
bioSources - The source collection
samples - The destination collection
Returns:
The number of samples added

createQuery

protected ItemQuery<Sample> createQuery()
Create a query for loading samples. The default implemenation will simply load all samples. The restriction needed to locate the biosources 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