# HG changeset patch # User Ingo Weinzierl # Date 1305191194 0 # Node ID c41b300b02c351f0dc48631cd92a646aeed6aca6 # Parent 8c2b6cdf22ad563e37dce455dbc7751e6d1b0df6 Improved the ClientProtocolUtils: collections OUT document contains attributes now. artifacts/trunk@1907 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 8c2b6cdf22ad -r c41b300b02c3 ChangeLog --- a/ChangeLog Thu Apr 28 10:30:30 2011 +0000 +++ b/ChangeLog Thu May 12 09:06:34 2011 +0000 @@ -1,3 +1,10 @@ +2011-05-12 Ingo Weinzierl + + * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java: + The method that is used to create the request document for querying + charts will now take a document which might contain parameters to adjust + chart settings (e.g. chart height/width). + 2011-04-28 Ingo Weinzierl * artifact-database/src/main/java/de/intevation/artifactdatabase/transition/Transition.java: diff -r 8c2b6cdf22ad -r c41b300b02c3 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 Thu Apr 28 10:30:30 2011 +0000 +++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java Thu May 12 09:06:34 2011 +0000 @@ -351,6 +351,26 @@ * @return the request document. */ public static Document newOutCollectionDocument(String uuid, String type) { + return newOutCollectionDocument(uuid, type, null); + } + + + /** + * This function builds a document that is used as request document of the + * out() operation of Collections. The document attr might be used to + * adjust some settings specific to the output. + * + * @param uuid The identifier of the collection. + * @param type The name of the desired output type. + * @param attr A document that contains settings specific to the output. + * + * @return the request document. + */ + public static Document newOutCollectionDocument( + String uuid, + String type, + Document attr) + { Document doc = XMLUtils.newDocument(); XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator( @@ -358,13 +378,23 @@ ArtifactNamespaceContext.NAMESPACE_URI, ArtifactNamespaceContext.NAMESPACE_PREFIX); - Element action = cr.create("action"); + Element action = cr.create("action"); + Element attributes = cr.create("attributes"); cr.addAttr(action, "name", type, true); cr.addAttr(action, "type", type, true); doc.appendChild(action); + if (attr != null) { + Node root = attr.getFirstChild(); + + if (root != null) { + action.appendChild(attributes); + attributes.appendChild(doc.importNode(root, true)); + } + } + return doc; }