Skip to content
Snippets Groups Projects
Commit b64146a9 authored by buczekp's avatar buczekp
Browse files

[LMS-1690] screening solution with only one server call

SVN: 17720
parent 86ec41c3
No related branches found
No related tags found
No related merge requests found
Showing
with 193 additions and 172 deletions
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material; package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -40,9 +39,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.Ab ...@@ -40,9 +39,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.Ab
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.ColumnDefsAndConfigs; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.ColumnDefsAndConfigs;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.DisposableEntityChooser; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.DisposableEntityChooser;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IBrowserGridActionInvoker; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IBrowserGridActionInvoker;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserToolbar.BasicMaterialCriteriaProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserToolbar.FilterByIdMaterialCriteriaProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserToolbar.IMaterialCriteriaProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedActionWithResult; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedActionWithResult;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListMaterialDisplayCriteria; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListMaterialDisplayCriteria;
...@@ -81,26 +77,10 @@ public class MaterialBrowserGrid extends ...@@ -81,26 +77,10 @@ public class MaterialBrowserGrid extends
return createWithTypeChooser(viewContext, true); return createWithTypeChooser(viewContext, true);
} }
/**
* Creates a browser with a toolbar which allows to choose the material type. Allows to show or
* edit material details. Only materials with given ids will be shown.
*/
public static DisposableEntityChooser<Material> createWithTypeChooser(
final IViewContext<ICommonClientServiceAsync> viewContext,
final Collection<Long> allowedMaterialIdsOrNull)
{
return createWithTypeChooser(viewContext, true, allowedMaterialIdsOrNull);
}
private static DisposableEntityChooser<Material> createWithTypeChooser( private static DisposableEntityChooser<Material> createWithTypeChooser(
final IViewContext<ICommonClientServiceAsync> viewContext, boolean detailsAvailable, final IViewContext<ICommonClientServiceAsync> viewContext, boolean detailsAvailable)
final Collection<Long> allowedMaterialIdsOrNull)
{ {
IMaterialCriteriaProvider materialCriteriaProvider = final MaterialBrowserToolbar toolbar = new MaterialBrowserToolbar(viewContext, null);
allowedMaterialIdsOrNull == null ? new BasicMaterialCriteriaProvider()
: new FilterByIdMaterialCriteriaProvider(allowedMaterialIdsOrNull);
final MaterialBrowserToolbar toolbar =
new MaterialBrowserToolbar(viewContext, null, materialCriteriaProvider);
final ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider = toolbar; final ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider = toolbar;
final MaterialBrowserGrid browserGrid = final MaterialBrowserGrid browserGrid =
createBrowserGrid(viewContext, criteriaProvider, detailsAvailable); createBrowserGrid(viewContext, criteriaProvider, detailsAvailable);
...@@ -109,12 +89,6 @@ public class MaterialBrowserGrid extends ...@@ -109,12 +89,6 @@ public class MaterialBrowserGrid extends
return browserGrid.asDisposableWithToolbar(toolbar); return browserGrid.asDisposableWithToolbar(toolbar);
} }
private static DisposableEntityChooser<Material> createWithTypeChooser(
final IViewContext<ICommonClientServiceAsync> viewContext, boolean detailsAvailable)
{
return createWithTypeChooser(viewContext, detailsAvailable, null);
}
/** /**
* If the material type is given, does not show the toolbar with material type selection and * If the material type is given, does not show the toolbar with material type selection and
* refreshes the grid automatically.<br> * refreshes the grid automatically.<br>
...@@ -168,9 +142,9 @@ public class MaterialBrowserGrid extends ...@@ -168,9 +142,9 @@ public class MaterialBrowserGrid extends
} }
private final ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider; protected final ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider;
private MaterialBrowserGrid(final IViewContext<ICommonClientServiceAsync> viewContext, protected MaterialBrowserGrid(final IViewContext<ICommonClientServiceAsync> viewContext,
boolean refreshAutomatically, boolean refreshAutomatically,
ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider) ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider)
{ {
...@@ -186,7 +160,7 @@ public class MaterialBrowserGrid extends ...@@ -186,7 +160,7 @@ public class MaterialBrowserGrid extends
return criteriaProvider; return criteriaProvider;
} }
private void extendBottomToolbar(boolean detailsAvailable) protected void extendBottomToolbar(boolean detailsAvailable)
{ {
if (detailsAvailable && viewContext.isSimpleMode() == false) if (detailsAvailable && viewContext.isSimpleMode() == false)
{ {
...@@ -225,7 +199,7 @@ public class MaterialBrowserGrid extends ...@@ -225,7 +199,7 @@ public class MaterialBrowserGrid extends
allowMultipleSelection(); // we allow deletion of multiple materials allowMultipleSelection(); // we allow deletion of multiple materials
} }
private void addGridRefreshListener(MaterialBrowserToolbar toolbar) protected void addGridRefreshListener(MaterialBrowserToolbar toolbar)
{ {
toolbar.setCriteriaChangedListeners(createGridRefreshDelegatedAction()); toolbar.setCriteriaChangedListeners(createGridRefreshDelegatedAction());
} }
......
...@@ -19,7 +19,6 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.materi ...@@ -19,7 +19,6 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.materi
import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.createOrDelete; import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.createOrDelete;
import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.edit; import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.edit;
import java.util.Collection;
import java.util.Set; import java.util.Set;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent; import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
...@@ -46,7 +45,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKin ...@@ -46,7 +45,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKin
* *
* @author Izabela Adamczyk * @author Izabela Adamczyk
*/ */
class MaterialBrowserToolbar extends ToolBar implements public class MaterialBrowserToolbar extends ToolBar implements
ICriteriaProvider<ListMaterialDisplayCriteria> ICriteriaProvider<ListMaterialDisplayCriteria>
{ {
public static final String ID = "material-browser-toolbar"; public static final String ID = "material-browser-toolbar";
...@@ -55,16 +54,13 @@ class MaterialBrowserToolbar extends ToolBar implements ...@@ -55,16 +54,13 @@ class MaterialBrowserToolbar extends ToolBar implements
private final IViewContext<ICommonClientServiceAsync> viewContext; private final IViewContext<ICommonClientServiceAsync> viewContext;
private final IMaterialCriteriaProvider materialCriteriaProvider;
public MaterialBrowserToolbar(final IViewContext<ICommonClientServiceAsync> viewContext, public MaterialBrowserToolbar(final IViewContext<ICommonClientServiceAsync> viewContext,
MaterialType initValueOrNull, IMaterialCriteriaProvider materialCriteriaProvider) MaterialType initValueOrNull)
{ {
this.viewContext = viewContext; this.viewContext = viewContext;
this.selectMaterialTypeCombo = this.selectMaterialTypeCombo =
MaterialTypeSelectionWidget MaterialTypeSelectionWidget
.createWithInitialValue(viewContext, initValueOrNull, ID); .createWithInitialValue(viewContext, initValueOrNull, ID);
this.materialCriteriaProvider = materialCriteriaProvider;
display(); display();
} }
...@@ -97,7 +93,7 @@ class MaterialBrowserToolbar extends ToolBar implements ...@@ -97,7 +93,7 @@ class MaterialBrowserToolbar extends ToolBar implements
{ {
return null; return null;
} }
return materialCriteriaProvider.getMaterialCriteria(selectedType); return ListMaterialDisplayCriteria.createForMaterialType(selectedType);
} }
@Override @Override
...@@ -129,34 +125,4 @@ class MaterialBrowserToolbar extends ToolBar implements ...@@ -129,34 +125,4 @@ class MaterialBrowserToolbar extends ToolBar implements
} }
} }
public interface IMaterialCriteriaProvider
{
public ListMaterialDisplayCriteria getMaterialCriteria(MaterialType type);
}
public static class BasicMaterialCriteriaProvider implements IMaterialCriteriaProvider
{
public ListMaterialDisplayCriteria getMaterialCriteria(MaterialType type)
{
return ListMaterialDisplayCriteria.createForMaterialType(type);
}
}
public static class FilterByIdMaterialCriteriaProvider implements IMaterialCriteriaProvider
{
private final Collection<Long> allowedMaterialIds;
public FilterByIdMaterialCriteriaProvider(Collection<Long> allowedMaterialIds)
{
this.allowedMaterialIds = allowedMaterialIds;
}
public ListMaterialDisplayCriteria getMaterialCriteria(MaterialType type)
{
return ListMaterialDisplayCriteria.createForMaterialTypeAndMaterialIds(type,
allowedMaterialIds);
}
}
} }
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
package ch.systemsx.cisd.openbis.generic.client.web.client.dto; package ch.systemsx.cisd.openbis.generic.client.web.client.dto;
import java.util.Collection;
import com.google.gwt.user.client.rpc.IsSerializable; import com.google.gwt.user.client.rpc.IsSerializable;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListMaterialCriteria; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListMaterialCriteria;
...@@ -34,22 +32,15 @@ public class ListMaterialDisplayCriteria extends DefaultResultSetConfig<String, ...@@ -34,22 +32,15 @@ public class ListMaterialDisplayCriteria extends DefaultResultSetConfig<String,
{ {
public static ListMaterialDisplayCriteria createForMaterialType(final MaterialType materialType) public static ListMaterialDisplayCriteria createForMaterialType(final MaterialType materialType)
{ {
return new ListMaterialDisplayCriteria(materialType, null); return new ListMaterialDisplayCriteria(materialType);
}
public static ListMaterialDisplayCriteria createForMaterialTypeAndMaterialIds(
final MaterialType materialType, final Collection<Long> materialIds)
{
return new ListMaterialDisplayCriteria(materialType, materialIds);
} }
private ListMaterialCriteria listCriteria; private ListMaterialCriteria listCriteria;
private ListMaterialDisplayCriteria(final MaterialType materialType, private ListMaterialDisplayCriteria(final MaterialType materialType)
final Collection<Long> materialIdsOrNull)
{ {
assert materialType != null : "material type not set"; assert materialType != null : "material type not set";
this.listCriteria = new ListMaterialCriteria(materialType, materialIdsOrNull); this.listCriteria = new ListMaterialCriteria(materialType);
} }
public ListMaterialCriteria getListCriteria() public ListMaterialCriteria getListCriteria()
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client; package ch.systemsx.cisd.openbis.plugin.screening.client.web.client;
import java.util.Collection;
import java.util.List; import java.util.List;
import ch.systemsx.cisd.openbis.generic.client.web.client.IClientService; import ch.systemsx.cisd.openbis.generic.client.web.client.IClientService;
...@@ -24,12 +23,14 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientService; ...@@ -24,12 +23,14 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientService;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GenericTableResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GenericTableResultSet;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListMaterialDisplayCriteria;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria;
import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException; import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow;
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.SampleParentWithDerived;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo;
...@@ -75,11 +76,6 @@ public interface IScreeningClientService extends IClientService ...@@ -75,11 +76,6 @@ public interface IScreeningClientService extends IClientService
*/ */
public PlateImages getPlateContentForDataset(TechId datasetId); public PlateImages getPlateContentForDataset(TechId datasetId);
/**
* @return ids of materials in experiment with specified id.
*/
public Collection<Long> listExperimentMaterials(TechId experimentTechId);
/** /**
* @return well locations which belong to a parent plate connected to a specified experiment(s) * @return well locations which belong to a parent plate connected to a specified experiment(s)
* and have specified material(s) inside. * and have specified material(s) inside.
...@@ -101,6 +97,12 @@ public interface IScreeningClientService extends IClientService ...@@ -101,6 +97,12 @@ public interface IScreeningClientService extends IClientService
IResultSetConfig<String, GenericTableRow> resultSetConfig, TechId sampleId) IResultSetConfig<String, GenericTableRow> resultSetConfig, TechId sampleId)
throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException; throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException;
/**
* Lists {@link Material}s of specified type in experiment with specified id.
*/
public ResultSet<Material> listExperimentMaterials(TechId experimentId,
ListMaterialDisplayCriteria criteria);
/** /**
* Like {@link ICommonClientService#prepareExportSamples(TableExportCriteria)}, but for * Like {@link ICommonClientService#prepareExportSamples(TableExportCriteria)}, but for
* GenericTableRow. * GenericTableRow.
...@@ -121,4 +123,5 @@ public interface IScreeningClientService extends IClientService ...@@ -121,4 +123,5 @@ public interface IScreeningClientService extends IClientService
* Returns plate geometry vocabulary. * Returns plate geometry vocabulary.
*/ */
public Vocabulary getPlateGeometryVocabulary() throws UserFailureException; public Vocabulary getPlateGeometryVocabulary() throws UserFailureException;
} }
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client; package ch.systemsx.cisd.openbis.plugin.screening.client.web.client;
import java.util.Collection;
import java.util.List; import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
...@@ -25,11 +24,13 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.IClientServiceAsync; ...@@ -25,11 +24,13 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.IClientServiceAsync;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GenericTableResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GenericTableResultSet;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListMaterialDisplayCriteria;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow;
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.SampleParentWithDerived;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo;
...@@ -62,12 +63,6 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync ...@@ -62,12 +63,6 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync
/** @see IScreeningClientService#getDataSetInfo(TechId) */ /** @see IScreeningClientService#getDataSetInfo(TechId) */
public void getDataSetInfo(TechId datasetTechId, AsyncCallback<ExternalData> callback); public void getDataSetInfo(TechId datasetTechId, AsyncCallback<ExternalData> callback);
/**
* @see IScreeningClientService#listExperimentMaterials(TechId)
*/
public void listExperimentMaterials(TechId experimentId,
AsyncCallback<Collection<Long>> callback);
/** /**
* @see IScreeningClientService#listPlateWells(DefaultResultSetConfig, * @see IScreeningClientService#listPlateWells(DefaultResultSetConfig,
* PlateMaterialsSearchCriteria) * PlateMaterialsSearchCriteria)
...@@ -111,4 +106,10 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync ...@@ -111,4 +106,10 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync
* @see IScreeningClientService#getPlateGeometryVocabulary() * @see IScreeningClientService#getPlateGeometryVocabulary()
*/ */
public void getPlateGeometryVocabulary(AsyncCallback<Vocabulary> callback); public void getPlateGeometryVocabulary(AsyncCallback<Vocabulary> callback);
/**
* @see IScreeningClientService#listExperimentMaterials(TechId, ListMaterialDisplayCriteria)
*/
public void listExperimentMaterials(TechId experimentId, ListMaterialDisplayCriteria criteria,
AsyncCallback<ResultSet<Material>> callback);
} }
/*
* Copyright 2008 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 ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.DisposableEntityChooser;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserGrid;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserToolbar;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListMaterialDisplayCriteria;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientServiceAsync;
/**
* A {@link MaterialBrowserGrid} extension for showing materials used in wells of an experiment.
*
* @author Piotr Buczek
*/
public class ExperimentWellMaterialBrowserGrid extends MaterialBrowserGrid
{
/**
* Creates a browser with a toolbar which allows to choose the material type. Allows to show or
* edit material details.
*/
public static DisposableEntityChooser<Material> createForExperiment(
final IViewContext<IScreeningClientServiceAsync> screeningViewContext,
TechId experimentId)
{
return createWithTypeChooser(screeningViewContext, experimentId);
}
private static DisposableEntityChooser<Material> createWithTypeChooser(
final IViewContext<IScreeningClientServiceAsync> screeningViewContext,
final TechId experimentId)
{
final MaterialBrowserToolbar toolbar =
new MaterialBrowserToolbar(screeningViewContext.getCommonViewContext(), null);
final ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider = toolbar;
final ExperimentWellMaterialBrowserGrid browserGrid =
createBrowserGrid(screeningViewContext, criteriaProvider, experimentId);
browserGrid.addGridRefreshListener(toolbar);
browserGrid.extendBottomToolbar(true);
return browserGrid.asDisposableWithToolbar(toolbar);
}
private static ExperimentWellMaterialBrowserGrid createBrowserGrid(
final IViewContext<IScreeningClientServiceAsync> screeningViewContext,
final ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider,
final TechId experimentId)
{
return new ExperimentWellMaterialBrowserGrid(screeningViewContext, true, criteriaProvider,
experimentId);
}
private final IViewContext<IScreeningClientServiceAsync> screeningViewContext;
private final TechId experimentId;
protected ExperimentWellMaterialBrowserGrid(
final IViewContext<IScreeningClientServiceAsync> screeningViewContext,
boolean refreshAutomatically,
ICriteriaProvider<ListMaterialDisplayCriteria> criteriaProvider, TechId experimentId)
{
super(screeningViewContext.getCommonViewContext(), refreshAutomatically, criteriaProvider);
this.screeningViewContext = screeningViewContext;
this.experimentId = experimentId;
}
@Override
protected ICriteriaProvider<ListMaterialDisplayCriteria> getCriteriaProvider()
{
return criteriaProvider;
}
@Override
protected void listEntities(DefaultResultSetConfig<String, Material> resultSetConfig,
AbstractAsyncCallback<ResultSet<Material>> callback)
{
criteria.copyPagingConfig(resultSetConfig);
screeningViewContext.getService().listExperimentMaterials(experimentId, criteria, callback);
}
// TODO 2010-09-06, Piotr Buczek: check
@Override
protected void prepareExportEntities(TableExportCriteria<Material> exportCriteria,
AbstractAsyncCallback<String> callback)
{
viewContext.getService().prepareExportMaterials(exportCriteria, callback);
}
// TODO 2010-09-06, Piotr Buczek: set experiment
// @Override
// protected void showEntityViewer(Material material, boolean editMode, boolean active)
// {
// showEntityInformationHolderViewer(material, editMode, active);
// }
}
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers; package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers;
import java.util.Collection;
import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableSectionPanel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableSectionPanel;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; 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.client.web.client.application.ui.grid.IDisposableComponent;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserGrid;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolderWithIdentifier; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolderWithIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; 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.IScreeningClientServiceAsync;
...@@ -28,8 +22,6 @@ public class ExperimentWellMaterialsSection extends DisposableSectionPanel ...@@ -28,8 +22,6 @@ public class ExperimentWellMaterialsSection extends DisposableSectionPanel
private final IEntityInformationHolderWithIdentifier experiment; private final IEntityInformationHolderWithIdentifier experiment;
private Collection<Long> allowedMaterialIds;
public ExperimentWellMaterialsSection( public ExperimentWellMaterialsSection(
IViewContext<IScreeningClientServiceAsync> screeningViewContext, IViewContext<IScreeningClientServiceAsync> screeningViewContext,
IEntityInformationHolderWithIdentifier experiment) IEntityInformationHolderWithIdentifier experiment)
...@@ -41,51 +33,11 @@ public class ExperimentWellMaterialsSection extends DisposableSectionPanel ...@@ -41,51 +33,11 @@ public class ExperimentWellMaterialsSection extends DisposableSectionPanel
setDisplayID(DisplayTypeIDGenerator.PLATE_MATERIAL_BROWSER, ID_SUFFIX); setDisplayID(DisplayTypeIDGenerator.PLATE_MATERIAL_BROWSER, ID_SUFFIX);
} }
@Override
protected void showContent()
{
IDelegatedAction onSuccessAction = new IDelegatedAction()
{
public void execute()
{
ExperimentWellMaterialsSection.super.showContent();
}
};
screeningViewContext.getService().listExperimentMaterials(
TechId.create(experiment),
new ListMaterialIdsCallback(viewContext.getCommonViewContext(), this,
onSuccessAction));
}
@Override @Override
protected IDisposableComponent createDisposableContent() protected IDisposableComponent createDisposableContent()
{ {
return MaterialBrowserGrid.createWithTypeChooser(viewContext.getCommonViewContext(), return ExperimentWellMaterialBrowserGrid.createForExperiment(screeningViewContext, TechId
allowedMaterialIds); .create(experiment));
}
private final class ListMaterialIdsCallback extends AbstractAsyncCallback<Collection<Long>>
{
private final IDelegatedAction onSuccessAction;
private ExperimentWellMaterialsSection section;
public ListMaterialIdsCallback(final IViewContext<ICommonClientServiceAsync> viewContext,
ExperimentWellMaterialsSection section, IDelegatedAction onSuccessAction)
{
super(viewContext);
this.section = section;
this.onSuccessAction = onSuccessAction;
}
@Override
protected void process(Collection<Long> result)
{
section.allowedMaterialIds = result;
onSuccessAction.execute();
}
} }
} }
\ No newline at end of file
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.server; package ch.systemsx.cisd.openbis.plugin.screening.client.web.server;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -37,6 +36,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns ...@@ -37,6 +36,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GenericTableResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GenericTableResultSet;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IResultSetConfig;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListMaterialDisplayCriteria;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria;
import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException; import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException;
...@@ -50,6 +50,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; ...@@ -50,6 +50,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableColumnHeader; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableColumnHeader;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow;
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.SampleParentWithDerived;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory;
...@@ -311,9 +312,22 @@ public final class ScreeningClientService extends AbstractClientService implemen ...@@ -311,9 +312,22 @@ public final class ScreeningClientService extends AbstractClientService implemen
.listImageChannelStacks(sessionToken, datasetCode, datastoreCode, wellLocation); .listImageChannelStacks(sessionToken, datasetCode, datastoreCode, wellLocation);
} }
public Collection<Long> listExperimentMaterials(TechId experimentId) public ResultSet<Material> listExperimentMaterials(final TechId experimentId,
final ListMaterialDisplayCriteria displayCriteria)
{ {
final String sessionToken = getSessionToken(); try
return server.listExperimentMaterials(sessionToken, experimentId); {
return listEntities(displayCriteria, new IOriginalDataProvider<Material>()
{
public List<Material> getOriginalData() throws UserFailureException
{
return server.listExperimentMaterials(getSessionToken(), experimentId,
displayCriteria.getListCriteria().getMaterialType());
}
});
} catch (final ch.systemsx.cisd.common.exceptions.UserFailureException e)
{
throw UserFailureExceptionTranslator.translate(e);
}
} }
} }
...@@ -42,6 +42,9 @@ import ch.systemsx.cisd.openbis.generic.server.plugin.ISampleTypeSlaveServerPlug ...@@ -42,6 +42,9 @@ import ch.systemsx.cisd.openbis.generic.server.plugin.ISampleTypeSlaveServerPlug
import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.ICommonServer;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListMaterialCriteria;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
...@@ -246,17 +249,20 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl ...@@ -246,17 +249,20 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl
materialTypeIdentifierOrNull); materialTypeIdentifierOrNull);
} }
public Collection<Long> listExperimentMaterials(String sessionToken, TechId experimentId) public List<Material> listExperimentMaterials(String sessionToken, TechId experimentId,
MaterialType materialType)
{ {
// TODO 2010-09-01, Piotr Buczek: move it to some BO when we have more queries like that // TODO 2010-09-01, Piotr Buczek: move it to some BO when we have more queries like that
IScreeningQuery dao = createDAO(getDAOFactory()); IScreeningQuery dao = createDAO(getDAOFactory());
DataIterator<Long> iterator = dao.getMaterialsForExperimentWells(experimentId.getId()); DataIterator<Long> materialIdsIterator =
Collection<Long> result = new ArrayList<Long>(); dao.getMaterialsForExperimentWells(experimentId.getId(), materialType.getId());
for (Long l : iterator) Collection<Long> materialIds = new ArrayList<Long>();
for (Long id : materialIdsIterator)
{ {
result.add(l); materialIds.add(id);
} }
return result; return commonServer.listMaterials(sessionToken, new ListMaterialCriteria(materialType,
materialIds), true);
} }
private static IScreeningQuery createDAO(IDAOFactory daoFactory) private static IScreeningQuery createDAO(IDAOFactory daoFactory)
...@@ -297,4 +303,5 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl ...@@ -297,4 +303,5 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl
{ {
return MINOR_VERSION; return MINOR_VERSION;
} }
} }
...@@ -25,6 +25,8 @@ import ch.systemsx.cisd.common.spring.IInvocationLoggerContext; ...@@ -25,6 +25,8 @@ import ch.systemsx.cisd.common.spring.IInvocationLoggerContext;
import ch.systemsx.cisd.openbis.generic.server.AbstractServerLogger; import ch.systemsx.cisd.openbis.generic.server.AbstractServerLogger;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived;
...@@ -208,9 +210,11 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree ...@@ -208,9 +210,11 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree
return null; return null;
} }
public Collection<Long> listExperimentMaterials(String sessionToken, TechId experimentId) public List<Material> listExperimentMaterials(String sessionToken, TechId experimentId,
MaterialType materialType)
{ {
logAccess(sessionToken, "listExperimentMaterials", "experimentId(%s)", experimentId); logAccess(sessionToken, "listExperimentMaterials", "experimentId(%s), materialType(%s)",
experimentId, materialType);
return null; return null;
} }
......
...@@ -210,17 +210,6 @@ public interface IScreeningQuery extends BaseQuery ...@@ -210,17 +210,6 @@ public interface IScreeningQuery extends BaseQuery
+ " and pt.is_internal_namespace = true and space.code = ?{1} and pl.code = ?{2}") + " and pt.is_internal_namespace = true and space.code = ?{1} and pl.code = ?{2}")
public PlateGeometryContainer tryGetPlateGeometry(String spaceCode, String plateCode); public PlateGeometryContainer tryGetPlateGeometry(String spaceCode, String plateCode);
/**
* Returns the ids of all materials used in specified experiment.
*/
@Select(sql = "SELECT distinct well_material.id "
+ " FROM samples pl "
+ " JOIN samples well ON well.samp_id_part_of = pl.id"
+ " JOIN sample_properties well_props ON well_props.samp_id = well.id"
+ " JOIN materials well_material ON well_material.id = well_props.mate_prop_id"
+ " WHERE pl.expe_id = ?{1}", fetchSize = FETCH_SIZE)
public DataIterator<Long> getMaterialsForExperimentWells(long experimentId);
/** /**
* Returns the ids of materials of specified type and used in specified experiment. * Returns the ids of materials of specified type and used in specified experiment.
*/ */
...@@ -230,7 +219,7 @@ public interface IScreeningQuery extends BaseQuery ...@@ -230,7 +219,7 @@ public interface IScreeningQuery extends BaseQuery
+ " JOIN sample_properties well_props ON well_props.samp_id = well.id" + " JOIN sample_properties well_props ON well_props.samp_id = well.id"
+ " JOIN materials well_material ON well_material.id = well_props.mate_prop_id" + " JOIN materials well_material ON well_material.id = well_props.mate_prop_id"
+ " WHERE pl.expe_id = ?{1} " + " WHERE pl.expe_id = ?{1} "
+ " AND well_material.maty_id = {2}", fetchSize = FETCH_SIZE) + " AND well_material.maty_id = ?{2}", fetchSize = FETCH_SIZE)
public DataIterator<Long> getMaterialsForExperimentWells(long experimentId, long materialTypeId); public DataIterator<Long> getMaterialsForExperimentWells(long experimentId, long materialTypeId);
} }
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.plugin.screening.shared; package ch.systemsx.cisd.openbis.plugin.screening.shared;
import java.util.Collection;
import java.util.List; import java.util.List;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -32,6 +31,8 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractT ...@@ -32,6 +31,8 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractT
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ExperimentTechIdPredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ExperimentTechIdPredicate;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived;
...@@ -79,12 +80,15 @@ public interface IScreeningServer extends IServer ...@@ -79,12 +80,15 @@ public interface IScreeningServer extends IServer
@AuthorizationGuard(guardClass = PlateMaterialsSearchCriteriaPredicate.class) PlateMaterialsSearchCriteria materialCriteria); @AuthorizationGuard(guardClass = PlateMaterialsSearchCriteriaPredicate.class) PlateMaterialsSearchCriteria materialCriteria);
/** /**
* Loads all ids of materials connected with the specified experiment. * Loads all materials of specified type connected with the specified experiment.
*
* @param materialType
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
@RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER)
public Collection<Long> listExperimentMaterials(String sessionToken, public List<Material> listExperimentMaterials(String sessionToken,
@AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId); @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId,
MaterialType materialType);
@Transactional @Transactional
@RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment