From b13fc961e30cd4f7a8f808bac6ea54cbb4ac35ae Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Tue, 21 May 2013 13:48:26 +0000
Subject: [PATCH] SP-625 BIS-398: Bugfix detected by tests.

SVN: 29179
---
 .../ch/systemsx/cisd/openbis/generic/server/CommonServer.java  | 2 ++
 .../generic/server/business/bo/EntityTypePropertyTypeBO.java   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java
index ab3509da6dd..6b372ba898c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java
@@ -1333,6 +1333,7 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt
                 if (ini.get(i).getPropertyType().getCode().equals(fin.get(i).getPropertyType().getCode())) // Do nothing.
                 {
                     // Positions are equal but maybe something have changed.
+                    newETNewPTAssigments.getAssigments().get(i).getAssignment().setModificationDate(null);
                     updatePropertyTypeAssignment(sessionToken, newETNewPTAssigments.getAssigments().get(i).getAssignment());
                 } else
                 // Something needs to be done.
@@ -1349,6 +1350,7 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt
                     {
                         if (ini.contains(fin.get(i))) // Is present into another position, but is not this one, move it.
                         { // Edit
+                            newETNewPTAssigments.getAssigments().get(i).getAssignment().setModificationDate(null);
                             updatePropertyTypeAssignment(sessionToken, newETNewPTAssigments.getAssigments().get(i).getAssignment());
                             ini.remove(fin.get(i));
                             ini.add(i, fin.get(i));
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java
index b12c16bb002..3c2d8681287 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java
@@ -217,7 +217,8 @@ public class EntityTypePropertyTypeBO extends AbstractBusinessObject implements
     @Override
     public void updateLoadedAssignment(NewETPTAssignment assignmentUpdates)
     {
-        if (assignment.getModificationDate().equals(assignmentUpdates.getModificationDate()))
+        if (assignmentUpdates.getModificationDate() != null && // Avoid validation, needed to make multiple modifications with one call
+                assignment.getModificationDate().equals(assignmentUpdates.getModificationDate()) == false)
         {
             throwModifiedEntityException("Property type assignment");
         }
-- 
GitLab