changeset 1656:94732906b094

Made feed() operation able to remove existing data items from Artifact's data pool. flys-artifacts/trunk@2850 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 28 Sep 2011 09:17:20 +0000
parents d251e5929860
children 91d038c7aae5
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Sep 28 08:20:29 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Sep 28 09:17:20 2011 +0000
@@ -1,3 +1,10 @@
+2011-09-28  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: Made
+	  feed() able to remove existing data items from Artifact's data pool.
+	  Therefore, the value for the item which should be removed needs to an
+	  empty string.
+
 2011-09-28  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	Extracted StringUtil.unbracket from WaterlevelSelectState.strip.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Wed Sep 28 08:20:29 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Wed Sep 28 09:17:20 2011 +0000
@@ -489,6 +489,11 @@
     }
 
 
+    protected StateData removeData(String name) {
+        return this.data.remove(name);
+    }
+
+
     /**
      * This method returns a specific StateData object that is stored in the
      * data pool of this artifact.
@@ -570,6 +575,11 @@
 
                 addData(name, current.transform(this, context, name, value));
             }
+            else if (name.length() > 0 && value.length() == 0) {
+                if (removeData(name) != null) {
+                    logger.debug("Removed data '" + name + "' successfully.");
+                }
+            }
         }
 
         current.validate(this);

http://dive4elements.wald.intevation.org