From 3770dd355cd145041180018f4fc4ad1c0b34b65c Mon Sep 17 00:00:00 2001
From: tpylak <tpylak>
Date: Fri, 18 Nov 2011 15:02:52 +0000
Subject: [PATCH] LMS-2648 remove the property when it's set to null

SVN: 23717
---
 .../registrator/DataSetRegistrationDetails.java  | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/DataSetRegistrationDetails.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/DataSetRegistrationDetails.java
index 7a7b9cd15b7..4b0ab782301 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/DataSetRegistrationDetails.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/DataSetRegistrationDetails.java
@@ -141,14 +141,20 @@ public class DataSetRegistrationDetails<T extends DataSetInformation> implements
     public void setPropertyValue(String propertyCode, String propertyValue)
     {
         ExtractableData datasetExtractableData = dataSetInformation.getExtractableData();
-        List<NewProperty> properties = datasetExtractableData.getDataSetProperties();
-        NewProperty property = EntityHelper.tryFindProperty(properties, propertyCode);
-        if (property != null)
+        if (propertyValue == null)
         {
-            property.setValue(propertyValue);
+            datasetExtractableData.removeDataSetProperty(propertyCode);
         } else
         {
-            properties.add(new NewProperty(propertyCode, propertyValue));
+            List<NewProperty> properties = datasetExtractableData.getDataSetProperties();
+            NewProperty property = EntityHelper.tryFindProperty(properties, propertyCode);
+            if (property != null)
+            {
+                property.setValue(propertyValue);
+            } else
+            {
+                properties.add(new NewProperty(propertyCode, propertyValue));
+            }
         }
     }
 
-- 
GitLab