From 65f8dbf47f841d0afe7b55cd5b6ee54fd96f4fa7 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Tue, 14 Dec 2010 10:55:03 +0000 Subject: [PATCH] [LMS-1921] fixed dependencies SVN: 19122 --- .../server/logic/ScreeningApiImpl.java | 4 ++- .../shared/api/v1/dto/WellIdentifier.java | 33 ++++++++----------- .../server/logic/ScreeningApiImplTest.java | 4 +-- 3 files changed, 18 insertions(+), 23 deletions(-) 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 087a7d988de..db14749c77d 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 @@ -404,9 +404,11 @@ public class ScreeningApiImpl private static WellIdentifier asWellIdentifier(Sample sample, PlateIdentifier plateIdentifier) { + // need to translate location to position to use it in API WellLocation location = ScreeningUtils.tryCreateLocationFromMatrixCoordinate(sample.getCode()); - return new WellIdentifier(plateIdentifier, sample.getPermId(), location); + WellPosition position = new WellPosition(location.getRow(), location.getColumn()); + return new WellIdentifier(plateIdentifier, position, sample.getPermId()); } public List<PlateWellMaterialMapping> listPlateMaterialMapping( diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/WellIdentifier.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/WellIdentifier.java index 13b5d34ed2a..906cba4af92 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/WellIdentifier.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/WellIdentifier.java @@ -1,7 +1,5 @@ package ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation; - /** * Contains data which uniquely define a plate. * @@ -13,14 +11,13 @@ public class WellIdentifier extends PermanentIdentifier private final PlateIdentifier plateIdentifier; - private final int row, col; + private final WellPosition wellPosition; - public WellIdentifier(PlateIdentifier plateIdentifier, String permId, WellLocation wellLocation) + public WellIdentifier(PlateIdentifier plateIdentifier, WellPosition wellPosition, String permId) { super(permId); + this.wellPosition = wellPosition; this.plateIdentifier = plateIdentifier; - this.row = wellLocation.getRow(); - this.col = wellLocation.getColumn(); } public PlateIdentifier getPlateIdentifier() @@ -28,14 +25,9 @@ public class WellIdentifier extends PermanentIdentifier return plateIdentifier; } - public int getRow() - { - return row; - } - - public int getCol() + public WellPosition getWellPosition() { - return col; + return wellPosition; } @Override @@ -49,9 +41,8 @@ public class WellIdentifier extends PermanentIdentifier { final int prime = 31; int result = super.hashCode(); - result = prime * result + col; + result = prime * result + ((wellPosition == null) ? 0 : wellPosition.hashCode()); result = prime * result + ((plateIdentifier == null) ? 0 : plateIdentifier.hashCode()); - result = prime * result + row; return result; } @@ -71,7 +62,13 @@ public class WellIdentifier extends PermanentIdentifier return false; } WellIdentifier other = (WellIdentifier) obj; - if (col != other.col) + if (wellPosition == null) + { + if (other.wellPosition != null) + { + return false; + } + } else if (!wellPosition.equals(other.wellPosition)) { return false; } @@ -85,10 +82,6 @@ public class WellIdentifier extends PermanentIdentifier { return false; } - if (row != other.row) - { - return false; - } return true; } diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java index 7e773a92321..064a6479b4e 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java @@ -52,8 +52,8 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Geometry; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.ImageDatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.WellIdentifier; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.WellPosition; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation; /** * @author Franz-Josef Elmer @@ -150,7 +150,7 @@ public class ScreeningApiImplTest extends AbstractServerTestCase private static WellIdentifier wellIdentifier(PlateIdentifier plate, String wellPermId, int row, int col) { - return new WellIdentifier(plate, wellPermId, new WellLocation(row, col)); + return new WellIdentifier(plate, new WellPosition(row, col), wellPermId); } @Test -- GitLab