Skip to content
Snippets Groups Projects
Commit 448d04c7 authored by felmer's avatar felmer
Browse files

SSDM-2601: FullSampleIndetifier normalizes the codes

SVN: 35046
parent cf72d15e
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ import java.util.StringTokenizer; ...@@ -23,6 +23,7 @@ import java.util.StringTokenizer;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SampleIdentifier; 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. * Helper class which parses a sample identifier string.
...@@ -80,8 +81,9 @@ public class FullSampleIdentifier ...@@ -80,8 +81,9 @@ public class FullSampleIdentifier
verifyCodePattern(containerCode, "Container sample code"); verifyCodePattern(containerCode, "Container sample code");
verifyCodePattern(plainSampleCode, containerCode == null ? "Sample code" : "Sample subcode"); verifyCodePattern(plainSampleCode, containerCode == null ? "Sample code" : "Sample subcode");
sampleCode = plainSampleCode; sampleCode = CodeConverter.tryToDatabase(plainSampleCode);
sampleIdentifierParts = new SampleIdentifierParts(spaceCode, projectCode, containerCode); sampleIdentifierParts = new SampleIdentifierParts(CodeConverter.tryToDatabase(spaceCode),
CodeConverter.tryToDatabase(projectCode), CodeConverter.tryToDatabase(containerCode));
} }
......
...@@ -38,10 +38,11 @@ public class FullSampleIdentifierTest ...@@ -38,10 +38,11 @@ public class FullSampleIdentifierTest
assertSampId("/SPACE1/S2:A02"); assertSampId("/SPACE1/S2:A02");
assertSampId("/SPACE1/PROJECT1/S1"); assertSampId("/SPACE1/PROJECT1/S1");
assertSampId("/SPACE1/PROJECT1/S1:A02"); assertSampId("/SPACE1/PROJECT1/S1:A02");
assertSampIdWithHomeSpace("/HS/S1", "//S1", "HS"); assertSampIdWithHomeSpace("/HS/S1", "//s1", "HS");
assertSampIdWithHomeSpace("/HS/C1:S1", "//C1:S1", "HS"); assertSampIdWithHomeSpace("/HS/C1:S1", "//c1:s1", "HS");
assertSampIdWithHomeSpace("/HS/PROJECT1/S1", "//PROJECT1/S1", "HS"); assertSampIdWithHomeSpace("/HS/PROJECT1/S1", "//Project1/s1", "HS");
assertSampIdWithHomeSpace("/HS/PROJECT1/C1:S1", "//PROJECT1/C1:S1", "HS"); assertSampIdWithHomeSpace("/HS/PROJECT1/C1:S1", "//project1/c1:s1", "HS");
assertSampIdWithHomeSpace("/SP1/PROJECT1/C1:S1", "/sp1/project1/c1:s1", "HS");
} }
@Test @Test
......
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