diff artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java @ 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 91333a41b234
children c0bc172ec7b2
line wrap: on
line diff
--- 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