annotate src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java @ 27:73b211b559e2

Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls. http-client/trunk@2534 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 23 Aug 2011 13:49:16 +0000
parents a1db30b33f43
children 68163c3ca407
rev   line source
0
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 /*
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 *
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 * Read the file LGPL.txt coming with the software for details
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 */
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 package de.intevation.artifacts.httpclient.utils;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import java.util.Iterator;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.util.Map;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import java.util.Set;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import javax.xml.xpath.XPathConstants;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.apache.log4j.Logger;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import org.w3c.dom.Document;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.w3c.dom.Element;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.NodeList;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.artifacts.httpclient.objects.Artifact;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.artifacts.httpclient.objects.ArtifactFactory;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 public class ArtifactProtocolUtils {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 private static final Logger logger =
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 Logger.getLogger(ArtifactProtocolUtils.class);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public static ArtifactFactory[] extractArtifactFactories(Document doc) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 NodeList elements = (NodeList) XMLUtils.getXPath(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 doc,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 "/art:result/art:factories/art:factory",
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 XPathConstants.NODESET,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 ArtifactNamespaceContext.INSTANCE);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 if (elements == null || elements.getLength() == 0) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 return null;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 ArtifactFactory[] facs = new ArtifactFactory[elements.getLength()];
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
27
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
44 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
0
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
27
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
46 for (int idx = 0, N = elements.getLength(); idx < N; idx++) {
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
47 Element factory = (Element)elements.item(idx);
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
48 String desc = factory.getAttributeNS(uri, "description");
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
49 String name = factory.getAttributeNS(uri, "name");
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
50
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
51 if (name.length() != 0) {
0
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 facs[idx] = new ArtifactFactory(name, desc);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 return facs;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 public static Document createCreateDocument(String fis) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 Document document = XMLUtils.newDocument();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 document,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 ArtifactNamespaceContext.NAMESPACE_URI,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 ArtifactNamespaceContext.NAMESPACE_PREFIX
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 Element action = creator.create("action");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 Element type = creator.create("type");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 type.setAttribute("name", "create");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 Element factory = creator.create("factory");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 factory.setAttribute("name", fis);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 action.appendChild(type);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 action.appendChild(factory);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 document.appendChild(action);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 return document;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 /**
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 * Returns a new artifact defined by uuid and hash values of the document
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 * returned by the artifact server after creating a new artifact.
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 *
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 * @param document Contains information about the server-side created
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 * artifact.
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 * @return a new artifact object.
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 */
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 public static Artifact extractArtifact(Document document) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 String uuid = XMLUtils.getStringXPath(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 document,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 "/art:result/art:uuid/@value");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 String hash = XMLUtils.getStringXPath(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 document,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 "/art:result/art:hash/@value");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 logger.info("NEW Artifact: " + uuid + " / " + hash);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 return new Artifact(uuid, hash);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 private static Element createArtifactAction(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 XMLUtils.ElementCreator creator,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 Artifact artifact,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 String artifactAction)
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 Element action = creator.create("action");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 Element type = creator.create("type");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 type.setAttribute("name", artifactAction);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 Element uuid = creator.create("uuid");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 uuid.setAttribute("value", artifact.getUuid());
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 Element hash = creator.create("hash");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 hash.setAttribute("value", artifact.getHash());
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 action.appendChild(type);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 action.appendChild(uuid);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 action.appendChild(hash);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 return action;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 public static Document createFeedDocument(Artifact artifact, Map attr) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 Document document = XMLUtils.newDocument();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 document,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 ArtifactNamespaceContext.NAMESPACE_URI,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 ArtifactNamespaceContext.NAMESPACE_PREFIX
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 Element action = createArtifactAction(creator, artifact, "feed");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 Element data = creator.create("data");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 Set keys = attr.keySet();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 Iterator iter = keys.iterator();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 while (iter.hasNext()) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 String key = (String) iter.next();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 Object values = attr.get(key);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 if (values instanceof Object[]) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 appendInputNodes(creator, data, key, (Object[]) values);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 else {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 appendInputNodes(creator, data, key, values);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 action.appendChild(data);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 document.appendChild(action);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 return document;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 private static void appendInputNodes(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 XMLUtils.ElementCreator creator,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 Element root,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 String key,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 Object value)
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 Element input = creator.create("input");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 input.setAttribute("name", key);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 input.setAttribute("value", (String) value);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 root.appendChild(input);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 private static void appendInputNodes(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 XMLUtils.ElementCreator creator,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 Element root,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 String key,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 Object[] values)
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 for (Object value: values) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 Element input = creator.create("input");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 input.setAttribute("name", key);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 input.setAttribute("value", (String) value);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 root.appendChild(input);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 public static Document createDescribeDocument(Artifact art, boolean ui) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 Document document = XMLUtils.newDocument();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 document,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 ArtifactNamespaceContext.NAMESPACE_URI,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 ArtifactNamespaceContext.NAMESPACE_PREFIX
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 Element action = createArtifactAction(creator, art, "describe");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 Element includeUi = creator.create("include-ui");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 includeUi.setTextContent(String.valueOf(ui));
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 action.appendChild(includeUi);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207 document.appendChild(action);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 return document;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 public static Document createAdvanceDocument(Artifact art, String target) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 Document document = XMLUtils.newDocument();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 document,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 ArtifactNamespaceContext.NAMESPACE_URI,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 ArtifactNamespaceContext.NAMESPACE_PREFIX
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 Element action = createArtifactAction(creator, art, "advance");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 Element targetEle = creator.create("target");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 targetEle.setAttribute("name", target);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226 action.appendChild(targetEle);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227 document.appendChild(action);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229 return document;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 public static Document createChartDocument(Artifact artifact, Map opts) {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234 Document document = XMLUtils.newDocument();
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 document,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238 ArtifactNamespaceContext.NAMESPACE_URI,
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 ArtifactNamespaceContext.NAMESPACE_PREFIX
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242 Element action = createArtifactAction(creator, artifact, "out");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 Element out = creator.create("out");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 out.setAttribute("name", "chart");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246 Element export = creator.create("export");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 export.setAttribute("name", "img");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 Element mimetype = creator.create("mime-type");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 export.setAttribute("value", (String) opts.get("mime-type"));
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 Element params = creator.create("params");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254 Element width = creator.create("input");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 width.setAttribute("name", "width");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 width.setAttribute("value", (String) opts.get("width"));
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 Element height = creator.create("input");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259 height.setAttribute("name", "height");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 height.setAttribute("value", (String) opts.get("height"));
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 Element points = creator.create("input");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
263 points.setAttribute("name", "points");
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264 points.setAttribute("value", (String) opts.get("points"));
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
266 params.appendChild(width);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 params.appendChild(height);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 params.appendChild(points);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270 out.appendChild(export);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271 out.appendChild(mimetype);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 out.appendChild(params);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
274 action.appendChild(out);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275 document.appendChild(action);
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277 return document;
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' of the console-client to an own module 'http-client' and removed the console-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org