Mercurial > dive4elements > framework
comparison artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java @ 204:5c93fb142970
Implemented a new method in the ClientProtocolUtils that creates the document for a ADVANCE operation.
artifacts/trunk@1450 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 10 Mar 2011 10:32:51 +0000 |
parents | b5e1949bc255 |
children | 8ea4d0824d8f |
comparison
equal
deleted
inserted
replaced
203:b5e1949bc255 | 204:5c93fb142970 |
---|---|
141 return doc; | 141 return doc; |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 /** | 145 /** |
146 * This method creates a new ADVANCE document. | |
147 * | |
148 * @param theUuid The identifier of the artifact. | |
149 * @param theHash The hash of the artifact. | |
150 * @param theTarget The target state identifier. | |
151 * | |
152 * @return the ADVANCE document. | |
153 */ | |
154 public static Document newAdvanceDocument( | |
155 String theUuid, | |
156 String theHash, | |
157 String theTarget) | |
158 { | |
159 Document doc = XMLUtils.newDocument(); | |
160 | |
161 XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator( | |
162 doc, | |
163 ArtifactNamespaceContext.NAMESPACE_URI, | |
164 ArtifactNamespaceContext.NAMESPACE_PREFIX); | |
165 | |
166 Element action = cr.create("action"); | |
167 Element type = cr.create("type"); | |
168 Element uuid = cr.create("uuid"); | |
169 Element hash = cr.create("hash"); | |
170 Element target = cr.create("target"); | |
171 | |
172 // XXX It is not nice that the type has no attribute namespace, but to | |
173 // be backward compatible, we don't change this now. | |
174 cr.addAttr(type, "name", "advance", false); | |
175 cr.addAttr(uuid, "value", theUuid, true); | |
176 cr.addAttr(hash, "value", theHash, true); | |
177 cr.addAttr(target, "name", theTarget, true); | |
178 | |
179 action.appendChild(type); | |
180 action.appendChild(uuid); | |
181 action.appendChild(hash); | |
182 action.appendChild(target); | |
183 | |
184 doc.appendChild(action); | |
185 | |
186 return doc; | |
187 } | |
188 | |
189 | |
190 /** | |
146 * This method creates a new document that is used to create new artifact | 191 * This method creates a new document that is used to create new artifact |
147 * collections in the artifact server. | 192 * collections in the artifact server. |
148 * | 193 * |
149 * @param name <b>Optional</b> name of the collection. | 194 * @param name <b>Optional</b> name of the collection. |
150 * | 195 * |