From 7d4fd00924899ad62a6044d659a8b13c9d7c834d Mon Sep 17 00:00:00 2001 From: jakubs <jakubs> Date: Fri, 5 Sep 2014 09:05:08 +0000 Subject: [PATCH] SSDM-715 implement searchForExperiment in search service SVN: 32416 --- .../api/v2/impl/SearchService.java | 13 +++++++ ...capsulatedFilteredBasicOpenBISService.java | 9 +++++ .../server/EncapsulatedOpenBISService.java | 6 ++++ .../IEncapsulatedBasicOpenBISService.java | 5 +++ .../api/internal/v2/ISearchService.java | 36 +++++++++---------- 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v2/impl/SearchService.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v2/impl/SearchService.java index bc3cfbba532..0f70f41309d 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v2/impl/SearchService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v2/impl/SearchService.java @@ -183,6 +183,19 @@ public class SearchService implements ISearchService return samples; } + @Override + public List<IExperimentImmutable> searchForExperiments(SearchCriteria searchCriteria) + { + + List<Experiment> serverExperiments = openBisService.searchForExperiments(searchCriteria); + ArrayList<IExperimentImmutable> experiments = new ArrayList<IExperimentImmutable>(serverExperiments.size()); + for (Experiment experiment : serverExperiments) + { + experiments.add(new ExperimentImmutable(experiment)); + } + return experiments; + } + @Override public List<IMaterialImmutable> listMaterials(MaterialIdentifierCollection identifierCollection) { diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedFilteredBasicOpenBISService.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedFilteredBasicOpenBISService.java index 6c542db8a3b..ea6b09a14ba 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedFilteredBasicOpenBISService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedFilteredBasicOpenBISService.java @@ -134,6 +134,15 @@ public class EncapsulatedFilteredBasicOpenBISService implements IEncapsulatedBas sampleIdMapper, AuthorizationHelper.EntityKind.SAMPLE); } + @Override + public List<Experiment> searchForExperiments(SearchCriteria searchCriteria) + { + List<Experiment> experiments = etlService.searchForExperiments(systemSessionToken, searchCriteria); + + return AuthorizationHelper.filterToVisible(encapsulatedService, userName, experiments, experimentIdMapper, + AuthorizationHelper.EntityKind.EXPERIMENT); + } + @Override @ManagedAuthentication public Sample tryGetSampleWithExperiment(SampleIdentifier sampleIdentifier) diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedOpenBISService.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedOpenBISService.java index 9d99ebbfb4a..fe33627d51a 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedOpenBISService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/EncapsulatedOpenBISService.java @@ -824,6 +824,12 @@ public final class EncapsulatedOpenBISService implements IEncapsulatedOpenBISSer return service.searchForDataSets(session.getSessionToken(), searchCriteria); } + @Override + public List<Experiment> searchForExperiments(SearchCriteria searchCriteria) + { + return service.searchForExperiments(session.getSessionToken(), searchCriteria); + } + @Override public List<Project> listProjects() { diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IEncapsulatedBasicOpenBISService.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IEncapsulatedBasicOpenBISService.java index c52763ab24a..630493df990 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IEncapsulatedBasicOpenBISService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/IEncapsulatedBasicOpenBISService.java @@ -95,6 +95,11 @@ public interface IEncapsulatedBasicOpenBISService @ManagedAuthentication public List<Sample> searchForSamples(SearchCriteria searchCriteria); + /** + * {@link IServiceForDataStoreServer#searchForExperiments(String, SearchCriteria)} + */ + public List<Experiment> searchForExperiments(SearchCriteria searchCriteria); + /** * Gets a sample with the specified identifier. Sample is enriched with properties and the experiment with properties. * diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/internal/v2/ISearchService.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/internal/v2/ISearchService.java index 3055778da37..8a5b6510d8c 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/internal/v2/ISearchService.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/internal/v2/ISearchService.java @@ -34,8 +34,7 @@ public interface ISearchService public List<IExperimentImmutable> listExperiments(String projectIdentifier); /** - * List all data sets with a given value for a particular property, optionally restricted to a - * specific 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. @@ -45,12 +44,10 @@ public interface ISearchService String typeOrNull); /** - * List all data sets with a given value for a particular property, optionally restricted to a - * specific 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 if - * <var>escape</var> is set to <code>false</code>. + * @param value The value the property should have. This may contain wildcards if <var>escape</var> is set to <code>false</code>. * @param escape If <code>true</code>, escape the <var>value</var> to search for it verbatimly. * @return A list of matching data sets. */ @@ -58,8 +55,7 @@ public interface ISearchService String typeOrNull, boolean escape); /** - * List all samples with a given value for a particular property, optionally restricted to a - * specific 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. @@ -68,12 +64,10 @@ public interface ISearchService public List<ISampleImmutable> searchForSamples(String property, String value, String typeOrNull); /** - * List all samples with a given value for a particular property, optionally restricted to a - * specific 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 if - * <var>escape</var> is set to <code>false</code>. + * @param value The value the property should have. This may contain wildcards if <var>escape</var> is set to <code>false</code>. * @param escape If <code>true</code>, escape the <var>value</var> to search for it verbatimly. * @return A list of matching samples. */ @@ -97,23 +91,29 @@ public interface ISearchService public List<ISampleImmutable> searchForSamples(SearchCriteria searchCriteria); /** - * @param identifierCollection a collection containing the identifiers of the matching - * materials. Identifiers that do not exist in the openBIS database are ignored. + * List all experiments that match the given searchCriteria. + * + * @param searchCriteria The criteria to match against. + * @return A list of matching experiments. + */ + public List<IExperimentImmutable> searchForExperiments(SearchCriteria searchCriteria); + + /** + * @param identifierCollection a collection containing the identifiers of the matching materials. Identifiers that do not exist in the openBIS + * database are ignored. * @return a list of materials matching the specified collection. */ public List<IMaterialImmutable> listMaterials(MaterialIdentifierCollection identifierCollection); /** - * @return a controlled vocabulary with the given code. Returns null if the vocabulary with - * given code is not found. + * @return a controlled vocabulary with the given code. Returns null if the vocabulary with given code is not found. * @deprecated use {@link #getVocabulary(String)} instead */ @Deprecated public IVocabularyImmutable searchForVocabulary(String code); /** - * @return a controlled vocabulary with the given code. Returns null if the vocabulary with - * given code is not found. + * @return a controlled vocabulary with the given code. Returns null if the vocabulary with given code is not found. */ public IVocabularyImmutable getVocabulary(String code); -- GitLab