Mercurial > dive4elements > framework
comparison artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java @ 258:c41b300b02c3
Improved the ClientProtocolUtils: collections OUT document contains attributes now.
artifacts/trunk@1907 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 12 May 2011 09:06:34 +0000 |
parents | efbad8c5c0e5 |
children | f3d970a832ff |
comparison
equal
deleted
inserted
replaced
257:8c2b6cdf22ad | 258:c41b300b02c3 |
---|---|
349 * @param type The name of the desired output type. | 349 * @param type The name of the desired output type. |
350 * | 350 * |
351 * @return the request document. | 351 * @return the request document. |
352 */ | 352 */ |
353 public static Document newOutCollectionDocument(String uuid, String type) { | 353 public static Document newOutCollectionDocument(String uuid, String type) { |
354 Document doc = XMLUtils.newDocument(); | 354 return newOutCollectionDocument(uuid, type, null); |
355 | 355 } |
356 XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator( | 356 |
357 doc, | 357 |
358 ArtifactNamespaceContext.NAMESPACE_URI, | 358 /** |
359 ArtifactNamespaceContext.NAMESPACE_PREFIX); | 359 * This function builds a document that is used as request document of the |
360 | 360 * out() operation of Collections. The document <i>attr</i> might be used to |
361 Element action = cr.create("action"); | 361 * adjust some settings specific to the output. |
362 * | |
363 * @param uuid The identifier of the collection. | |
364 * @param type The name of the desired output type. | |
365 * @param attr A document that contains settings specific to the output. | |
366 * | |
367 * @return the request document. | |
368 */ | |
369 public static Document newOutCollectionDocument( | |
370 String uuid, | |
371 String type, | |
372 Document attr) | |
373 { | |
374 Document doc = XMLUtils.newDocument(); | |
375 | |
376 XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator( | |
377 doc, | |
378 ArtifactNamespaceContext.NAMESPACE_URI, | |
379 ArtifactNamespaceContext.NAMESPACE_PREFIX); | |
380 | |
381 Element action = cr.create("action"); | |
382 Element attributes = cr.create("attributes"); | |
362 | 383 |
363 cr.addAttr(action, "name", type, true); | 384 cr.addAttr(action, "name", type, true); |
364 cr.addAttr(action, "type", type, true); | 385 cr.addAttr(action, "type", type, true); |
365 | 386 |
366 doc.appendChild(action); | 387 doc.appendChild(action); |
388 | |
389 if (attr != null) { | |
390 Node root = attr.getFirstChild(); | |
391 | |
392 if (root != null) { | |
393 action.appendChild(attributes); | |
394 attributes.appendChild(doc.importNode(root, true)); | |
395 } | |
396 } | |
367 | 397 |
368 return doc; | 398 return doc; |
369 } | 399 } |
370 | 400 |
371 | 401 |