changeset 370:203bd78def81

Improved ClientProtocolUtils to extract min and max values for items with two new functions. artifacts/trunk@3701 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 18 Jan 2012 09:23:43 +0000
parents c489256a188b
children 831d317547eb
files ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 16 10:03:42 2012 +0000
+++ b/ChangeLog	Wed Jan 18 09:23:43 2012 +0000
@@ -1,3 +1,8 @@
+2012-01-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java:
+	  Added methods to retrieve the min and max values of a data item.
+
 2012-01-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java:
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java	Mon Jan 16 10:03:42 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java	Wed Jan 18 09:23:43 2012 +0000
@@ -50,6 +50,12 @@
      * DESCRIBE document. */
     public static final String XPATH_DATA_ITEMS = "art:choices/art:item";
 
+    /** The XPath that points to the min value of a range.*/
+    public static final String XPATH_MIN_NODE = "art:min/@art:value";
+
+    /** The XPath that points to the max value of a range.*/
+    public static final String XPATH_MAX_NODE = "art:max/@art:value";
+
     /** The XPath to a label in the artifact's DESCRIBE document. */
     public static final String XPATH_LABEL = "art:label/text()";
 
@@ -808,5 +814,23 @@
             XPathConstants.NODESET,
             ArtifactNamespaceContext.INSTANCE);
     }
+
+
+    public static String getMinNode(Node parent) {
+        return (String) XMLUtils.xpath(
+            parent,
+            XPATH_MIN_NODE,
+            XPathConstants.STRING,
+            ArtifactNamespaceContext.INSTANCE);
+    }
+
+
+    public static String getMaxNode(Node parent) {
+        return (String) XMLUtils.xpath(
+            parent,
+            XPATH_MAX_NODE,
+            XPathConstants.STRING,
+            ArtifactNamespaceContext.INSTANCE);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org