From 90e16d1f887904ecc3c61abc7b78628577b80682 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Thu, 15 Dec 2016 09:41:16 +0000
Subject: [PATCH] SSDM-4187: Improve SampleOwnerIdentifier.toString() in case
 project identifier is an ExperimentIdentifier

SVN: 37504
---
 .../generic/shared/dto/identifier/ProjectIdentifier.java     | 5 +++++
 .../generic/shared/dto/identifier/SampleOwnerIdentifier.java | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/ProjectIdentifier.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/ProjectIdentifier.java
index 4d916cc5c1c..854f8ad9e9e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/ProjectIdentifier.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/ProjectIdentifier.java
@@ -60,6 +60,11 @@ public class ProjectIdentifier extends SpaceIdentifier
     {
         this.projectCode = projectCode;
     }
+    
+    public String asProjectIdentifierString()
+    {
+        return new ProjectIdentifier(getSpaceCode(), getProjectCode()).toString();
+    }
 
     @Override
     public boolean equals(final Object obj)
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/SampleOwnerIdentifier.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/SampleOwnerIdentifier.java
index 9cd6dabef7b..17de3484743 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/SampleOwnerIdentifier.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/SampleOwnerIdentifier.java
@@ -95,7 +95,7 @@ public class SampleOwnerIdentifier extends AbstractHashable implements Serializa
     {
         if (isProjectLevel())
         {
-            return projectIdentifier.toString() + Constants.IDENTIFIER_SEPARATOR;
+            return projectIdentifier.asProjectIdentifierString() + Constants.IDENTIFIER_SEPARATOR;
         } else if (isSpaceLevel())
         {
             if (isInsideHomeSpace())
-- 
GitLab