From 21ce29aa3b7d40d04921fc97d9f517cbfd8671f9 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Tue, 10 May 2011 22:02:35 +0000 Subject: [PATCH] [LMS-2104] added contained data sets section SVN: 21217 --- openbis/dist/server/web-client.properties | 1 + openbis/etc/web-client.properties | 5 +- .../framework/DisplayTypeIDGenerator.java | 2 + .../openbis/generic/server/CommonServer.java | 5 +- .../bo/datasetlister/DatasetLister.java | 7 ++- .../bo/datasetlister/IDatasetLister.java | 17 ++++--- .../datasetlister/IDatasetListingQuery.java | 6 +++ .../basic/dto/DataSetRelationshipRole.java | 2 +- .../shared/basic/dto/ExternalData.java | 2 +- .../dataset/DataSetContainedSection.java | 47 +++++++++++++++++++ .../dataset/GenericDataSetViewer.java | 6 +++ 11 files changed, 87 insertions(+), 13 deletions(-) create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetContainedSection.java diff --git a/openbis/dist/server/web-client.properties b/openbis/dist/server/web-client.properties index 1e2e90140e8..aca5dfc20c8 100644 --- a/openbis/dist/server/web-client.properties +++ b/openbis/dist/server/web-client.properties @@ -35,6 +35,7 @@ # data-set-data-section # data-set-parents-section # data-set-children-section +# data-set-contained-section # query-section # generic_experiment_viewer # data-sets-section diff --git a/openbis/etc/web-client.properties b/openbis/etc/web-client.properties index 5868bcd5cba..01573c50466 100644 --- a/openbis/etc/web-client.properties +++ b/openbis/etc/web-client.properties @@ -6,7 +6,7 @@ # Flag specifying whether default login mode is anonymous or not. # If true a user-for-anonymous-login has to be defined in service.properties # Default value: false -# default-anonymous-login = true +#default-anonymous-login = true # Maximal number of visible columns in tables. Default: 50. max-visible-columns = 25 @@ -29,6 +29,7 @@ data-set-types-with-image-overview = HCS_IMAGE, UNKNOWN # data-set-data-section # data-set-parents-section # data-set-children-section +# data-set-contained-section # query-section # generic_experiment_viewer # data-sets-section @@ -59,6 +60,6 @@ experiment-view.hide-sections = attachment-section data-view.view = generic_dataset_viewer data-view.types = HCS_IMAGE -data-view.hide-smart-view = true +data-view.hide-smart-view = false data-view.hide-file-view = false diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java index ed88ab49844..3b2075b08ac 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java @@ -94,6 +94,8 @@ public enum DisplayTypeIDGenerator implements IDisplayTypeIDGenerator DATA_SET_CHILDREN_SECTION("data-set-children-section"), + DATA_SET_CONTAINED_SECTION("data-set-contained-section"), + DATA_SET_DATA_SECTION("data-set-data-section"), MODULE_SECTION("module-section"), diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java index 066e519f5ac..2d7f0783cd3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java @@ -202,9 +202,9 @@ import ch.systemsx.cisd.openbis.generic.shared.managed_property.ManagedPropertyE import ch.systemsx.cisd.openbis.generic.shared.managed_property.ManagedPropertyEvaluatorFactory; import ch.systemsx.cisd.openbis.generic.shared.translator.AttachmentTranslator; import ch.systemsx.cisd.openbis.generic.shared.translator.AuthorizationGroupTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.DataSetTranslator; import ch.systemsx.cisd.openbis.generic.shared.translator.DataSetTypeTranslator; import ch.systemsx.cisd.openbis.generic.shared.translator.DataStoreServiceTranslator; -import ch.systemsx.cisd.openbis.generic.shared.translator.DataSetTranslator; import ch.systemsx.cisd.openbis.generic.shared.translator.DataTypeTranslator; import ch.systemsx.cisd.openbis.generic.shared.translator.DtoConverters; import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator; @@ -523,6 +523,9 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt List<ExternalData> datasets = null; switch (role) { + case CONTAINER: + datasets = datasetLister.listByContainerTechId(datasetId); + break; case CHILD: datasets = datasetLister.listByChildTechId(datasetId); break; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java index 467a80cb2c3..c9260ad7856 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java @@ -318,6 +318,11 @@ public class DatasetLister extends AbstractLister implements IDatasetLister return enrichDatasets(query.getParentDatasetsForChild(childDatasetId.getId())); } + public List<ExternalData> listByContainerTechId(TechId containerDatasetId) + { + return enrichDatasets(query.getContainedDatasetsForContainer(containerDatasetId.getId())); + } + public List<ExternalData> listByParentTechIds(Collection<Long> parentDatasetIds) { List<ExternalData> result = new ArrayList<ExternalData>(); @@ -581,7 +586,7 @@ public class DatasetLister extends AbstractLister implements IDatasetLister LongSet containerIDs = new LongOpenHashSet(); for (ExternalData dataSet : datasetMap.values()) { - if (dataSet.isContainerDataSet()) + if (dataSet.isContainer()) { containerIDs.add(dataSet.getId()); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetLister.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetLister.java index 29d2d501884..3ef3183b414 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetLister.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetLister.java @@ -47,6 +47,9 @@ public interface IDatasetLister /** @return datasets that are parents of a dataset with the specified id */ List<ExternalData> listByChildTechId(TechId childDatasetId); + /** @return datasets that are components of a dataset with the specified id */ + List<ExternalData> listByContainerTechId(TechId containerDatasetId); + /** @return all datasets that are children of any specified dataset id */ List<ExternalData> listByParentTechIds(Collection<Long> parentDatasetIds); @@ -61,22 +64,22 @@ public interface IDatasetLister * IDs from the argument. A value of the map contains at least one element. */ Map<Long, Set<Long>> listChildrenIds(Collection<Long> dataSetIDs); - + /** - * Returns a map with all data sets of specified samples. The sample arguments are the - * key into the returned map. The returned data sets contains all derived data sets (children, - * grand children, etc.). + * Returns a map with all data sets of specified samples. The sample arguments are the key into + * the returned map. The returned data sets contains all derived data sets (children, grand + * children, etc.). */ Map<Sample, List<ExternalData>> listAllDataSetsFor(List<Sample> samples); - /** - * Lists all data sets with specified codes. Unenriched data sets will be returned. + /** + * Lists all data sets with specified codes. Unenriched data sets will be returned. */ List<ExternalData> listByDatasetCode(Collection<String> datasetCodes); /** @return datasets with given ids */ List<ExternalData> listByDatasetIds(Collection<Long> datasetIds); - + /** @return datasets specified by given criteria */ List<ExternalData> listByTrackingCriteria(TrackingDataSetCriteria criteria); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java index 7ee36dac0d8..62319fb0fb6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java @@ -149,6 +149,12 @@ public interface IDatasetListingQuery extends TransactionQuery, IPropertyListing + " WHERE data.id IN (SELECT data_id_parent FROM data_set_relationships r WHERE r.data_id_child=?{1})", fetchSize = FETCH_SIZE) public DataIterator<DatasetRecord> getParentDatasetsForChild(long childDatasetId); + /** + * Returns the datasets that are contained in a dataset with given id. + */ + @Select(sql = SELECT_ALL + " WHERE data.ctnr_id=?{1}", fetchSize = FETCH_SIZE) + public DataIterator<DatasetRecord> getContainedDatasetsForContainer(long containerDatasetId); + /** * Returns the datasets for the given <var>datasetId</var>. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetRelationshipRole.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetRelationshipRole.java index 261973aba06..f528453c79f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetRelationshipRole.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSetRelationshipRole.java @@ -23,5 +23,5 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable; */ public enum DataSetRelationshipRole implements ISerializable { - PARENT, CHILD; + CONTAINER, PARENT, CHILD; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java index 8fd9a7449c5..923856f3647 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java @@ -88,7 +88,7 @@ public class ExternalData extends CodeWithRegistration<ExternalData> implements /** * @return true if this is a container data set. */ - public boolean isContainerDataSet() + public boolean isContainer() { return dataSetType != null && dataSetType.isContainerType(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetContainedSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetContainedSection.java new file mode 100644 index 00000000000..c24f229ce0f --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetContainedSection.java @@ -0,0 +1,47 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.dataset; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetRelationshipRole; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; + +/** + * @author Piotr Buczek + */ +class DataSetContainedSection extends AbstractDataSetsSection +{ + private final ExternalData dataset; + + DataSetContainedSection(IViewContext<?> viewContext, ExternalData dataset) + { + super("Contained (Data Sets)", viewContext, dataset); + this.dataset = dataset; + setIds(DisplayTypeIDGenerator.DATA_SET_CONTAINED_SECTION); + } + + @Override + protected IDisposableComponent createDatasetBrowserComponent() + { + return DataSetRelationshipBrowser.create(viewContext, TechId.create(dataset), + DataSetRelationshipRole.CONTAINER, dataset.getDataSetType()); + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java index fb34505fb5b..0ed6252367c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java @@ -180,6 +180,12 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl final TabContent dataSection = new DataViewSection(viewContext, dataset); container.addSection(dataSection); + if (dataset.isContainer()) + { + final TabContent containedSection = new DataSetContainedSection(viewContext, dataset); + container.addSection(containedSection); + } + // parents final TabContent parentsSection = new DataSetParentsSection(viewContext, dataset); container.addSection(parentsSection); -- GitLab