# HG changeset patch # User Ingo Weinzierl # Date 1326878623 0 # Node ID 203bd78def81a2c1eee054aba34334a13ab91bbd # Parent c489256a188b58d6edbb35f5b331fe3b0f896af8 Improved ClientProtocolUtils to extract min and max values for items with two new functions. artifacts/trunk@3701 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r c489256a188b -r 203bd78def81 ChangeLog --- 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 + + * 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 * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/FileTools.java: diff -r c489256a188b -r 203bd78def81 artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.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 :