From 11d57067a85c6a8b04236f098a683f9792e0e211 Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Thu, 16 Jun 2011 12:04:44 +0000 Subject: [PATCH] LMS-2317 Added comments and more clearly named arguments. SVN: 21720 --- .../registrator/api/v1/ISearchService.java | 40 +++++++++++++++++-- .../api/v1/impl/SearchService.java | 19 ++++++--- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/ISearchService.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/ISearchService.java index 1ea9aff90ac..ea18b50dc47 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/ISearchService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/ISearchService.java @@ -25,13 +25,47 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; */ public interface ISearchService { - public List<IExperimentImmutable> listExperiments(String projectIdentifier, String type); + /** + * List all experiments for a given project. + * + * @param projectIdentifier The project identifier as a string (e.g., /SPACE-CODE/PROJECT-CODE). + * @return A list of experiments for the specified project. + */ + public List<IExperimentImmutable> listExperiments(String projectIdentifier); - public List<IDataSetImmutable> searchForDataSets(String property, String value, String type); + /** + * List all data sets with a given value for a particular property, optionally restricted to a + * specific type. + * + * @param property The property of interest. + * @param value The value the property should have. This may contain wildcards. + * @return A list of matching data sets. + */ + public List<IDataSetImmutable> searchForDataSets(String property, String value, String typeOrNul); - public List<ISampleImmutable> searchForSamples(String property, String value, String type); + /** + * List all samples with a given value for a particular property, optionally restricted to a + * specific type. + * + * @param property The property of interest. + * @param value The value the property should have. This may contain wildcards. + * @return A list of matching samples. + */ + public List<ISampleImmutable> searchForSamples(String property, String value, String typeOrNull); + /** + * List all data sets that match the given searchCriteria. + * + * @param searchCriteria The criteria to match against. + * @return A list of matching data sets. + */ public List<IDataSetImmutable> searchForDataSets(SearchCriteria searchCriteria); + /** + * List all samples that match the given searchCriteria. + * + * @param searchCriteria The criteria to match against. + * @return A list of matching samples. + */ public List<ISampleImmutable> searchForSamples(SearchCriteria searchCriteria); } diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/SearchService.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/SearchService.java index cbb28c94366..f85cca7faa1 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/SearchService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/SearchService.java @@ -45,7 +45,7 @@ class SearchService implements ISearchService this.openBisService = openBisService; } - public List<IExperimentImmutable> listExperiments(String projectIdentifierString, String type) + public List<IExperimentImmutable> listExperiments(String projectIdentifierString) { ProjectIdentifier projectIdentifier = new ProjectIdentifierFactory(projectIdentifierString.toUpperCase()) @@ -60,18 +60,27 @@ class SearchService implements ISearchService return experiments; } - public List<IDataSetImmutable> searchForDataSets(String property, String value, String type) + public List<IDataSetImmutable> searchForDataSets(String property, String value, + String typeOrNull) { SearchCriteria sc = new SearchCriteria(); - sc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, type)); + if (null != typeOrNull) + { + sc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, + typeOrNull)); + } sc.addMatchClause(MatchClause.createPropertyMatch(property, value)); return searchForDataSets(sc); } - public List<ISampleImmutable> searchForSamples(String property, String value, String type) + public List<ISampleImmutable> searchForSamples(String property, String value, String typeOrNull) { SearchCriteria sc = new SearchCriteria(); - sc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, type)); + if (null != typeOrNull) + { + sc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, + typeOrNull)); + } sc.addMatchClause(MatchClause.createPropertyMatch(property, value)); return searchForSamples(sc); } -- GitLab