# HG changeset patch # User Felix Wolfsteller # Date 1318508383 0 # Node ID e0efa2c28d19223da5c0173211531e299c781947 # Parent 560d2e6eaf9c0eb26acca354071a261f71a07e53 Helper function to create a document to remove an artifact from an collection. artifacts/trunk@2958 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 560d2e6eaf9c -r e0efa2c28d19 ChangeLog --- 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 + + * 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 * artifact-database/src/main/resources/sql/org-h2-driver.properties, diff -r 560d2e6eaf9c -r e0efa2c28d19 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 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. *