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

[LMS-1690] screening erroneous solution

SVN: 17713
parent 420e6d9b
No related branches found
No related tags found
No related merge requests found
Showing
with 161 additions and 9 deletions
......@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client;
import java.util.Collection;
import java.util.List;
import ch.systemsx.cisd.openbis.generic.client.web.client.IClientService;
......@@ -31,12 +32,12 @@ 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.SampleParentWithDerived;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
......@@ -74,6 +75,11 @@ public interface IScreeningClientService extends IClientService
*/
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)
* and have specified material(s) inside.
......
......@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.client;
import java.util.Collection;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
......@@ -31,12 +32,12 @@ 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.SampleParentWithDerived;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
......@@ -61,6 +62,12 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync
/** @see IScreeningClientService#getDataSetInfo(TechId) */
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,
* PlateMaterialsSearchCriteria)
......
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.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.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.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;
......@@ -18,12 +24,12 @@ public class ExperimentWellMaterialsSection extends DisposableSectionPanel
{
public static final String ID_SUFFIX = "ExperimentWellMaterialsSection";
@SuppressWarnings("unused")
private final IViewContext<IScreeningClientServiceAsync> screeningViewContext;
@SuppressWarnings("unused")
private final IEntityInformationHolderWithIdentifier experiment;
private Collection<Long> allowedMaterialIds;
public ExperimentWellMaterialsSection(
IViewContext<IScreeningClientServiceAsync> screeningViewContext,
IEntityInformationHolderWithIdentifier experiment)
......@@ -35,10 +41,51 @@ public class ExperimentWellMaterialsSection extends DisposableSectionPanel
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
protected IDisposableComponent createDisposableContent()
{
return MaterialBrowserGrid.createWithTypeChooser(viewContext.getCommonViewContext());
return MaterialBrowserGrid.createWithTypeChooser(viewContext.getCommonViewContext(),
allowedMaterialIds);
}
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,6 +16,7 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.server;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -57,13 +58,13 @@ import ch.systemsx.cisd.openbis.plugin.screening.BuildAndEnvironmentInfo;
import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientService;
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.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
......@@ -185,6 +186,25 @@ public final class ScreeningClientService extends AbstractClientService implemen
}
}
public ResultSet<WellContent> listExperimentMaterials(
DefaultResultSetConfig<String, WellContent> gridCriteria,
final PlateMaterialsSearchCriteria materialCriteria)
{
try
{
return listEntities(gridCriteria, new IOriginalDataProvider<WellContent>()
{
public List<WellContent> getOriginalData() throws UserFailureException
{
return server.listPlateWells(getSessionToken(), materialCriteria);
}
});
} catch (final ch.systemsx.cisd.common.exceptions.UserFailureException e)
{
throw UserFailureExceptionTranslator.translate(e);
}
}
public String prepareExportPlateLocations(TableExportCriteria<WellContent> criteria)
throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
{
......@@ -290,4 +310,10 @@ public final class ScreeningClientService extends AbstractClientService implemen
return server
.listImageChannelStacks(sessionToken, datasetCode, datastoreCode, wellLocation);
}
public Collection<Long> listExperimentMaterials(TechId experimentId)
{
final String sessionToken = getSessionToken();
return server.listExperimentMaterials(sessionToken, experimentId);
}
}
......@@ -16,10 +16,16 @@
package ch.systemsx.cisd.openbis.plugin.screening.server;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
import net.lemnik.eodsql.DataIterator;
import net.lemnik.eodsql.QueryTool;
import org.springframework.stereotype.Component;
import ch.rinn.restrictions.Private;
......@@ -28,6 +34,7 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.spring.IInvocationLoggerContext;
import ch.systemsx.cisd.openbis.generic.server.AbstractServer;
import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleBO;
import ch.systemsx.cisd.openbis.generic.server.business.bo.common.DatabaseContextUtils;
import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
import ch.systemsx.cisd.openbis.generic.server.dataaccess.IVocabularyDAO;
import ch.systemsx.cisd.openbis.generic.server.plugin.IDataSetTypeSlaveServerPlugin;
......@@ -44,6 +51,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO;
import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE;
import ch.systemsx.cisd.openbis.generic.shared.translator.SampleTranslator;
import ch.systemsx.cisd.openbis.generic.shared.translator.VocabularyTranslator;
import ch.systemsx.cisd.openbis.plugin.screening.server.dataaccess.IScreeningQuery;
import ch.systemsx.cisd.openbis.plugin.screening.server.logic.GenePlateLocationsLoader;
import ch.systemsx.cisd.openbis.plugin.screening.server.logic.PlateContentLoader;
import ch.systemsx.cisd.openbis.plugin.screening.server.logic.ScreeningApiImpl;
......@@ -59,11 +67,11 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Plate;
import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier;
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.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
......@@ -238,6 +246,25 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl
materialTypeIdentifierOrNull);
}
public Collection<Long> listExperimentMaterials(String sessionToken, TechId experimentId)
{
// TODO 2010-09-01, Piotr Buczek: move it to some BO when we have more queries like that
IScreeningQuery dao = createDAO(getDAOFactory());
DataIterator<Long> iterator = dao.getMaterialsForExperimentWells(experimentId.getId());
Collection<Long> result = new ArrayList<Long>();
for (Long l : iterator)
{
result.add(l);
}
return result;
}
private static IScreeningQuery createDAO(IDAOFactory daoFactory)
{
Connection connection = DatabaseContextUtils.getConnection(daoFactory);
return QueryTool.getQuery(connection, IScreeningQuery.class);
}
private ScreeningApiImpl createScreeningApiImpl(String sessionToken)
{
final Session session = getSession(sessionToken);
......
......@@ -42,11 +42,11 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Plate;
import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier;
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.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
......@@ -208,6 +208,12 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree
return null;
}
public Collection<Long> listExperimentMaterials(String sessionToken, TechId experimentId)
{
logAccess(sessionToken, "listExperimentMaterials", "experimentId(%s)", experimentId);
return null;
}
public int getMajorVersion()
{
return MAJOR_VERSION;
......@@ -217,4 +223,5 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree
{
return ScreeningServer.MINOR_VERSION;
}
}
......@@ -210,4 +210,27 @@ public interface IScreeningQuery extends BaseQuery
+ " and pt.is_internal_namespace = true and space.code = ?{1} and pl.code = ?{2}")
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.
*/
@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} "
+ " AND well_material.maty_id = {2}", fetchSize = FETCH_SIZE)
public DataIterator<Long> getMaterialsForExperimentWells(long experimentId, long materialTypeId);
}
......@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.plugin.screening.shared;
import java.util.Collection;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
......@@ -38,11 +39,11 @@ 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.plugin.screening.shared.authorization.PlateMaterialsSearchCriteriaPredicate;
import ch.systemsx.cisd.openbis.plugin.screening.shared.authorization.WellContentValidator;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellImageChannelStack;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
......@@ -77,6 +78,14 @@ public interface IScreeningServer extends IServer
String sessionToken,
@AuthorizationGuard(guardClass = PlateMaterialsSearchCriteriaPredicate.class) PlateMaterialsSearchCriteria materialCriteria);
/**
* Loads all ids of materials connected with the specified experiment.
*/
@Transactional(readOnly = true)
@RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER)
public Collection<Long> listExperimentMaterials(String sessionToken,
@AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId);
@Transactional
@RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER)
public List<WellImageChannelStack> listImageChannelStacks(String sessionToken,
......
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