Class OpenbisServiceFacade
- java.lang.Object
-
- ch.systemsx.cisd.openbis.dss.client.api.v1.impl.OpenbisServiceFacade
-
- All Implemented Interfaces:
IOpenbisServiceFacade,ISimpleOpenbisServiceFacade
public class OpenbisServiceFacade extends java.lang.Object implements IOpenbisServiceFacade
Default implementation forIOpenbisServiceFacade.
-
-
Constructor Summary
Constructors Constructor Description OpenbisServiceFacade(java.lang.String sessionToken, IGeneralInformationService service, IGeneralInformationChangingService changingService, IDssComponent dssComponent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAdHocVocabularyTerm(TechId vocabularyId, java.lang.String code, java.lang.String label, java.lang.String description, java.lang.Long previousTermOrdinal)Adds new ad-hoc terms to a vocabulary starting from specified ordinal + 1.voidaddAdHocVocabularyTerm(java.lang.Long vocabularyId, NewVocabularyTerm term)Adds new ad-hoc terms to a vocabulary starting from specified ordinal + 1.voidcheckSession()Checks whether the session is alive.java.util.Map<java.lang.String,java.lang.String>extractMetadata(NewDataSetDTO newDataset, java.io.File dataSetFile)Extracts metadata from a file.DataSetgetDataSet(java.lang.String dataSetCode)Return aDataSetobject for for the given code.IDataSetDssgetDataSetDss(java.lang.String code)java.util.List<DataSet>getDataSets(java.util.List<java.lang.String> dataSetCodes)ReturnDataSetobjects for given a set of codes.java.util.List<Experiment>getExperiments(java.util.List<java.lang.String> experimentIdentifiers)ReturnExperimentobjects for a set of given experiment identifiers.intgetMinorVersionInformationService()Returns the minor version of the general information service.java.util.List<Sample>getSamples(java.util.List<java.lang.String> sampleIdentifiers)ReturnSampleobjects for a set of given sample identifiers.java.util.List<Sample>getSamples(java.util.List<java.lang.String> sampleIdentifiers, java.util.EnumSet<SampleFetchOption> fetchOptions)ReturnSampleobjects for a set of given sample identifiers.java.util.List<SpaceWithProjectsAndRoleAssignments>getSpacesWithProjects()Return all spaces enriched with their projects and role assignments.java.util.HashMap<Vocabulary,java.util.List<ControlledVocabularyPropertyType.VocabularyTerm>>getVocabularyTermsMap()Returns map of avaialable vocabulary terms.WebAppSettingsgetWebAppSettings(java.lang.String webAppId)Returns the persistent settings for a given custom web app.java.util.List<DataSet>listDataSets(java.util.List<Sample> samples, java.util.EnumSet<DataSet.Connections> connectionsToGet)Return all data sets attached to the given samples with connections.java.util.List<DataSet>listDataSetsForExperiment(java.lang.String experimentPermId)Returns all data sets of specified experiment.java.util.List<DataSet>listDataSetsForExperiments(java.util.List<java.lang.String> experimentIdentifiers)Return all data sets for a given list of experiments identifiers.java.util.List<DataSet>listDataSetsForSample(java.lang.String samplePermId)Returns all data sets of specified sample.java.util.List<DataSet>listDataSetsForSamples(java.util.List<java.lang.String> sampleIdentifiers)Return all data sets for a given list of sample identifiers.java.util.List<DataSetType>listDataSetTypes()Returns all data set types available in openBIS.java.util.List<Experiment>listExperimentsForProjects(java.util.List<java.lang.String> projectIdentifiers)Return all experiments for a given list of project identifiers.java.util.List<Experiment>listExperimentsHavingDataSetsForProjects(java.util.List<java.lang.String> projectIdentifiers)Return all experiments having data sets for a given list of project identifiers.java.util.List<Experiment>listExperimentsHavingSamplesForProjects(java.util.List<java.lang.String> projectIdentifiers)Return all experiments having samples for a given list of project identifiers.java.util.List<ExperimentType>listExperimentTypes()Returns all experiment types available in openBIS.java.util.List<Project>listProjects()Returns all available projects.java.util.List<Sample>listSamplesForExperimentAndSampleType(java.lang.String experimentPermId, java.lang.String sampleType)Returns all samples for specified experiment and of specified type.java.util.List<Sample>listSamplesForExperiments(java.util.List<java.lang.String> experimentIdentifiers)Return all samples for a given list of experiments identifiers.java.util.List<Sample>listSamplesForExperiments(java.util.List<java.lang.String> experimentIdentifiers, java.util.EnumSet<SampleFetchOption> fetchOptions)Return all samples for a given list of experiments identifiers.java.util.List<Sample>listSamplesForProjects(java.util.List<java.lang.String> projectIdentifiers)Return all samples for a given list of project identifiers.java.util.List<Sample>listSamplesForProjects(java.util.List<java.lang.String> projectIdentifiers, java.util.EnumSet<SampleFetchOption> fetchOptions)Return all samples for a given list of project identifiers.java.util.List<Sample>listSamplesOfSample(java.lang.String samplePermId)Returns all samples which are components or children of the specified sample.java.util.List<SampleType>listSampleTypes()Returns all sample types available in openBIS.java.util.List<Vocabulary>listVocabularies()Return all vocabularies available in openBIS together with the contained vocabulary terms.voidlogout()Logs out from openBIS and frees all associated resources on the server.DataSetputDataSet(NewDataSetDTO newDataset, java.io.File dataSetFile)Upload a new data set to the DSS.java.util.List<DataSet>searchForDataSets(SearchCriteria searchCriteria)Return all data sets matching a specified search criteria.java.util.List<Experiment>searchForExperiments(SearchCriteria searchCriteria)Returns all experiments matching specified search criteria.java.util.List<Sample>searchForSamples(SearchCriteria searchCriteria)Return all samples that match the search criteria.java.util.List<Sample>searchForSamples(SearchCriteria searchCriteria, java.util.EnumSet<SampleFetchOption> fetchOptions)Return all samples that match the search criteria.voidsetWebAppSettings(WebAppSettings customDisplaySettings)Sets the persistent settings for a given custom web app.static IOpenbisServiceFacadetryCreate(java.lang.String sessionToken, java.lang.String openbisUrl, long timeoutInMillis)static IOpenbisServiceFacadetryCreate(java.lang.String username, java.lang.String password, java.lang.String openbisUrl, long timeoutInMillis)java.util.List<ValidationError>validateDataSet(NewDataSetDTO newDataset, java.io.File dataSetFile)Validates a data set.
-
-
-
Constructor Detail
-
OpenbisServiceFacade
public OpenbisServiceFacade(java.lang.String sessionToken, IGeneralInformationService service, IGeneralInformationChangingService changingService, IDssComponent dssComponent)
-
-
Method Detail
-
tryCreate
public static IOpenbisServiceFacade tryCreate(java.lang.String username, java.lang.String password, java.lang.String openbisUrl, long timeoutInMillis)
-
tryCreate
public static IOpenbisServiceFacade tryCreate(java.lang.String sessionToken, java.lang.String openbisUrl, long timeoutInMillis)
-
listProjects
public java.util.List<Project> listProjects()
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all available projects.- Specified by:
listProjectsin interfaceISimpleOpenbisServiceFacade
-
getSpacesWithProjects
public java.util.List<SpaceWithProjectsAndRoleAssignments> getSpacesWithProjects() throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all spaces enriched with their projects and role assignments.- Specified by:
getSpacesWithProjectsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
getExperiments
public java.util.List<Experiment> getExperiments(java.util.List<java.lang.String> experimentIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturnExperimentobjects for a set of given experiment identifiers. If some of the specified experiment identifiers does not exist in openBIS it will be silently ignored.- Specified by:
getExperimentsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
listExperimentsForProjects
public java.util.List<Experiment> listExperimentsForProjects(java.util.List<java.lang.String> projectIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all experiments for a given list of project identifiers. If some of the specified project identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listExperimentsForProjectsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
listExperimentsHavingSamplesForProjects
public java.util.List<Experiment> listExperimentsHavingSamplesForProjects(java.util.List<java.lang.String> projectIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all experiments having samples for a given list of project identifiers. If some of the specified project identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listExperimentsHavingSamplesForProjectsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
listExperimentsHavingDataSetsForProjects
public java.util.List<Experiment> listExperimentsHavingDataSetsForProjects(java.util.List<java.lang.String> projectIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all experiments having data sets for a given list of project identifiers. If some of the specified project identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listExperimentsHavingDataSetsForProjectsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
getSamples
public java.util.List<Sample> getSamples(java.util.List<java.lang.String> sampleIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturnSampleobjects for a set of given sample identifiers. If some of the specified sample identifiers does not exist in openBIS it will be silently ignored.- Specified by:
getSamplesin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
getSamples
public java.util.List<Sample> getSamples(java.util.List<java.lang.String> sampleIdentifiers, java.util.EnumSet<SampleFetchOption> fetchOptions)
Description copied from interface:ISimpleOpenbisServiceFacadeReturnSampleobjects for a set of given sample identifiers. If some of the specified sample identifiers does not exist in openBIS it will be silently ignored.- Specified by:
getSamplesin interfaceISimpleOpenbisServiceFacade- Parameters:
sampleIdentifiers- sample identifiers for which samples should be retrievedfetchOptions- Options that control which parts of the samples are fetched.
-
listSamplesForExperiments
public java.util.List<Sample> listSamplesForExperiments(java.util.List<java.lang.String> experimentIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all samples for a given list of experiments identifiers. If some of the specified experiment identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listSamplesForExperimentsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
listSamplesForExperiments
public java.util.List<Sample> listSamplesForExperiments(java.util.List<java.lang.String> experimentIdentifiers, java.util.EnumSet<SampleFetchOption> fetchOptions)
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all samples for a given list of experiments identifiers. If some of the specified experiment identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listSamplesForExperimentsin interfaceISimpleOpenbisServiceFacade- Parameters:
experimentIdentifiers- experiment identifiers for which samples should be retrievedfetchOptions- Options that control which parts of the samples are fetched.
-
listSamplesForExperimentAndSampleType
public java.util.List<Sample> listSamplesForExperimentAndSampleType(java.lang.String experimentPermId, java.lang.String sampleType)
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all samples for specified experiment and of specified type.- Specified by:
listSamplesForExperimentAndSampleTypein interfaceISimpleOpenbisServiceFacade- Returns:
- an empty list if specified identifier and/or type do not exist.
-
listSamplesOfSample
public java.util.List<Sample> listSamplesOfSample(java.lang.String samplePermId)
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all samples which are components or children of the specified sample.- Specified by:
listSamplesOfSamplein interfaceISimpleOpenbisServiceFacade- Returns:
- an empty list if the specified sample does not exist.
-
listSamplesForProjects
public java.util.List<Sample> listSamplesForProjects(java.util.List<java.lang.String> projectIdentifiers)
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all samples for a given list of project identifiers. If some of the specified project identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listSamplesForProjectsin interfaceISimpleOpenbisServiceFacade
-
listSamplesForProjects
public java.util.List<Sample> listSamplesForProjects(java.util.List<java.lang.String> projectIdentifiers, java.util.EnumSet<SampleFetchOption> fetchOptions)
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all samples for a given list of project identifiers. If some of the specified project identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listSamplesForProjectsin interfaceISimpleOpenbisServiceFacade- Parameters:
projectIdentifiers- project identifiers for which samples should be retrievedfetchOptions- Options that control which parts of the samples are fetched.
-
getDataSet
public DataSet getDataSet(java.lang.String dataSetCode) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn aDataSetobject for for the given code. If some of the specified data set code does not exist in openBIS, null will be returned.- Specified by:
getDataSetin interfaceISimpleOpenbisServiceFacade- Returns:
- The requested data set, or null if it does not exist.
- Throws:
EnvironmentFailureException
-
getDataSets
public java.util.List<DataSet> getDataSets(java.util.List<java.lang.String> dataSetCodes) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturnDataSetobjects for given a set of codes. If some of the specified data set codes does not exist in openBIS it will be silently ignored.- Specified by:
getDataSetsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
listDataSetsForExperiments
public java.util.List<DataSet> listDataSetsForExperiments(java.util.List<java.lang.String> experimentIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all data sets for a given list of experiments identifiers. If some of the specified experiment identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listDataSetsForExperimentsin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
listDataSetsForExperiment
public java.util.List<DataSet> listDataSetsForExperiment(java.lang.String experimentPermId)
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all data sets of specified experiment.- Specified by:
listDataSetsForExperimentin interfaceISimpleOpenbisServiceFacade- Returns:
- an empty list if the experiment does not exists.
-
listDataSetsForSamples
public java.util.List<DataSet> listDataSetsForSamples(java.util.List<java.lang.String> sampleIdentifiers) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all data sets for a given list of sample identifiers. If some of the specified sample identifiers does not exist in openBIS it will be silently ignored.- Specified by:
listDataSetsForSamplesin interfaceISimpleOpenbisServiceFacade- Throws:
EnvironmentFailureException
-
listDataSetsForSample
public java.util.List<DataSet> listDataSetsForSample(java.lang.String samplePermId)
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all data sets of specified sample.- Specified by:
listDataSetsForSamplein interfaceISimpleOpenbisServiceFacade- Returns:
- an empty list if the sample does not exists.
-
listDataSetTypes
public java.util.List<DataSetType> listDataSetTypes()
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all data set types available in openBIS.- Specified by:
listDataSetTypesin interfaceISimpleOpenbisServiceFacade
-
listSampleTypes
public java.util.List<SampleType> listSampleTypes()
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all sample types available in openBIS.- Specified by:
listSampleTypesin interfaceISimpleOpenbisServiceFacade
-
listExperimentTypes
public java.util.List<ExperimentType> listExperimentTypes()
Description copied from interface:ISimpleOpenbisServiceFacadeReturns all experiment types available in openBIS.- Specified by:
listExperimentTypesin interfaceISimpleOpenbisServiceFacade
-
getDataSetDss
public IDataSetDss getDataSetDss(java.lang.String code) throws EnvironmentFailureException
- Throws:
EnvironmentFailureException
-
putDataSet
public DataSet putDataSet(NewDataSetDTO newDataset, java.io.File dataSetFile) throws EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeUpload a new data set to the DSS.- Specified by:
putDataSetin interfaceISimpleOpenbisServiceFacade- Parameters:
newDataset- The new data set that should be registereddataSetFile- A file or folder containing the data- Returns:
- A proxy to the newly added data set
- Throws:
EnvironmentFailureException
-
validateDataSet
public java.util.List<ValidationError> validateDataSet(NewDataSetDTO newDataset, java.io.File dataSetFile) throws java.lang.IllegalStateException, EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeValidates a data set.- Specified by:
validateDataSetin interfaceISimpleOpenbisServiceFacade- Parameters:
newDataset- The new data set that should be registereddataSetFile- A file or folder containing the data- Returns:
- A list of validation errors. The list is empty if there were no validation errors.
- Throws:
java.lang.IllegalStateException- Thrown if the user has not yet been authenticated.EnvironmentFailureException- Thrown in cases where it is not possible to connect to the server.
-
extractMetadata
public java.util.Map<java.lang.String,java.lang.String> extractMetadata(NewDataSetDTO newDataset, java.io.File dataSetFile) throws java.lang.IllegalStateException, EnvironmentFailureException
Description copied from interface:ISimpleOpenbisServiceFacadeExtracts metadata from a file.- Specified by:
extractMetadatain interfaceISimpleOpenbisServiceFacade- Parameters:
newDataset- The new data set that should be registereddataSetFile- A file or folder containing the data- Returns:
- Map of property name/value pairs.
- Throws:
java.lang.IllegalStateException- Thrown if the user has not yet been authenticated.EnvironmentFailureException- Thrown in cases where it is not possible to connect to the server.
-
checkSession
public void checkSession() throws InvalidSessionExceptionDescription copied from interface:ISimpleOpenbisServiceFacadeChecks whether the session is alive.- Specified by:
checkSessionin interfaceISimpleOpenbisServiceFacade- Throws:
InvalidSessionException- If the session is not alive.
-
logout
public void logout()
Description copied from interface:ISimpleOpenbisServiceFacadeLogs out from openBIS and frees all associated resources on the server.IMPORTANT NOTE: If clients fail to call this method after finishing interaction with openBIS, then their session will be kept on the server until it expires. It is considered a security risk to leave openBIS sessions open.
- Specified by:
logoutin interfaceISimpleOpenbisServiceFacade
-
getMinorVersionInformationService
public int getMinorVersionInformationService()
Description copied from interface:ISimpleOpenbisServiceFacadeReturns the minor version of the general information service.- Specified by:
getMinorVersionInformationServicein interfaceISimpleOpenbisServiceFacade
-
getWebAppSettings
public WebAppSettings getWebAppSettings(java.lang.String webAppId)
Description copied from interface:IOpenbisServiceFacadeReturns the persistent settings for a given custom web app.- Specified by:
getWebAppSettingsin interfaceIOpenbisServiceFacade- Parameters:
webAppId- The id of the custom web app to get the display settings for.
-
setWebAppSettings
public void setWebAppSettings(WebAppSettings customDisplaySettings)
Description copied from interface:IOpenbisServiceFacadeSets the persistent settings for a given custom web app.- Specified by:
setWebAppSettingsin interfaceIOpenbisServiceFacade- Parameters:
customDisplaySettings- The new display settings
-
searchForExperiments
public java.util.List<Experiment> searchForExperiments(SearchCriteria searchCriteria)
Description copied from interface:IOpenbisServiceFacadeReturns all experiments matching specified search criteria.- Specified by:
searchForExperimentsin interfaceIOpenbisServiceFacade
-
searchForSamples
public java.util.List<Sample> searchForSamples(SearchCriteria searchCriteria)
Description copied from interface:IOpenbisServiceFacadeReturn all samples that match the search criteria. This is a short cut forsearchForSamples(searchCritera, EnumSet.of(SampleFetchOption.PROPERTIES))
- Specified by:
searchForSamplesin interfaceIOpenbisServiceFacade- Parameters:
searchCriteria- The sample metadata values to be matched against.
-
searchForSamples
public java.util.List<Sample> searchForSamples(SearchCriteria searchCriteria, java.util.EnumSet<SampleFetchOption> fetchOptions)
Description copied from interface:IOpenbisServiceFacadeReturn all samples that match the search criteria.- Specified by:
searchForSamplesin interfaceIOpenbisServiceFacade- Parameters:
searchCriteria- The sample metadata values to be matched against.fetchOptions- Describes the amount of information about the sample that is needed. For more details seeIGeneralInformationService.searchForSamples(String, SearchCriteria, EnumSet).
-
searchForDataSets
public java.util.List<DataSet> searchForDataSets(SearchCriteria searchCriteria)
Description copied from interface:IOpenbisServiceFacadeReturn all data sets matching a specified search criteria.- Specified by:
searchForDataSetsin interfaceIOpenbisServiceFacade- Parameters:
searchCriteria- the criteria used for searching.
-
listDataSets
public java.util.List<DataSet> listDataSets(java.util.List<Sample> samples, java.util.EnumSet<DataSet.Connections> connectionsToGet)
Description copied from interface:IOpenbisServiceFacadeReturn all data sets attached to the given samples with connections.- Specified by:
listDataSetsin interfaceIOpenbisServiceFacade- Parameters:
samples- The samples for which we return attached data sets.
-
addAdHocVocabularyTerm
public void addAdHocVocabularyTerm(TechId vocabularyId, java.lang.String code, java.lang.String label, java.lang.String description, java.lang.Long previousTermOrdinal)
Description copied from interface:IOpenbisServiceFacadeAdds new ad-hoc terms to a vocabulary starting from specified ordinal + 1.- Specified by:
addAdHocVocabularyTermin interfaceIOpenbisServiceFacade- Parameters:
vocabularyId- The id of vocabulary which should be extended.code- Code of new vocabulary term.label- Label of new vocabulary term.description- Free text describing new vocabulary term.previousTermOrdinal- new vocabulary term will be placed right after vocabulary term with given ordinal number.
-
addAdHocVocabularyTerm
public void addAdHocVocabularyTerm(java.lang.Long vocabularyId, NewVocabularyTerm term)Description copied from interface:IOpenbisServiceFacadeAdds new ad-hoc terms to a vocabulary starting from specified ordinal + 1.- Specified by:
addAdHocVocabularyTermin interfaceIOpenbisServiceFacade- Parameters:
vocabularyId- The id of vocabulary which should be extended.term- the vocabulary term to be added.
-
getVocabularyTermsMap
public java.util.HashMap<Vocabulary,java.util.List<ControlledVocabularyPropertyType.VocabularyTerm>> getVocabularyTermsMap()
Description copied from interface:IOpenbisServiceFacadeReturns map of avaialable vocabulary terms. Available since minor version 6.- Specified by:
getVocabularyTermsMapin interfaceIOpenbisServiceFacade
-
listVocabularies
public java.util.List<Vocabulary> listVocabularies()
Description copied from interface:ISimpleOpenbisServiceFacadeReturn all vocabularies available in openBIS together with the contained vocabulary terms.- Specified by:
listVocabulariesin interfaceISimpleOpenbisServiceFacade
-
-