# HG changeset patch # User Ingo Weinzierl # Date 1302175500 0 # Node ID ab196a861796bcef866b59c1b711172434e24579 # Parent 61b7041204a7e3506b74a173216a3cbfd9b6931d 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 diff -r 61b7041204a7 -r ab196a861796 ChangeLog --- 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 + + * 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 Fix for flys/issue8 (part 2) diff -r 61b7041204a7 -r ab196a861796 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 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 * node.