comparison artifacts-common/src/main/java/de/intevation/artifacts/common/utils/ClientProtocolUtils.java @ 240:c0bc172ec7b2

Improved the ClientProtocolUtils with a method that returns a document that is used to trigger the DESCRIBE operation of artifacts. artifacts/trunk@1665 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 12 Apr 2011 07:51:42 +0000
parents ab196a861796
children efbad8c5c0e5
comparison
equal deleted inserted replaced
239:ab196a861796 240:c0bc172ec7b2
146 return doc; 146 return doc;
147 } 147 }
148 148
149 149
150 /** 150 /**
151 * This method creates a new DESCRIBE document.
152 *
153 * @param theUuid The identifier of the artifact.
154 * @param theHash The hash of the artifact.
155 * @param ui If true, the UI part is included.
156 *
157 * @return the DESCRIBE document.
158 */
159 public static Document newDescribeDocument(
160 String theUuid,
161 String theHash,
162 boolean incUI)
163 {
164 Document doc = XMLUtils.newDocument();
165
166 XMLUtils.ElementCreator cr = new XMLUtils.ElementCreator(
167 doc,
168 ArtifactNamespaceContext.NAMESPACE_URI,
169 ArtifactNamespaceContext.NAMESPACE_PREFIX);
170
171 Element action = cr.create("action");
172 Element type = cr.create("type");
173 Element uuid = cr.create("uuid");
174 Element hash = cr.create("hash");
175 Element ui = cr.create("include-ui");
176
177 // XXX It is not nice that the type has no attribute namespace, but to
178 // be backward compatible, we don't change this now.
179 cr.addAttr(type, "name", "describe", false);
180 cr.addAttr(uuid, "value", theUuid, true);
181 cr.addAttr(hash, "value", theHash, true);
182
183 ui.setTextContent(incUI ? "true" : "false");
184
185 action.appendChild(type);
186 action.appendChild(uuid);
187 action.appendChild(hash);
188 action.appendChild(ui);
189
190 doc.appendChild(action);
191
192 return doc;
193 }
194
195
196 /**
151 * This method creates a new ADVANCE document. 197 * This method creates a new ADVANCE document.
152 * 198 *
153 * @param theUuid The identifier of the artifact. 199 * @param theUuid The identifier of the artifact.
154 * @param theHash The hash of the artifact. 200 * @param theHash The hash of the artifact.
155 * @param theTarget The target state identifier. 201 * @param theTarget The target state identifier.

http://dive4elements.wald.intevation.org