diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifier.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifier.java index 441695289f1781ab2fd53d7c048cf9f5463450a9..f33472edcf123a59209f3fed3a1fedd12dc6d3e7 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifier.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifier.java @@ -23,6 +23,7 @@ import java.util.StringTokenizer; import org.apache.commons.lang.StringUtils; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SampleIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.basic.CodeConverter; /** * Helper class which parses a sample identifier string. @@ -80,8 +81,9 @@ public class FullSampleIdentifier verifyCodePattern(containerCode, "Container sample code"); verifyCodePattern(plainSampleCode, containerCode == null ? "Sample code" : "Sample subcode"); - sampleCode = plainSampleCode; - sampleIdentifierParts = new SampleIdentifierParts(spaceCode, projectCode, containerCode); + sampleCode = CodeConverter.tryToDatabase(plainSampleCode); + sampleIdentifierParts = new SampleIdentifierParts(CodeConverter.tryToDatabase(spaceCode), + CodeConverter.tryToDatabase(projectCode), CodeConverter.tryToDatabase(containerCode)); } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifierTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifierTest.java index f74dfa8e1e18498a67e58d5f919f9ade3c46f727..6dd19ca330af74a06d8eb9b2e68b5240854fe692 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifierTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/FullSampleIdentifierTest.java @@ -38,10 +38,11 @@ public class FullSampleIdentifierTest assertSampId("/SPACE1/S2:A02"); assertSampId("/SPACE1/PROJECT1/S1"); assertSampId("/SPACE1/PROJECT1/S1:A02"); - assertSampIdWithHomeSpace("/HS/S1", "//S1", "HS"); - assertSampIdWithHomeSpace("/HS/C1:S1", "//C1:S1", "HS"); - assertSampIdWithHomeSpace("/HS/PROJECT1/S1", "//PROJECT1/S1", "HS"); - assertSampIdWithHomeSpace("/HS/PROJECT1/C1:S1", "//PROJECT1/C1:S1", "HS"); + assertSampIdWithHomeSpace("/HS/S1", "//s1", "HS"); + assertSampIdWithHomeSpace("/HS/C1:S1", "//c1:s1", "HS"); + assertSampIdWithHomeSpace("/HS/PROJECT1/S1", "//Project1/s1", "HS"); + assertSampIdWithHomeSpace("/HS/PROJECT1/C1:S1", "//project1/c1:s1", "HS"); + assertSampIdWithHomeSpace("/SP1/PROJECT1/C1:S1", "/sp1/project1/c1:s1", "HS"); } @Test