Mercurial > dive4elements > framework
changeset 211:435631e07da2
Enhanced the ProtocolUtils and ClientProtocolUtils to append and retrieve output modes.
artifacts/trunk@1543 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 23 Mar 2011 10:47:48 +0000 |
parents | b75fca1ac215 |
children | d7042094f7b7 |
files | ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java |
diffstat | 3 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Mar 23 10:45:36 2011 +0000 +++ b/ChangeLog Wed Mar 23 10:47:48 2011 +0000 @@ -1,3 +1,13 @@ +2011-03-23 Ingo Weinzierl <ingo@intevation.de> + + * artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java: + Added a method to append an <outputmodes> section to a document that + describes the output modes of a state. + + * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java: + Added a method to retrieve a list of output modes from DESCRIBE + document. + 2011-03-23 Ingo Weinzierl <ingo@intevation.de> * artifact-database/src/main/java/de/intevation/artifactdatabase/state/State.java:
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java Wed Mar 23 10:45:36 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ProtocolUtils.java Wed Mar 23 10:47:48 2011 +0000 @@ -13,6 +13,7 @@ import de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.artifactdatabase.state.Output; import de.intevation.artifactdatabase.state.State; @@ -144,5 +145,20 @@ root.appendChild(reachable); } + + + public static void appendOutputModes( + XMLUtils.ElementCreator creator, + Element out, + List<Output> outputs) + { + for (Output o: outputs) { + out.appendChild(createArtNode( + creator, + "output", + new String[] {"name", "description", "mime-type"}, + new String[] {o.getName(),o.getDescription(),o.getMimeType()})); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java Wed Mar 23 10:45:36 2011 +0000 +++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java Wed Mar 23 10:47:48 2011 +0000 @@ -38,6 +38,11 @@ public static final String XPATH_STATES = "/art:result/art:reachable-states"; + /** The XPath to the output modes in the DESCRIBE document.*/ + public static final String XPATH_OUTPUT_MODES = + "/art:result/art:outputmodes/art:output"; + + /** The XPath to the select node relative to the dynamic UI node in the * DESCRIBE document.*/ public static final String XPATH_DATA_SELECT = "art:select"; @@ -326,6 +331,23 @@ /** + * This method returns the output mode nodes of the DESCRIBE document. + * + * @param description The document returned by the artifact server's + * DESCRIBE operation. + * + * @return the node that contains the output modes. + */ + public static NodeList getOutputModes(Document description) { + return (NodeList) XMLUtils.xpath( + description, + XPATH_OUTPUT_MODES, + XPathConstants.NODESET, + ArtifactNamespaceContext.INSTANCE); + } + + + /** * Returns the node found by {@link XPATH_DATA_SELECT}. * * @param dynamicNode The dynamic UI node of the DESCRIBE document.