Mercurial > dive4elements > framework
changeset 341:e0efa2c28d19
Helper function to create a document to remove an artifact from an collection.
artifacts/trunk@2958 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 13 Oct 2011 12:19:43 +0000 |
parents | 560d2e6eaf9c |
children | 9a85e0ef6e02 |
files | ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java |
diffstat | 2 files changed, 48 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Oct 13 11:38:52 2011 +0000 +++ b/ChangeLog Thu Oct 13 12:19:43 2011 +0000 @@ -1,3 +1,9 @@ +2011-10-13 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java: + (newRemoveArtifactDocument): New, create a "remove artifact" document. + Cosmetics, docs. + 2011-10-13 Felix Wolfsteller <felix.wolfsteller@intevation.de> * artifact-database/src/main/resources/sql/org-h2-driver.properties,
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java Thu Oct 13 11:38:52 2011 +0000 +++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java Thu Oct 13 12:19:43 2011 +0000 @@ -25,36 +25,36 @@ */ public class ClientProtocolUtils { - /** The XPath to the current state in the DESCRIBE document.*/ + /** The XPath to the current state in the DESCRIBE document. */ public static final String XPATH_CURRENT_STATE = "/art:result/art:state"; - /** The XPath to the static UI part in the DESCRIBE document.*/ + /** The XPath to the static UI part in the DESCRIBE document. */ public static final String XPATH_STATIC = "/art:result/art:ui/art:static"; - /** The XPath to the dynamic UI part in the DESCRIBE document.*/ + /** The XPath to the dynamic UI part in the DESCRIBE document. */ public static final String XPATH_DYNAMIC = "/art:result/art:ui/art:dynamic"; - /** The XPath to the reachable states part in the DESCRIBE document.*/ + /** The XPath to the reachable states part in the DESCRIBE document. */ public static final String XPATH_STATES = "/art:result/art:reachable-states"; - /** The XPath to the output modes in the DESCRIBE document.*/ + /** 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.*/ + * DESCRIBE document. */ public static final String XPATH_DATA_SELECT = "art:select"; /** The XPath to the choices nodes relative to the select node in the - * DESCRIBE document.*/ + * DESCRIBE document. */ public static final String XPATH_DATA_ITEMS = "art:choices/art:item"; - /** The XPath to a label in the artifact's DESCRIBE document.*/ + /** The XPath to a label in the artifact's DESCRIBE document. */ public static final String XPATH_LABEL = "art:label/text()"; - /** The XPath to a value in the artifact's DESCRIBE document.*/ + /** The XPath to a value in the artifact's DESCRIBE document. */ public static final String XPATH_VALUE = "art:value/text()"; @@ -325,7 +325,7 @@ * collection in the artifact server. * * @param artId The identifier of the artifact that should be added. - * @param attr A document that contains attributes for the attribute's + * @param attr A document that contains attributes for the artifact's * life in the collection. * * @return the document to add an artifact into a collection. @@ -361,6 +361,38 @@ /** + * Create a new Document that is used to remove an artifact from a + * collection in the artifact server. + * + * @param artId The identifier of the artifact that should be added. + * + * @return the document to add an artifact into a collection. + */ + public static Document newRemoveArtifactDocument(String artId) { + 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 artifact = cr.create("artifact"); + + cr.addAttr(artifact, "uuid", artId); + cr.addAttr(type, "name", "removeartifact"); + + action.appendChild(type); + type.appendChild(artifact); + + doc.appendChild(action); + + return doc; + } + + + /** * This method creates a new Document that is used to trigger the DESCRIBE * operation of a collection in the artifact server. *