comparison artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java @ 325:4022ea69d1cb

Write filters to create document if they are given. artifacts/trunk@2567 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 24 Aug 2011 14:35:27 +0000
parents ee6e1b2f137a
children e0efa2c28d19
comparison
equal deleted inserted replaced
324:ee6e1b2f137a 325:4022ea69d1cb
82 */ 82 */
83 public static Document newCreateDocument(String factory, String uuid) { 83 public static Document newCreateDocument(String factory, String uuid) {
84 return newCreateDocument(factory, uuid, null); 84 return newCreateDocument(factory, uuid, null);
85 } 85 }
86 86
87
88 /**
89 * This method creates a new CREATE document.
90 *
91 * @return the CREATE document.
92 */
93 public static Document newCreateDocument( 87 public static Document newCreateDocument(
94 String factory, 88 String factory,
95 String uuid, 89 String uuid,
96 String ids) 90 String ids
97 { 91 ) {
92 return newCreateDocument(factory, uuid, ids, null);
93 }
94
95 /**
96 * This method creates a new CREATE document.
97 *
98 * @return the CREATE document.
99 */
100 public static Document newCreateDocument(
101 String factory,
102 String uuid,
103 String ids,
104 CreationFilter filter
105 ) {
98 Document doc = XMLUtils.newDocument(); 106 Document doc = XMLUtils.newDocument();
99 107
100 XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator( 108 XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator(
101 doc, 109 doc,
102 ArtifactNamespaceContext.NAMESPACE_URI, 110 ArtifactNamespaceContext.NAMESPACE_URI,
120 128
121 if (ids != null) { 129 if (ids != null) {
122 Element id = cr.create("ids"); 130 Element id = cr.create("ids");
123 id.setAttribute("value", ids); 131 id.setAttribute("value", ids);
124 action.appendChild(id); 132 action.appendChild(id);
133 }
134
135 if (filter != null) {
136 action.appendChild(filter.toXML(cr));
125 } 137 }
126 138
127 doc.appendChild(action); 139 doc.appendChild(action);
128 140
129 return doc; 141 return doc;

http://dive4elements.wald.intevation.org