From 15d6aee2e32eb879ca97beb382a6f0797cbc245e Mon Sep 17 00:00:00 2001 From: kaloyane <kaloyane> Date: Fri, 15 Jul 2011 14:10:23 +0000 Subject: [PATCH] [LMS-2383] Analysis procedures can now be selected in the "Analysis Summary" section. The layout is still not finished, but the functionality is there. SVN: 22154 --- .../cisd/openbis/public/css/openbis.css | 7 +- .../web/client/IScreeningClientService.java | 9 +- .../client/IScreeningClientServiceAsync.java | 12 +- .../application/ClientPluginFactory.java | 6 +- .../client/web/client/application/Dict.java | 2 + .../AnalysisProcedureChooser.java | 185 ++++++++++++++++++ .../ExperimentAnalysisSummaryGrid.java | 16 +- .../ExperimentAnalysisSummarySection.java | 56 +++++- .../ExperimentAnalysisSummaryViewer.java | 21 +- .../ExperimentAnalysisSummaryResolver.java | 5 +- .../specific/ScreeningLinkExtractor.java | 9 +- .../client/web/public/screening-dictionary.js | 1 + .../web/server/ScreeningClientService.java | 11 +- .../FeatureVectorSummaryProvider.java | 8 +- .../screening/server/ScreeningServer.java | 16 +- .../server/ScreeningServerLogger.java | 13 +- .../server/dataaccess/IScreeningQuery.java | 13 ++ .../server/logic/AbstractContentLoader.java | 5 +- .../ExperimentFeatureVectorSummaryLoader.java | 37 +++- .../logic/FeatureVectorDatasetLoader.java | 45 ++++- .../MaterialFeatureVectorSummaryLoader.java | 4 +- ...erialFeaturesFromAllExperimentsLoader.java | 3 +- .../server/logic/WellContentLoader.java | 3 +- .../logic/WellFeatureCollectionLoader.java | 5 +- .../screening/shared/IScreeningServer.java | 14 +- .../shared/basic/dto/AnalysisProcedures.java | 54 +++++ 26 files changed, 510 insertions(+), 50 deletions(-) create mode 100644 screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/AnalysisProcedureChooser.java create mode 100644 screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/AnalysisProcedures.java diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/css/openbis.css b/openbis/source/java/ch/systemsx/cisd/openbis/public/css/openbis.css index d350922c8ae..5707176ada4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/css/openbis.css +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/css/openbis.css @@ -1,8 +1,13 @@ -body,div,td { +body,div,td, .default-text { font-family: verdana, tahoma, helvetica; font-size: 12px; } +.default-text { + font-weight: normal; + color: black; +} + .link-style { color: blue; text-decoration: underline; diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java index 9e19e30b3eb..f2760142ef2 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java @@ -33,6 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.AnalysisProcedures; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorDataset; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorValues; @@ -196,7 +197,7 @@ public interface IScreeningClientService extends IClientService */ public TypedTableResultSet<MaterialFeatureVectorSummary> listExperimentFeatureVectorSummary( IResultSetConfig<String, TableModelRowWithObject<MaterialFeatureVectorSummary>> resultSetConfig, - TechId experimentId) throws UserFailureException; + TechId experimentId, String analysisProcedureOrNull) throws UserFailureException; public String prepareExportFeatureVectorSummary( TableExportCriteria<TableModelRowWithObject<MaterialFeatureVectorSummary>> criteria) @@ -225,4 +226,10 @@ public interface IScreeningClientService extends IClientService public String prepareExportMaterialFeaturesFromAllExperiments( TableExportCriteria<TableModelRowWithObject<MaterialSimpleFeatureVectorSummary>> criteria) throws UserFailureException; + + /** + * Return all analysis procedures for an experiment. + */ + public AnalysisProcedures listAnalysisProcedures(TechId experimentId); + } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java index 0d925aad185..5600a738368 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java @@ -34,6 +34,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.AnalysisProcedures; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorDataset; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorValues; @@ -173,11 +174,12 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync AsyncCallback<ResultSet<Material>> callback); /** - * @see IScreeningClientService#listExperimentFeatureVectorSummary(IResultSetConfig, TechId) + * @see IScreeningClientService#listExperimentFeatureVectorSummary(IResultSetConfig, TechId, + * String) */ public void listExperimentFeatureVectorSummary( IResultSetConfig<String, TableModelRowWithObject<MaterialFeatureVectorSummary>> resultSetConfig, - TechId experimentId, + TechId experimentId, String analysisProcedureOrNull, AsyncCallback<TypedTableResultSet<MaterialFeatureVectorSummary>> callback); /** @@ -219,4 +221,10 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync TableExportCriteria<TableModelRowWithObject<MaterialSimpleFeatureVectorSummary>> criteria, AsyncCallback<String> callback); + /** + * @see IScreeningClientService#listAnalysisProcedures(TechId) + */ + public void listAnalysisProcedures(TechId experimentId, + AsyncCallback<AnalysisProcedures> callback); + } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ClientPluginFactory.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ClientPluginFactory.java index 6f86cdbfb82..4ac26fd3d01 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ClientPluginFactory.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ClientPluginFactory.java @@ -67,8 +67,8 @@ import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.d import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.sample.LibrarySampleBatchRegistrationForm; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ui.columns.specific.ScreeningLinkExtractor; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteria; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchByProjectCriteria; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteria; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.SingleExperimentSearchCriteria; /** @@ -192,7 +192,7 @@ public final class ClientPluginFactory extends AbstractClientPluginFactory<Scree if (viewContext.getModel().isEmbeddedMode()) { ExperimentAnalysisSummaryViewer.openTab(viewContext, new TechId(experiment), - restrictGlobalScopeLinkToProject); + restrictGlobalScopeLinkToProject, null); } else { new OpenEntityDetailsTabAction(experiment, viewContext).execute(); @@ -211,7 +211,7 @@ public final class ClientPluginFactory extends AbstractClientPluginFactory<Scree if (viewContext.getModel().isEmbeddedMode()) { return ScreeningLinkExtractor.createExperimentAnalysisSummaryBrowserLink( - experiment.getPermId(), restrictGlobalScopeLinkToProject); + experiment.getPermId(), restrictGlobalScopeLinkToProject, null); } else { return LinkExtractor.tryExtract(experiment); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java index 808f61b9ef4..a5b26bc8080 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/Dict.java @@ -113,6 +113,8 @@ public final class Dict extends ch.systemsx.cisd.openbis.generic.client.web.clie public static final String MATERIAL_IN_ALL_ASSAYS = "MATERIAL_IN_ALL_ASSAYS"; + public static final String ANALYSIS_PROCEDURE = "ANALYSIS_PROCEDURE"; + private Dict() { // Can not be instantiated. diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/AnalysisProcedureChooser.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/AnalysisProcedureChooser.java new file mode 100644 index 00000000000..782b13b57a0 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/AnalysisProcedureChooser.java @@ -0,0 +1,185 @@ +/* + * Copyright 2010 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.screening.client.web.client.application.detailviewers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import com.extjs.gxt.ui.client.event.BaseEvent; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.widget.Component; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction; +import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; +import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem; +import com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem; + +import ch.systemsx.cisd.common.shared.basic.utils.StringUtils; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientServiceAsync; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Dict; + +/** + * An UI panel for selecting analysis procedures. + * + * @author Kaloyan Enimanev + */ +class AnalysisProcedureChooser extends LayoutContainer +{ + + /** + * Can be used from external classes wishing to be notified when the analysis procedure + * selection changes. + */ + public static interface IAnalysisProcedureSelectionListener + { + void analysisProcedureSelected(String analysisProcedureOrNull); + } + + private final static String UNSPECIFIED_ANALYSIS_PROCEDURE = "unspecified"; + + private final IViewContext<IScreeningClientServiceAsync> viewContext; + private final IAnalysisProcedureSelectionListener selectionListener; + + private SimpleComboBox<String> analysisProceduresComboBox; + + private final Listener<BaseEvent> selectionChangeListener = new Listener<BaseEvent>() + { + + public void handleEvent(BaseEvent be) + { + selectionChanged(); + } + + }; + + public AnalysisProcedureChooser(IViewContext<IScreeningClientServiceAsync> viewContext, + List<String> analysisProcedures, + String selectedAnalysisProcedureOrNull, + IAnalysisProcedureSelectionListener selectionListener) + { + this.viewContext = viewContext; + this.selectionListener = selectionListener; + analysisProceduresComboBox = createProceduresComboBox(); + + setAutoHeight(true); + setAutoWidth(true); + + add(createComboLabel()); + add(analysisProceduresComboBox); + add(new FillToolItem()); + addAnalysisProcedures(analysisProcedures); + + + setInitialSelection(selectedAnalysisProcedureOrNull); + } + + private Component createComboLabel() + { + final LabelToolItem label = + new LabelToolItem(viewContext.getMessage(Dict.ANALYSIS_PROCEDURE) + + GenericConstants.LABEL_SEPARATOR); + label.addStyleName("default-text"); + return label; + } + + private SimpleComboBox<String> createProceduresComboBox() + { + SimpleComboBox<String> comboBox = new SimpleComboBox<String>(); + + comboBox.setTriggerAction(TriggerAction.ALL); + comboBox.setAllowBlank(false); + comboBox.setEditable(false); + comboBox.setEmptyText("No data sets found..."); + comboBox.addListener(Events.SelectionChange, selectionChangeListener); + + return comboBox; + } + + private void addAnalysisProcedures(List<String> codes) + { + for (String code : transformAndSortCodes(codes)) + { + addCodeToComboBox(code); + } + } + + private List<String> transformAndSortCodes(List<String> codes) + { + List<String> sortedCodes = new ArrayList<String>(); + for (String code : codes) + { + sortedCodes.add(analysisCodeToComboBoxValue(code)); + } + Collections.sort(sortedCodes); + + // unspecified is always an option and is always displayed at the end + sortedCodes.remove(UNSPECIFIED_ANALYSIS_PROCEDURE); + sortedCodes.add(UNSPECIFIED_ANALYSIS_PROCEDURE); + + return sortedCodes; + } + + private void addCodeToComboBox(String code) + { + if (analysisProceduresComboBox.findModel(code) == null) + { + analysisProceduresComboBox.add(code); + } + } + + private void setInitialSelection(String analysisProcedureOrNull) + { + String comboBoxValue = analysisCodeToComboBoxValue(analysisProcedureOrNull); + if (UNSPECIFIED_ANALYSIS_PROCEDURE.equals(comboBoxValue)) + { + comboBoxValue = getFirstValueFromCombo(); + } + analysisProceduresComboBox.setSimpleValue(comboBoxValue); + } + + private String getFirstValueFromCombo() + { + return analysisProceduresComboBox.getStore().getAt(0).getValue(); + } + + private void selectionChanged() + { + String selection = analysisProceduresComboBox.getSimpleValue(); + notifySelectionListener(selection); + } + + private void notifySelectionListener(String selection) + { + String analysisProcedureOrNull = comboBoxValueToAnalysisProcedure(selection); + selectionListener.analysisProcedureSelected(analysisProcedureOrNull); + } + + private String analysisCodeToComboBoxValue(String analysisProcedureOrNull) + { + return StringUtils.isBlank(analysisProcedureOrNull) ? UNSPECIFIED_ANALYSIS_PROCEDURE + : analysisProcedureOrNull; + } + + private String comboBoxValueToAnalysisProcedure(String comboBoxValue) + { + return UNSPECIFIED_ANALYSIS_PROCEDURE.equals(comboBoxValue) ? null : comboBoxValue; + } +} \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryGrid.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryGrid.java index 97cbbf5568f..012dcf70619 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryGrid.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryGrid.java @@ -41,6 +41,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.C import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Constants; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Dict; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.AnalysisProcedureChooser.IAnalysisProcedureSelectionListener; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ui.columns.specific.ScreeningLinkExtractor; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.MaterialFeatureVectorSummary; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellSearchCriteria.ExperimentSearchCriteria; @@ -52,6 +53,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.grids.FeatureV * @author Kaloyan Enimanev */ public class ExperimentAnalysisSummaryGrid extends TypedTableGrid<MaterialFeatureVectorSummary> + implements IAnalysisProcedureSelectionListener { private static final String PREFIX = GenericConstants.ID_PREFIX + "experiment-feature-vector-summary"; @@ -64,6 +66,8 @@ public class ExperimentAnalysisSummaryGrid extends TypedTableGrid<MaterialFeatur private final boolean restrictGlobalScopeLinkToProject; + private String analysisProcedureOrNull = null; + public static IDisposableComponent create( IViewContext<IScreeningClientServiceAsync> viewContext, IEntityInformationHolderWithIdentifier experiment, @@ -137,13 +141,14 @@ public class ExperimentAnalysisSummaryGrid extends TypedTableGrid<MaterialFeatur setBorders(true); } + @Override protected void listTableRows( DefaultResultSetConfig<String, TableModelRowWithObject<MaterialFeatureVectorSummary>> resultSetConfig, AsyncCallback<TypedTableResultSet<MaterialFeatureVectorSummary>> callback) { screeningViewContext.getService().listExperimentFeatureVectorSummary(resultSetConfig, - new TechId(experiment), callback); + new TechId(experiment), analysisProcedureOrNull, callback); } @@ -172,4 +177,13 @@ public class ExperimentAnalysisSummaryGrid extends TypedTableGrid<MaterialFeatur { asDisposableWithoutToolbar().dispose(); } + + // + // IAnalysisProcedureSelectionListener + // + public void analysisProcedureSelected(String analysisProcedure) + { + this.analysisProcedureOrNull = analysisProcedure; + refresh(true); + } } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummarySection.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummarySection.java index 0cee03edc13..b8b956c811c 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummarySection.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummarySection.java @@ -1,12 +1,16 @@ package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableTabContent; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolderWithIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Dict; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.AnalysisProcedureChooser.IAnalysisProcedureSelectionListener; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.AnalysisProcedures; /** * Experiment section panel which shows all feature vector summary for a given experiment. @@ -20,6 +24,8 @@ public class ExperimentAnalysisSummarySection extends DisposableTabContent private final IEntityInformationHolderWithIdentifier experiment; + private final IDisposableComponent analysisGridDisposableComponent; + public ExperimentAnalysisSummarySection( IViewContext<IScreeningClientServiceAsync> screeningViewContext, IEntityInformationHolderWithIdentifier experiment) @@ -29,12 +35,60 @@ public class ExperimentAnalysisSummarySection extends DisposableTabContent this.screeningViewContext = screeningViewContext; this.experiment = experiment; setIds(DisplayTypeIDGenerator.EXPERIMENT_FEATURE_VECTOR_SUMMARY_SECTION); + + analysisGridDisposableComponent = + ExperimentAnalysisSummaryGrid.create(screeningViewContext, experiment, false); } @Override protected IDisposableComponent createDisposableContent() { - return ExperimentAnalysisSummaryGrid.create(screeningViewContext, experiment, false); + return null; + } + + private IAnalysisProcedureSelectionListener getGridAsListener() + { + return (IAnalysisProcedureSelectionListener) (analysisGridDisposableComponent + .getComponent()); + } + + @Override + protected void showContent() + { + super.showContent(); + + showAnalysisProcedureChooser(); + } + + private void showAnalysisProcedureChooser() + { + TechId experimentId = new TechId(experiment.getId()); + screeningViewContext.getService().listAnalysisProcedures(experimentId, + new AbstractAsyncCallback<AnalysisProcedures>(screeningViewContext) + { + @Override + protected void process(AnalysisProcedures analysisProcedures) + { + setHeading(""); + getHeader().setVisible(true); + final AnalysisProcedureChooser analysisProcedureChooser = + createAnalysisProcedureChooser(analysisProcedures); + getHeader().addTool(analysisProcedureChooser); + // WORKAROUND to GXT private widgetPanel in Header with fixed + // "float: right" set onRender + analysisProcedureChooser.addStyleName("force-float-left"); + + replaceContent(analysisGridDisposableComponent); + } + }); + } + + private AnalysisProcedureChooser createAnalysisProcedureChooser( + AnalysisProcedures analysisProcedures) + { + return new AnalysisProcedureChooser(screeningViewContext, + analysisProcedures.getProcedureCodes(), null, + getGridAsListener()); } } \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryViewer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryViewer.java index 5843e2e7454..3525dff9319 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryViewer.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ExperimentAnalysisSummaryViewer.java @@ -45,7 +45,8 @@ public class ExperimentAnalysisSummaryViewer public static void openTab( final IViewContext<IScreeningClientServiceAsync> screeningViewContext, - String experimentPermId, final boolean restrictGlobalScopeLinkToProject) + String experimentPermId, final boolean restrictGlobalScopeLinkToProject, + final String analysisProcedureOrNull) { screeningViewContext.getCommonService().getEntityInformationHolder(EntityKind.EXPERIMENT, experimentPermId, @@ -56,14 +57,15 @@ public class ExperimentAnalysisSummaryViewer { TechId experimentId = new TechId(experiment); openTab(screeningViewContext, experimentId, - restrictGlobalScopeLinkToProject); + restrictGlobalScopeLinkToProject, analysisProcedureOrNull); } }); } public static void openTab( final IViewContext<IScreeningClientServiceAsync> screeningViewContext, - TechId experimentId, final boolean restrictGlobalScopeLinkToProject) + TechId experimentId, final boolean restrictGlobalScopeLinkToProject, + final String analysisProcedureOrNull) { screeningViewContext.getCommonService().getExperimentInfo(experimentId, new AbstractAsyncCallback<Experiment>(screeningViewContext) @@ -73,7 +75,8 @@ public class ExperimentAnalysisSummaryViewer { AbstractTabItemFactory factory = createTabFactory(screeningViewContext, result, - restrictGlobalScopeLinkToProject); + restrictGlobalScopeLinkToProject, + analysisProcedureOrNull); DispatcherHelper.dispatchNaviEvent(factory); } }); @@ -82,7 +85,7 @@ public class ExperimentAnalysisSummaryViewer private static AbstractTabItemFactory createTabFactory( final IViewContext<IScreeningClientServiceAsync> viewContext, final IEntityInformationHolderWithProperties experiment, - final boolean restrictGlobalScopeLinkToProject) + final boolean restrictGlobalScopeLinkToProject, final String analysisProcedureOrNull) { return new AbstractTabItemFactory() { @@ -99,7 +102,8 @@ public class ExperimentAnalysisSummaryViewer public ITabItem create() { IDisposableComponent tabComponent = - createViewer(viewContext, experiment, restrictGlobalScopeLinkToProject); + createViewer(viewContext, experiment, restrictGlobalScopeLinkToProject, + analysisProcedureOrNull); return DefaultTabItem.create(getTabTitle(), tabComponent, viewContext); } @@ -107,7 +111,8 @@ public class ExperimentAnalysisSummaryViewer public String tryGetLink() { return ScreeningLinkExtractor.createExperimentAnalysisSummaryBrowserLink( - experiment.getPermId(), restrictGlobalScopeLinkToProject); + experiment.getPermId(), restrictGlobalScopeLinkToProject, + analysisProcedureOrNull); } @Override @@ -128,7 +133,7 @@ public class ExperimentAnalysisSummaryViewer private static IDisposableComponent createViewer( IViewContext<IScreeningClientServiceAsync> viewContext, IEntityInformationHolderWithProperties experiment, - boolean restrictGlobalScopeLinkToProject) + boolean restrictGlobalScopeLinkToProject, String analysisProcedureOrNull) { String headingText = viewContext.getMessage(Dict.ASSAY_HEADER, experiment.getCode()); final IDisposableComponent gridComponent = diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/locator/ExperimentAnalysisSummaryResolver.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/locator/ExperimentAnalysisSummaryResolver.java index 1755c635664..5d471dc39fd 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/locator/ExperimentAnalysisSummaryResolver.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/locator/ExperimentAnalysisSummaryResolver.java @@ -32,8 +32,11 @@ public class ExperimentAnalysisSummaryResolver extends AbstractViewLocatorResolv boolean restrictGlobalScopeLinkToProject = getOptionalBooleanParameter(locator, ScreeningLinkExtractor.RESTRICT_GLOBAL_SEARCH_TO_PROJECT, false); + + String analysisProcedureOrNull = + getOptionalParameter(locator, ScreeningLinkExtractor.ANALYSIS_PROCEDURE_KEY); ExperimentAnalysisSummaryViewer.openTab(viewContext, experimentPermId, - restrictGlobalScopeLinkToProject); + restrictGlobalScopeLinkToProject, analysisProcedureOrNull); } } \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ui/columns/specific/ScreeningLinkExtractor.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ui/columns/specific/ScreeningLinkExtractor.java index c859c699825..ac8681465e5 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ui/columns/specific/ScreeningLinkExtractor.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/ui/columns/specific/ScreeningLinkExtractor.java @@ -16,6 +16,7 @@ package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ui.columns.specific; +import ch.systemsx.cisd.common.shared.basic.utils.StringUtils; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.LinkExtractor; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.URLListEncoder; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.lang.StringEscapeUtils; @@ -85,6 +86,8 @@ public class ScreeningLinkExtractor extends LinkExtractor // false by default public static final String RESTRICT_GLOBAL_SEARCH_TO_PROJECT = "restrictGlobalSearchToProject"; + public static final String ANALYSIS_PROCEDURE_KEY = "analysisProcedure"; + public static final String createPlateMetadataBrowserLink(String platePermId) { URLMethodWithParameters url = new URLMethodWithParameters(""); @@ -94,7 +97,7 @@ public class ScreeningLinkExtractor extends LinkExtractor } public static final String createExperimentAnalysisSummaryBrowserLink(String experimentPermId, - boolean restrictGlobalScopeLinkToProject) + boolean restrictGlobalScopeLinkToProject, String analysisProcedureOrNull) { URLMethodWithParameters url = new URLMethodWithParameters(""); url.addParameter(BasicConstant.LOCATOR_ACTION_PARAMETER, EXPERIMENT_ANALYSIS_SUMMARY_ACTION); @@ -105,6 +108,10 @@ public class ScreeningLinkExtractor extends LinkExtractor url.addParameterWithoutEncoding(RESTRICT_GLOBAL_SEARCH_TO_PROJECT, restrictGlobalScopeLinkToProject); } + if (StringUtils.isNotBlank(analysisProcedureOrNull)) + { + url.addParameter(ANALYSIS_PROCEDURE_KEY, analysisProcedureOrNull); + } return tryPrint(url); } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js index 34b53f1bef3..ae30526965b 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/public/screening-dictionary.js @@ -21,6 +21,7 @@ WELL: "Well", WELL_IMAGES: "Well Images", PREVIEW: "Preview", PLATE_VIEWER_TITLE: "Plate {0}", +ANALYSIS_PROCEDURE: "Analysis Procedure", // // Menu items diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java index 6604df83fa9..e8ba0078cef 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java @@ -56,6 +56,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.client.web.server.resultset.Pla import ch.systemsx.cisd.openbis.plugin.screening.client.web.server.resultset.WellContentProvider; import ch.systemsx.cisd.openbis.plugin.screening.shared.IScreeningServer; import ch.systemsx.cisd.openbis.plugin.screening.shared.ResourceNames; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.AnalysisProcedures; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorDataset; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorValues; @@ -294,10 +295,11 @@ public final class ScreeningClientService extends AbstractClientService implemen public TypedTableResultSet<MaterialFeatureVectorSummary> listExperimentFeatureVectorSummary( IResultSetConfig<String, TableModelRowWithObject<MaterialFeatureVectorSummary>> criteria, - TechId experimentId) + TechId experimentId, String analysisProcedureOrNull) { FeatureVectorSummaryProvider provider = - new FeatureVectorSummaryProvider(server, getSessionToken(), experimentId); + new FeatureVectorSummaryProvider(server, getSessionToken(), experimentId, + analysisProcedureOrNull); return listEntities(provider, criteria); } @@ -345,4 +347,9 @@ public final class ScreeningClientService extends AbstractClientService implemen return prepareExportEntities(criteria); } + public AnalysisProcedures listAnalysisProcedures(TechId experimentId) + { + return server.listAnalysisProcedures(getSessionToken(), experimentId); + } + } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/resultset/FeatureVectorSummaryProvider.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/resultset/FeatureVectorSummaryProvider.java index 1a7e18d4880..492be321346 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/resultset/FeatureVectorSummaryProvider.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/resultset/FeatureVectorSummaryProvider.java @@ -49,12 +49,15 @@ public class FeatureVectorSummaryProvider extends AbstractTableModelProvider<Mat private final TechId experimentId; + private final String analysisProcedureOrNull; + public FeatureVectorSummaryProvider(IScreeningServer server, String sessionToken, - TechId experimentId) + TechId experimentId, String analysisProcedureOrNull) { this.server = server; this.sessionToken = sessionToken; this.experimentId = experimentId; + this.analysisProcedureOrNull = analysisProcedureOrNull; } @Override @@ -63,7 +66,8 @@ public class FeatureVectorSummaryProvider extends AbstractTableModelProvider<Mat TypedTableModelBuilder<MaterialFeatureVectorSummary> builder = new TypedTableModelBuilder<MaterialFeatureVectorSummary>(); ExperimentFeatureVectorSummary fvSummary = - server.getExperimentFeatureVectorSummary(sessionToken, experimentId); + server.getExperimentFeatureVectorSummary(sessionToken, experimentId, + analysisProcedureOrNull); builder.addColumn(MATERIAL_ID); builder.columnGroup(MATERIAL_PROPS_GROUP); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java index 37460453df3..d7f3ee5ebde 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java @@ -72,8 +72,8 @@ import ch.systemsx.cisd.openbis.plugin.screening.server.dataaccess.IScreeningQue import ch.systemsx.cisd.openbis.plugin.screening.server.logic.ExperimentFeatureVectorSummaryLoader; import ch.systemsx.cisd.openbis.plugin.screening.server.logic.FeatureVectorValuesLoader; import ch.systemsx.cisd.openbis.plugin.screening.server.logic.LogicalImageLoader; -import ch.systemsx.cisd.openbis.plugin.screening.server.logic.MaterialFeaturesFromAllExperimentsLoader; import ch.systemsx.cisd.openbis.plugin.screening.server.logic.MaterialFeatureVectorSummaryLoader; +import ch.systemsx.cisd.openbis.plugin.screening.server.logic.MaterialFeaturesFromAllExperimentsLoader; import ch.systemsx.cisd.openbis.plugin.screening.server.logic.PlateContentLoader; import ch.systemsx.cisd.openbis.plugin.screening.server.logic.ScreeningApiImpl; import ch.systemsx.cisd.openbis.plugin.screening.server.logic.WellContentLoader; @@ -91,6 +91,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifi import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellMaterialMapping; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellReferenceWithDatasets; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.WellIdentifier; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.AnalysisProcedures; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ExperimentFeatureVectorSummary; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorDataset; @@ -302,13 +303,14 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl } public ExperimentFeatureVectorSummary getExperimentFeatureVectorSummary(String sessionToken, - TechId experimentId) + TechId experimentId, String analysisProcedureOrNull) { Session session = getSession(sessionToken); // NOTE: we want the settings to be passed form the client in future MaterialSummarySettings settings = createDefaultSettings(); return ExperimentFeatureVectorSummaryLoader.loadExperimentFeatureVectors(session, - businessObjectFactory, getDAOFactory(), experimentId, settings); + businessObjectFactory, getDAOFactory(), experimentId, analysisProcedureOrNull, + settings); } public List<MaterialSimpleFeatureVectorSummary> getMaterialFeatureVectorsFromAllExperiments( @@ -451,6 +453,14 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl return createScreeningApiImpl(sessionToken).getDatasetIdentifiers(datasetCodes); } + public AnalysisProcedures listAnalysisProcedures(String sessionToken, TechId experimentId) + { + checkSession(sessionToken); + IScreeningQuery dao = createDAO(getDAOFactory()); + List<String> procedureCodes = dao.listAnalysisProcedures(experimentId.getId()); + return new AnalysisProcedures(procedureCodes); + } + public List<PlateWellMaterialMapping> listPlateMaterialMapping(String sessionToken, List<? extends PlateIdentifier> plates, MaterialTypeIdentifier materialTypeIdentifierOrNull) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java index 389f3524ec1..24ab08ab04c 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java @@ -50,6 +50,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifi import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellMaterialMapping; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellReferenceWithDatasets; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.WellIdentifier; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.AnalysisProcedures; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ExperimentFeatureVectorSummary; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorDataset; @@ -348,10 +349,11 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree } public ExperimentFeatureVectorSummary getExperimentFeatureVectorSummary(String sessionToken, - TechId experimentId) + TechId experimentId, String analysisProcedureOrNull) { logAccess(sessionToken, "getExperimentFeatureVectorSummary", - "sessionToken(%s), experimentId(%s)", sessionToken, experimentId); + "sessionToken(%s), experimentId(%s), analysisProcedure(%s)", sessionToken, + experimentId, analysisProcedureOrNull); return null; } @@ -373,4 +375,11 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree experimentSearchCriteria); return null; } + + public AnalysisProcedures listAnalysisProcedures(String sessionToken, TechId experimentId) + { + logAccess(sessionToken, "listAnalysisProcedures", "sessionToken(%s), experimentId(%s)", + sessionToken, experimentId); + return null; + } } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/dataaccess/IScreeningQuery.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/dataaccess/IScreeningQuery.java index 3ca0cfaad02..47c51623cc4 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/dataaccess/IScreeningQuery.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/dataaccess/IScreeningQuery.java @@ -305,4 +305,17 @@ public interface IScreeningQuery extends BaseQuery public List<ExperimentReferenceQueryResult> getExperimentsWithMaterial(long materialId, long projectId); + @Select(sql = "select distinct " + + " ds_props.value as value" + + " from experiments exp " + + " join data ds on ds.expe_id = exp.id " + + " join data_set_types ds_type on ds.dsty_id = ds_type.id " + + " join data_set_type_property_types dst_pt on dst_pt.dsty_id = ds_type.id " + + " left outer join data_set_properties ds_props on ds_props.ds_id = ds.id " + + " where " + + " exp.id = ?{1} " + + " and " + + " dst_pt.prty_id = (select id from property_types where code='ANALYSIS_PROCEDURE' and is_internal_namespace=true)") + public List<String> listAnalysisProcedures(long experimentId); + } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/AbstractContentLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/AbstractContentLoader.java index 8de33f1da2d..4badb30efd7 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/AbstractContentLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/AbstractContentLoader.java @@ -100,8 +100,9 @@ abstract class AbstractContentLoader } protected final FeatureVectorDatasetLoader createFeatureVectorDatasetsRetriever( - Set<PlateIdentifier> plates) + Set<PlateIdentifier> plates, String analysisProcedureOrNull) { - return new FeatureVectorDatasetLoader(session, businessObjectFactory, null, plates); + return new FeatureVectorDatasetLoader(session, businessObjectFactory, null, plates, + analysisProcedureOrNull); } } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ExperimentFeatureVectorSummaryLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ExperimentFeatureVectorSummaryLoader.java index 07baa2ae640..9e5951d90e9 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ExperimentFeatureVectorSummaryLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ExperimentFeatureVectorSummaryLoader.java @@ -63,15 +63,30 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.FeatureVectorLoa */ public class ExperimentFeatureVectorSummaryLoader extends AbstractContentLoader { + + static class LoaderParameters + { + TechId experimentId; + + String analysisProcedureOrNull; + + LoaderParameters(TechId experimentId, String analysisProcedureOrNull) + { + this.experimentId = experimentId; + this.analysisProcedureOrNull = analysisProcedureOrNull; + } + } + /** * Loads feature vectors summaries for all the materials in the specified experiment. */ public static ExperimentFeatureVectorSummary loadExperimentFeatureVectors(Session session, IScreeningBusinessObjectFactory businessObjectFactory, IDAOFactory daoFactory, - TechId experimentId, MaterialSummarySettings settings) + TechId experimentId, String analysisProcedureOrNull, MaterialSummarySettings settings) { + LoaderParameters params = new LoaderParameters(experimentId, analysisProcedureOrNull); return new ExperimentFeatureVectorSummaryLoader(session, businessObjectFactory, daoFactory, - settings).loadExperimentFeatureVectors(experimentId); + settings).loadExperimentFeatureVectors(params); } protected final MaterialSummarySettings settings; @@ -84,10 +99,10 @@ public class ExperimentFeatureVectorSummaryLoader extends AbstractContentLoader this.settings = settings; } - private ExperimentFeatureVectorSummary loadExperimentFeatureVectors(TechId experimentId) + private ExperimentFeatureVectorSummary loadExperimentFeatureVectors(LoaderParameters params) { - WellDataCollection wellDataCollection = tryLoadWellData(experimentId); - ExperimentReference experiment = loadExperimentByTechId(experimentId); + WellDataCollection wellDataCollection = tryLoadWellData(params); + ExperimentReference experiment = loadExperimentByTechId(params.experimentId); if (wellDataCollection == null) { @@ -160,10 +175,11 @@ public class ExperimentFeatureVectorSummaryLoader extends AbstractContentLoader }, UniqueKeyViolationStrategy.KEEP_FIRST); } - protected final WellDataCollection tryLoadWellData(TechId experimentId) + protected final WellDataCollection tryLoadWellData(LoaderParameters params) { ISampleLister sampleLister = businessObjectFactory.createSampleLister(session); - List<Sample> plates = sampleLister.list(createExperientCriteria(experimentId.getId())); + List<Sample> plates = + sampleLister.list(createExperientCriteria(params.experimentId.getId())); List<Sample> wells = sampleLister.list(createWellsCriteria(plates)); if (wells.isEmpty()) { @@ -173,7 +189,7 @@ public class ExperimentFeatureVectorSummaryLoader extends AbstractContentLoader Set<PlateIdentifier> plateIdentifiers = extractIdentifiers(plates); WellFeatureCollection<FeatureVectorValues> featureVectorsCollection = - tryLoadWellSingleFeatureVectors(plateIdentifiers); + tryLoadWellSingleFeatureVectors(plateIdentifiers, params.analysisProcedureOrNull); if (featureVectorsCollection == null) { return null; // no feature vector datasets connected to plates in this experiment @@ -185,10 +201,11 @@ public class ExperimentFeatureVectorSummaryLoader extends AbstractContentLoader } private WellFeatureCollection<FeatureVectorValues> tryLoadWellSingleFeatureVectors( - Set<PlateIdentifier> plateIdentifiers) + Set<PlateIdentifier> plateIdentifiers, String analysisProcedureOrNull) { return new WellFeatureCollectionLoader(session, businessObjectFactory, daoFactory) - .tryLoadWellSingleFeatureVectors(plateIdentifiers, settings.getFeatureCodes()); + .tryLoadWellSingleFeatureVectors(plateIdentifiers, settings.getFeatureCodes(), + analysisProcedureOrNull); } private static ExperimentFeatureVectorSummary createEmptySummary(ExperimentReference experiment) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/FeatureVectorDatasetLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/FeatureVectorDatasetLoader.java index c1a65e51143..40544e10eae 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/FeatureVectorDatasetLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/FeatureVectorDatasetLoader.java @@ -16,6 +16,10 @@ package ch.systemsx.cisd.openbis.plugin.screening.server.logic; +import static ch.systemsx.cisd.openbis.plugin.screening.server.logic.ScreeningUtils.isTypeMatching; +import static ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants.ANY_HCS_IMAGE_DATASET_TYPE_PATTERN; +import static ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants.HCS_IMAGE_ANALYSIS_DATASET_TYPE_PATTERN; + import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -27,6 +31,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.Session; +import ch.systemsx.cisd.openbis.generic.shared.util.EntityHelper; import ch.systemsx.cisd.openbis.plugin.screening.server.IScreeningBusinessObjectFactory; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVectorDatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier; @@ -42,17 +47,27 @@ class FeatureVectorDatasetLoader extends HCSImageDatasetLoader // Parameter state private final String featureVectorDatasetTypeCode; + private final String analysisProcedureOrNull; + // Running state private Collection<ExternalData> featureVectorDatasets; FeatureVectorDatasetLoader(Session session, IScreeningBusinessObjectFactory businessObjectFactory, String homeSpaceOrNull, Set<? extends PlateIdentifier> plates) + { + this(session, businessObjectFactory, homeSpaceOrNull, plates, null); + } + + FeatureVectorDatasetLoader(Session session, + IScreeningBusinessObjectFactory businessObjectFactory, String homeSpaceOrNull, + Set<? extends PlateIdentifier> plates, String analysisProcedureOrNull) { super(session, businessObjectFactory, homeSpaceOrNull, plates, ScreeningConstants.ANY_HCS_IMAGE_DATASET_TYPE_PATTERN, ScreeningConstants.HCS_IMAGE_ANALYSIS_DATASET_TYPE_PATTERN); featureVectorDatasetTypeCode = ScreeningConstants.HCS_IMAGE_ANALYSIS_DATASET_TYPE_PATTERN; + this.analysisProcedureOrNull = analysisProcedureOrNull; } public static class FeatureVectorExternalData @@ -106,12 +121,10 @@ class FeatureVectorDatasetLoader extends HCSImageDatasetLoader List<ExternalData> imageDatasets = new ArrayList<ExternalData>(); for (ExternalData dataset : getDatasets()) { - if (ScreeningUtils.isTypeMatching(dataset, - ScreeningConstants.HCS_IMAGE_ANALYSIS_DATASET_TYPE_PATTERN)) + if (isMatchingAnalysisDataSet(dataset)) { featureVectorDatasetSet.put(dataset.getId(), dataset); - } else if (ScreeningUtils.isTypeMatching(dataset, - ScreeningConstants.ANY_HCS_IMAGE_DATASET_TYPE_PATTERN)) + } else if (isMatchingImageDataset(dataset)) { imageDatasets.add(dataset); } @@ -121,6 +134,30 @@ class FeatureVectorDatasetLoader extends HCSImageDatasetLoader featureVectorDatasets = featureVectorDatasetSet.values(); } + private boolean isMatchingImageDataset(ExternalData dataset) + { + return isTypeMatching(dataset, ANY_HCS_IMAGE_DATASET_TYPE_PATTERN); + } + + private boolean isMatchingAnalysisProcedure(ExternalData dataset) + { + String dataSetAnalysisProcedure = + EntityHelper.tryFindPropertyValue(dataset, ScreeningConstants.ANALYSIS_PROCEDURE); + if (analysisProcedureOrNull == null) + { + return dataSetAnalysisProcedure == null; + } else + { + return analysisProcedureOrNull.equals(dataSetAnalysisProcedure); + } + } + + private boolean isMatchingAnalysisDataSet(ExternalData dataset) + { + return isTypeMatching(dataset, HCS_IMAGE_ANALYSIS_DATASET_TYPE_PATTERN) + && isMatchingAnalysisProcedure(dataset); + } + private List<FeatureVectorDatasetReference> asFeatureVectorDatasetReferences() { List<FeatureVectorDatasetReference> result = new ArrayList<FeatureVectorDatasetReference>(); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeatureVectorSummaryLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeatureVectorSummaryLoader.java index e0eb9b912cf..75b8031116b 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeatureVectorSummaryLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeatureVectorSummaryLoader.java @@ -176,7 +176,9 @@ public class MaterialFeatureVectorSummaryLoader extends ExperimentFeatureVectorS private MaterialAllReplicasFeatureVectors tryLoadMaterialFeatureVectors(TechId materialId, TechId experimentId) { - WellDataCollection experimentWells = tryLoadWellData(experimentId); + // TODO KE: 2011-07-15 this should also be changed + LoaderParameters params = new LoaderParameters(experimentId, null); + WellDataCollection experimentWells = tryLoadWellData(params); if (experimentWells == null) { return null; diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeaturesFromAllExperimentsLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeaturesFromAllExperimentsLoader.java index 83cf56f5a51..2e72507c65d 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeaturesFromAllExperimentsLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/MaterialFeaturesFromAllExperimentsLoader.java @@ -358,8 +358,9 @@ public class MaterialFeaturesFromAllExperimentsLoader extends AbstractContentLoa private WellFeatureCollection<FeatureVectorValues> tryLoadWellSingleFeatureVectors( Set<PlateIdentifier> plateIdentifiers) { + // TODO KE: 2011-07-15 specify analysis procedure here ? return new WellFeatureCollectionLoader(session, businessObjectFactory, daoFactory) - .tryLoadWellSingleFeatureVectors(plateIdentifiers, settings.getFeatureCodes()); + .tryLoadWellSingleFeatureVectors(plateIdentifiers, settings.getFeatureCodes(), null); } } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellContentLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellContentLoader.java index 4b3eb9c3c6e..1613b14b2f3 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellContentLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellContentLoader.java @@ -356,7 +356,8 @@ public class WellContentLoader extends AbstractContentLoader List<WellContent> locations) { Set<PlateIdentifier> plates = extractPlates(locations); - return createFeatureVectorDatasetsRetriever(plates); + // TODO KE: 2011-07-15 add analysis procedure support here + return createFeatureVectorDatasetsRetriever(plates, null); } private static Collection<ExternalData> selectChildlessImageDatasets( diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellFeatureCollectionLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellFeatureCollectionLoader.java index 18dff4c124d..66a8e59df6f 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellFeatureCollectionLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/WellFeatureCollectionLoader.java @@ -56,11 +56,12 @@ public class WellFeatureCollectionLoader extends AbstractContentLoader /** Loads feature vectors for chosen plates and set of features */ public WellFeatureCollection<FeatureVectorValues> tryLoadWellSingleFeatureVectors( - Set<PlateIdentifier> plates, List<String> featureCodes) + Set<PlateIdentifier> plates, List<String> featureCodes, String analysisProcedureOrNull) { StopWatch watch = new StopWatch(); watch.start(); - FeatureVectorDatasetLoader datasetsRetriever = createFeatureVectorDatasetsRetriever(plates); + FeatureVectorDatasetLoader datasetsRetriever = + createFeatureVectorDatasetsRetriever(plates, analysisProcedureOrNull); Collection<ExternalData> featureVectorDatasets = datasetsRetriever.getFeatureVectorDatasets(); if (featureVectorDatasets.isEmpty()) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java index 6aea09c6871..14092853b95 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java @@ -44,6 +44,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.authorization.DatasetRef import ch.systemsx.cisd.openbis.plugin.screening.shared.authorization.MaterialExperimentFeatureVectorSummaryValidator; import ch.systemsx.cisd.openbis.plugin.screening.shared.authorization.WellContentValidator; import ch.systemsx.cisd.openbis.plugin.screening.shared.authorization.WellSearchCriteriaPredicate; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.AnalysisProcedures; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ExperimentFeatureVectorSummary; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.FeatureVectorDataset; @@ -219,7 +220,8 @@ public interface IScreeningServer extends IServer @Transactional(readOnly = true) @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public ExperimentFeatureVectorSummary getExperimentFeatureVectorSummary(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId); + @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId, + String analysisProcedureOrNull); /** * Returns a feature vector summary (with details for each replica) for the given experiment and @@ -241,4 +243,14 @@ public interface IScreeningServer extends IServer String sessionToken, TechId materialId, ExperimentSearchByProjectCriteria experimentSearchCriteria); + /** + * Return a list of all different analysis procedures applied to the data sets of an experiment. + * The result contains unique values. It can contain NULL (which can be used for data sets + * having no ANALYSIS_PROCEDURE value specified). + */ + @Transactional(readOnly = true) + @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) + public AnalysisProcedures listAnalysisProcedures(String sessionToken, + @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId); + } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/AnalysisProcedures.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/AnalysisProcedures.java new file mode 100644 index 00000000000..8862f38ca0a --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/AnalysisProcedures.java @@ -0,0 +1,54 @@ +/* + * Copyright 2011 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.screening.shared.basic.dto; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; + +/** + * A holder class for analysis procedures. The codes list contains unique values. It can contain + * NULL (which can be used for data sets having no ANALYSIS_PROCEDURE value specified). + * + * @author Kaloyan Enimanev + */ +public class AnalysisProcedures implements ISerializable +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private List<String> procedureCodes; + + // GWT only + @SuppressWarnings("unused") + private AnalysisProcedures() + { + } + + public AnalysisProcedures(List<String> procedureCodes) + { + this.procedureCodes = new ArrayList<String>(procedureCodes); + } + + public List<String> getProcedureCodes() + { + return Collections.unmodifiableList(procedureCodes); + } + +} -- GitLab