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 087a7d988de3cc663284b33cb4bb0e3916a70e84..db14749c77d62c2582d05ecc9888abd2c3372260 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 13b5d34ed2a2f3695d1701d40629891c5d8cb1f9..906cba4af92c733601da1a43bf68a7f169de7c17 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 7e773a9232145b60b8ba4e3f3d9d8c91bea7b86d..064a6479b4e15bece8555a66e198323b47795cd5 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