# HG changeset patch # User Ingo Weinzierl # Date 1302594702 0 # Node ID c0bc172ec7b2148df5eff450d9b5088d08810495 # Parent ab196a861796bcef866b59c1b711172434e24579 Improved the ClientProtocolUtils with a method that returns a document that is used to trigger the DESCRIBE operation of artifacts. artifacts/trunk@1665 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ab196a861796 -r c0bc172ec7b2 ChangeLog --- a/ChangeLog Thu Apr 07 11:25:00 2011 +0000 +++ b/ChangeLog Tue Apr 12 07:51:42 2011 +0000 @@ -1,3 +1,9 @@ +2011-04-12 Ingo Weinzierl + + * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java: + Added a method that returns a document that is used to trigger the + artifact's DESCRIBE operation. + 2011-04-07 Ingo Weinzierl * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java: diff -r ab196a861796 -r c0bc172ec7b2 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 07 11:25:00 2011 +0000 +++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java Tue Apr 12 07:51:42 2011 +0000 @@ -148,6 +148,52 @@ /** + * This method creates a new DESCRIBE document. + * + * @param theUuid The identifier of the artifact. + * @param theHash The hash of the artifact. + * @param ui If true, the UI part is included. + * + * @return the DESCRIBE document. + */ + public static Document newDescribeDocument( + String theUuid, + String theHash, + boolean incUI) + { + Document doc = XMLUtils.newDocument(); + + XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator( + doc, + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX); + + Element action = cr.create("action"); + Element type = cr.create("type"); + Element uuid = cr.create("uuid"); + Element hash = cr.create("hash"); + Element ui = cr.create("include-ui"); + + // XXX It is not nice that the type has no attribute namespace, but to + // be backward compatible, we don't change this now. + cr.addAttr(type, "name", "describe", false); + cr.addAttr(uuid, "value", theUuid, true); + cr.addAttr(hash, "value", theHash, true); + + ui.setTextContent(incUI ? "true" : "false"); + + action.appendChild(type); + action.appendChild(uuid); + action.appendChild(hash); + action.appendChild(ui); + + doc.appendChild(action); + + return doc; + } + + + /** * This method creates a new ADVANCE document. * * @param theUuid The identifier of the artifact.