annotate src/main/java/org/dive4elements/artifacts/httpclient/utils/ArtifactProtocolUtils.java @ 125:e602a29f1dcc 3.2.x

Upgrade to Log4j 2
author Tom Gottfried <tom@intevation.de>
date Mon, 28 Feb 2022 17:49:46 +0100
parents 133281653904
children
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 */
72
133281653904 Renamed internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 71
diff changeset
8 package org.dive4elements.artifacts.httpclient.utils;
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
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.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
11
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
13
125
e602a29f1dcc Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 72
diff changeset
14 import org.apache.logging.log4j.Logger;
e602a29f1dcc Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 72
diff changeset
15 import org.apache.logging.log4j.LogManager;
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
16
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
18 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
19 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
20
72
133281653904 Renamed internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 71
diff changeset
21 import org.dive4elements.artifacts.httpclient.objects.Artifact;
133281653904 Renamed internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 71
diff changeset
22 import org.dive4elements.artifacts.httpclient.objects.ArtifactFactory;
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
23
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
25
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 private static final Logger logger =
125
e602a29f1dcc Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 72
diff changeset
27 LogManager.getLogger(ArtifactProtocolUtils.class);
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
28
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
31 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
32 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
33 "/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
34 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
35 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
36
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
38 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
39 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
42
27
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
43 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
44
28
68163c3ca407 Directly iterate over the entry set of the map.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 27
diff changeset
45 for (int idx = 0; idx < facs.length; idx++) {
27
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
46 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
47 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
48 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
49
73b211b559e2 Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 0
diff changeset
50 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
51 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
52 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
56 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
60 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
61
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
63 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
64 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
65 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
66 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
69
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
71 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
72
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
74 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
75
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
77 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
78 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
79
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
81 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 * 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
86 * 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
87 *
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 * @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
89 * 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
90 * @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
91 */
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
93 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
94 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
95 "/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
96
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
98 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
99 "/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
100
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
102 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
103 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
107 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
108 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
109 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
110 {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
112
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
114 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
115
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
117 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
118
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
120 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
121
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
123 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
124 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
125
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
127 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
131 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
132
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
134 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
135 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
136 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
137 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
140 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
141
28
68163c3ca407 Directly iterate over the entry set of the map.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 27
diff changeset
142 for (Map.Entry<String, Object> entry:
68163c3ca407 Directly iterate over the entry set of the map.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 27
diff changeset
143 ((Map<String, Object>)attr).entrySet()) {
68163c3ca407 Directly iterate over the entry set of the map.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 27
diff changeset
144
68163c3ca407 Directly iterate over the entry set of the map.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 27
diff changeset
145 String key = entry.getKey();
68163c3ca407 Directly iterate over the entry set of the map.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 27
diff changeset
146 Object values = entry.getValue();
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
147
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
149 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
150 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
152 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
153 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
157 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
158
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
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
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
164 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
165 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
166 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
167 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
168 {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
170 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
171 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
172 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
173 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
177 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
178 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
179 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
180 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
181 {
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
183 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
184 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
185 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
186 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
187 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
192 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
193
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
195 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
196 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
197 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
198 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
201 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
202 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
203
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
205 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
206
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
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
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
212 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
213
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
215 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
216 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
217 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
218 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
221 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
222 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
223
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
225 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
226
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
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
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
232 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
233
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
235 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
236 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
237 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
238 );
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
241 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
242 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
243
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
245 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
246
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
248 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
249
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
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 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
253 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
254 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
255
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
257 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
258 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
259
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
261 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
262 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
263
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
265 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
266 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
267
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
269 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
270 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
271
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
273 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
274
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 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
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 }
a1db30b33f43 Moved the experimental branch 'work-on-gwt' 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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org