changeset 239:ab196a861796

Enhanced the ClientProtocolUtils with a method that creates an XML document used for the Collection's out() operation. artifacts/trunk@1653 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 07 Apr 2011 11:25:00 +0000
parents 61b7041204a7
children c0bc172ec7b2
files ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 06 21:12:58 2011 +0000
+++ b/ChangeLog	Thu Apr 07 11:25:00 2011 +0000
@@ -1,3 +1,9 @@
+2011-04-07  Ingo Weinzierl <ingo@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java:
+	  Added a method that creates documents used as input document for the
+	  Collection's out() operation.
+
 2011-04-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	Fix for flys/issue8 (part 2)
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java	Wed Apr 06 21:12:58 2011 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java	Thu Apr 07 11:25:00 2011 +0000
@@ -294,6 +294,35 @@
     }
 
 
+
+    /**
+     * This function builds a document that is used as request document of the
+     * out() operation of Collections.
+     *
+     * @param uuid The identifier of the collection.
+     * @param type The name of the desired output type.
+     *
+     * @return the request document.
+     */
+    public static Document newOutCollectionDocument(String uuid, String type) {
+        Document doc = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator(
+            doc,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element action = cr.create("action");
+
+        cr.addAttr(action, "name", type, true);
+        cr.addAttr(action, "type", type, true);
+
+        doc.appendChild(action);
+
+        return doc;
+    }
+
+
     /**
      * Returns string value found by {@link XPATH_LABEL} relative to
      * <i>node</i>.

http://dive4elements.wald.intevation.org