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 492e7f68bccb7ff10212d8d3067a559b5b0b267c..4990d245edbeaa1be13199b4ee2a68fac1a63df0 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 @@ -55,7 +55,7 @@ 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.PlateMaterialLocationsLoader; 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.shared.IScreeningServer; @@ -155,7 +155,7 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl PlateMaterialsSearchCriteria materialCriteria) { Session session = getSession(sessionToken); - return GenePlateLocationsLoader.load(session, businessObjectFactory, getDAOFactory(), + return PlateMaterialLocationsLoader.load(session, businessObjectFactory, getDAOFactory(), materialCriteria, true); } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/GenePlateLocationsLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateMaterialLocationsLoader.java similarity index 93% rename from screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/GenePlateLocationsLoader.java rename to screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateMaterialLocationsLoader.java index 6030713c3938da2c8fcb48958038731f3884a215..005266255e087337b450a35b88304d6dc33413a4 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/GenePlateLocationsLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateMaterialLocationsLoader.java @@ -70,33 +70,40 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterials import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria.SingleExperimentSearchCriteria; /** + * Loades selected wells content: metadata and (if available) image dataset and feature vectors. + * * @author Tomasz Pylak */ @Friend(toClasses = IScreeningQuery.class) -public class GenePlateLocationsLoader +public class PlateMaterialLocationsLoader { + /** + * Finds wells containing the specified material and belonging to the specified experiment. + * Loads wells content: metadata and (if available) image dataset and feature vectors. + */ public static List<WellContent> load(Session session, IScreeningBusinessObjectFactory businessObjectFactory, IDAOFactory daoFactory, TechId geneMaterialId, String experimentPermId, boolean enrichWithImages) { - return new GenePlateLocationsLoader(session, businessObjectFactory, daoFactory) + return new PlateMaterialLocationsLoader(session, businessObjectFactory, daoFactory) .getPlateLocations(geneMaterialId, experimentPermId, enrichWithImages); } public static List<WellContent> load(Session session, IScreeningBusinessObjectFactory businessObjectFactory, IDAOFactory daoFactory, - TechId geneMaterialId) + PlateMaterialsSearchCriteria materialCriteria, boolean enrichWithImages) { - return new GenePlateLocationsLoader(session, businessObjectFactory, daoFactory) - .getPlateLocations(geneMaterialId); + return new PlateMaterialLocationsLoader(session, businessObjectFactory, daoFactory) + .getPlateLocations(materialCriteria, enrichWithImages); } - public static List<WellContent> load(Session session, + /** loads wells metadata, but no information about image or image analysis datasets */ + public static List<WellContent> loadOnlyMetadata(Session session, IScreeningBusinessObjectFactory businessObjectFactory, IDAOFactory daoFactory, - PlateMaterialsSearchCriteria materialCriteria, boolean enrichWithImages) + TechId geneMaterialId) { - return new GenePlateLocationsLoader(session, businessObjectFactory, daoFactory) - .getPlateLocations(materialCriteria, enrichWithImages); + return new PlateMaterialLocationsLoader(session, businessObjectFactory, daoFactory) + .getPlateLocations(geneMaterialId); } private final Session session; @@ -105,7 +112,7 @@ public class GenePlateLocationsLoader private final IDAOFactory daoFactory; - private GenePlateLocationsLoader(Session session, + private PlateMaterialLocationsLoader(Session session, IScreeningBusinessObjectFactory businessObjectFactory, IDAOFactory daoFactory) { this.session = session; @@ -119,7 +126,7 @@ public class GenePlateLocationsLoader List<WellContent> locations = loadLocations(materialCriteria); if (enrichWithImages) { - return enrichWithImages(locations); + return enrichWithDatasets(locations); } else { return locations; @@ -132,7 +139,7 @@ public class GenePlateLocationsLoader List<WellContent> locations = loadLocations(geneMaterialId, experimentPermId); if (enrichWithImages) { - return enrichWithImages(locations); + return enrichWithDatasets(locations); } else { return locations; @@ -144,7 +151,7 @@ public class GenePlateLocationsLoader return loadLocations(geneMaterialId); } - private List<WellContent> enrichWithImages(List<WellContent> locations) + private List<WellContent> enrichWithDatasets(List<WellContent> locations) { List<ExternalData> imageDatasets = loadImageDatasets(locations); Map<Long/* plate id */, List<ExternalData>> plateToDatasetMap = @@ -274,13 +281,13 @@ public class GenePlateLocationsLoader if (expId == null) { locations = - dao.getPlateLocationsForMaterialCodes(ids, codesCriteria - .getMaterialTypeCodes()); + dao.getPlateLocationsForMaterialCodes(ids, + codesCriteria.getMaterialTypeCodes()); } else { locations = - dao.getPlateLocationsForMaterialCodes(ids, codesCriteria - .getMaterialTypeCodes(), expId); + dao.getPlateLocationsForMaterialCodes(ids, + codesCriteria.getMaterialTypeCodes(), expId); } } else if (materialSearchCriteria.tryGetMaterialId() != null) @@ -331,9 +338,10 @@ public class GenePlateLocationsLoader } criteria.setCriteria(listOfCriteria); criteria.setConnection(SearchCriteriaConnection.MATCH_ANY); - return ArrayUtils.toPrimitive(daoFactory.getHibernateSearchDAO().searchForEntityIds( - criteria, - ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.MATERIAL) + return ArrayUtils.toPrimitive(daoFactory + .getHibernateSearchDAO() + .searchForEntityIds(criteria, + ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.MATERIAL) .toArray(new Long[0])); } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImpl.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImpl.java index efe887c4a285e70c2a379de904ec0e0aaa152e6a..2d7102f23a45c158a52d8a72a9e39f6796f6a976 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImpl.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImpl.java @@ -254,7 +254,7 @@ public class ScreeningApiImpl final ExperimentIdentifier fullExperimentIdentifier = getExperimentIdentifierFromDB(experimentIdentifier); wellContent = - GenePlateLocationsLoader.load(session, businessObjectFactory, daoFactory, + PlateMaterialLocationsLoader.load(session, businessObjectFactory, daoFactory, new TechId(materialOrNull.getId()), fullExperimentIdentifier.getPermId(), false); if (findDatasets) @@ -294,7 +294,7 @@ public class ScreeningApiImpl materialIdentifier.getAugmentedCode()); } final List<WellContent> wellContent = - GenePlateLocationsLoader.load(session, businessObjectFactory, daoFactory, + PlateMaterialLocationsLoader.loadOnlyMetadata(session, businessObjectFactory, daoFactory, new TechId(materialOrNull.getId())); if (findDatasets)