Mercurial > dive4elements > framework
changeset 258:c41b300b02c3
Improved the ClientProtocolUtils: collections OUT document contains attributes now.
artifacts/trunk@1907 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 12 May 2011 09:06:34 +0000 |
parents | 8c2b6cdf22ad |
children | 8c4c37ee0d57 |
files | ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java |
diffstat | 2 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ingo@intevation.de> + + * 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 <ingo@intevation.de> * artifact-database/src/main/java/de/intevation/artifactdatabase/transition/Transition.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 <i>attr</i> 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; }