Skip to content
Snippets Groups Projects
Commit 225bc629 authored by cramakri's avatar cramakri
Browse files

LMS-1544 Added query to get datasets associated with a collection of samples.

SVN: 16135
parent 3ec010e7
No related branches found
No related tags found
No related merge requests found
......@@ -168,6 +168,16 @@ public class DatasetLister implements IDatasetLister
}
}
public List<ExternalData> listBySampleIds(Collection<Long> sampleIds)
{
LongSet ids = new LongOpenHashSet();
for (Long id : sampleIds)
{
ids.add(id);
}
return enrichDatasets(query.getDatasetsForSamples(ids));
}
public List<ExternalData> listByExperimentTechIds(Collection<TechId> experimentIds)
{
LongSet ids = new LongOpenHashSet();
......
......@@ -46,12 +46,12 @@ public interface IDatasetLister
/** @return datasets that are parents of a dataset with the specified id */
List<ExternalData> listByChildTechId(TechId childDatasetId);
/** @return datasets that are parents of a dataset with the specified id */
/** @return datasets that are children of a dataset with the specified id */
List<ExternalData> listByParentTechId(TechId parentDatasetId);
/**
* Returns a map with all parent data set IDs of specified data set IDs. The keys of the map
* are IDs from the argument. A value of the map contains at least one alement.
* Returns a map with all parent data set IDs of specified data set IDs. The keys of the map are
* IDs from the argument. A value of the map contains at least one alement.
*/
Map<Long, Set<Long>> listParentIds(Collection<Long> dataSetIDs);
......@@ -65,4 +65,9 @@ public interface IDatasetLister
/** @return datasets specified by given criteria */
List<ExternalData> listByArchiverCriteria(String dataStoreCode, ArchiverDataSetCriteria criteria);
/**
* @return Datasets connected to the samples with the specified ids
*/
List<ExternalData> listBySampleIds(Collection<Long> sampleIds);
}
......@@ -63,6 +63,13 @@ public interface IDatasetListingQuery extends TransactionQuery, IPropertyListing
@Select(sql = "select * from data join external_data on data.id = external_data.data_id where data.samp_id=?{1}", fetchSize = FETCH_SIZE)
public DataIterator<DatasetRecord> getDatasetsForSample(long sampleId);
/**
* Returns the directly connected datasets for the given sample ids.
*/
@Select(sql = "select * from data join external_data on data.id = external_data.data_id where data.samp_id = any(?{1})", parameterBindings =
{ LongSetMapper.class }, fetchSize = FETCH_SIZE)
public DataIterator<DatasetRecord> getDatasetsForSamples(LongSet sampleIds);
/**
* Returns datasets that are newer than dataset with given id (<var>lastSeenDatasetId</var>) and
* are directly connected with samples of sample type with given <var>sampleTypeId</var>.
......@@ -97,11 +104,11 @@ public interface IDatasetListingQuery extends TransactionQuery, IPropertyListing
*/
@Select(sql = "select id from data where data.samp_id=?{1}", fetchSize = FETCH_SIZE)
public DataIterator<Long> getDatasetIdsForSample(long sampleId);
@Select(sql = "select * from data_set_relationships where data_id_child = any(?{1})", parameterBindings =
{ LongSetMapper.class }, fetchSize = FETCH_SIZE)
public DataIterator<DatasetRelationRecord> listParentDataSetIds(LongSet ids);
/**
* Returns the datasets that are children of a dataset with given id.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment