changeset 2015:61667c3a0003

Disabled default values in Artifact's DESCRIBE document - added a system property to re-enable those default values. flys-artifacts/trunk@3468 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 19 Dec 2011 16:11:13 +0000
parents b11793a3e7c7
children 796dfe96b6b2
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java
diffstat 2 files changed, 30 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Dec 19 15:47:34 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Dec 19 16:11:13 2011 +0000
@@ -1,3 +1,14 @@
+2011-12-19  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue202 (W-INFo: Wasserspiegellagenberechnung / Vorbelegung Strecke)
+
+	* src/main/java/de/intevation/flys/artifacts/states/DefaultState.java:
+	  Added a system property which is used to determine, if the DESCRIBE
+	  document of an Artifact should include default values (values, that have
+	  been inserted by the user some time ago) or not. The default case is,
+	  that the DESCRIBE does NOT include default values. To enable default
+	  values, set "flys.use.default.values" to "true".
+
 2011-12-19  Ingo Weinzierl <ingo@intevation.de>
 
 	flys/issue419 (Themen-Name "Q(null)" bei W bei ungl. A.)
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Mon Dec 19 15:47:34 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Mon Dec 19 16:11:13 2011 +0000
@@ -41,6 +41,12 @@
     /** The logger that is used in this class. */
     private static Logger logger = Logger.getLogger(DefaultState.class);
 
+
+    /** Determines, if the DESCRIBE document should contain default values or
+     * not. */
+    public static final boolean USE_DEFAULTS =
+        Boolean.getBoolean("flys.use.default.values");
+
     /** The three possible compute types. */
     public static enum ComputeType {
         FEED, ADVANCE, INIT
@@ -205,19 +211,21 @@
 
             Element select = createData(creator, artifact, data, context);
 
-            String defValue = (String) data.getValue();
-            String defDesc  = null;
+            if (USE_DEFAULTS) {
+                String defValue = (String) data.getValue();
+                String defDesc  = null;
 
-            if (defValue != null && defValue.length() > 0) {
-                defDesc = Resources.getMsg(
-                    context.getMeta(),
-                    defValue,
-                    defValue);
-            }
+                if (defValue != null && defValue.length() > 0) {
+                    defDesc = Resources.getMsg(
+                        context.getMeta(),
+                        defValue,
+                        defValue);
+                }
 
-            if (defValue != null && defDesc != null) {
-                creator.addAttr(select, "defaultValue", defValue, true);
-                creator.addAttr(select, "defaultLabel", defDesc, true);
+                if (defValue != null && defDesc != null) {
+                    creator.addAttr(select, "defaultValue", defValue, true);
+                    creator.addAttr(select, "defaultLabel", defDesc, true);
+                }
             }
 
             Element choices = ProtocolUtils.createArtNode(

http://dive4elements.wald.intevation.org