comparison artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java @ 172:8ce06db80857

Added a new method to the ProtocolUtils that creates the necessary CREATE document for creating new artifact collections. artifacts/trunk@1397 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 04 Mar 2011 11:47:27 +0000
parents 19b86e27d0c3
children b5e1949bc255
comparison
equal deleted inserted replaced
171:401dd251fbf4 172:8ce06db80857
88 return doc; 88 return doc;
89 } 89 }
90 90
91 91
92 /** 92 /**
93 * This method creates a new document that is used to create new artifact
94 * collections in the artifact server.
95 *
96 * @param name <b>Optional</b> name of the collection.
97 *
98 * @return the document to create new collections.
99 */
100 public static Document newCreateCollectionDocument(String name) {
101 Document doc = XMLUtils.newDocument();
102
103 XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator(
104 doc,
105 ArtifactNamespaceContext.NAMESPACE_URI,
106 ArtifactNamespaceContext.NAMESPACE_PREFIX);
107
108 Element action = cr.create("action");
109 Element type = cr.create("type");
110 Element collection = cr.create("artifact-collection");
111
112 cr.addAttr(type, "name", "create");
113 cr.addAttr(collection, "name", name != null ? name : "");
114
115 action.appendChild(type);
116 action.appendChild(collection);
117
118 doc.appendChild(action);
119
120 return doc;
121 }
122
123
124 /**
93 * Returns string value found by {@link XPATH_LABEL} relative to 125 * Returns string value found by {@link XPATH_LABEL} relative to
94 * <i>node</i>. 126 * <i>node</i>.
95 * 127 *
96 * @param node A node. 128 * @param node A node.
97 * 129 *

http://dive4elements.wald.intevation.org