annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 127:21d791e21aca

Introduced a state to select the calculation mode. flys-artifacts/trunk@1467 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 14 Mar 2011 15:47:10 +0000
parents b7a9557957d1
children 206312c2aa76
rev   line source
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
109
9891d133f08d Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
3 import java.util.List;
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
4 import java.util.Set;
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
5
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
6 import javax.xml.xpath.XPathConstants;
109
9891d133f08d Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
7
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.w3c.dom.Document;
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
9 import org.w3c.dom.Element;
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
10 import org.w3c.dom.Node;
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import org.apache.log4j.Logger;
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
14 import de.intevation.artifacts.ArtifactNamespaceContext;
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.CallContext;
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
17 import de.intevation.artifactdatabase.ProtocolUtils;
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
18 import de.intevation.artifactdatabase.data.StateData;
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
19 import de.intevation.artifactdatabase.state.State;
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
20 import de.intevation.artifactdatabase.state.StateEngine;
112
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
21 import de.intevation.artifactdatabase.transition.TransitionEngine;
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
22
109
9891d133f08d Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
23 import de.intevation.artifacts.common.utils.XMLUtils;
9891d133f08d Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
24
9891d133f08d Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 105
diff changeset
25 import de.intevation.flys.artifacts.context.FLYSContext;
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 /**
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 * The default WINFO artifact.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 *
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 */
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 115
diff changeset
33 public class WINFOArtifact extends FLYSArtifact {
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 /** The logger for this class */
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 private static Logger logger = Logger.getLogger(WINFOArtifact.class);
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
39 /** The name of the artifact.*/
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
40 public static final String ARTIFACT_NAME = "winfo";
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
41
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
42 /** XPath */
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
43 public static final String XPATH_STATIC_UI ="/art:result/art:ui/art:static";
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
44
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
45
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 /**
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 * The default constructor.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 */
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 public WINFOArtifact() {
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 }
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 /**
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 * This method returns a description of this artifact.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 *
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 * @param data Some data.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 * @param CallContext The CallContext.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 *
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 * @return the description of this artifact.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 */
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 public Document describe(Document data, CallContext context) {
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 115
diff changeset
62 logger.debug("Describe: the current state is: " + getCurrentStateId());
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
112
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
64 FLYSContext flysContext = null;
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
65 if (context instanceof FLYSContext) {
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
66 flysContext = (FLYSContext) context;
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
67 }
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
68 else {
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
69 flysContext = (FLYSContext) context.globalContext();
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
70 }
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
71
112
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
72 StateEngine stateEngine = (StateEngine) flysContext.get(
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
73 FLYSContext.STATE_ENGINE_KEY);
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
74
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
75 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get(
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
76 FLYSContext.TRANSITION_ENGINE_KEY);
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
77
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
78 List<State> reachable = transitionEngine.getReachableStates(
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 115
diff changeset
79 getCurrentState(context), stateEngine);
112
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
80
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
81 Document description = XMLUtils.newDocument();
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
82 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
83 description,
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
84 ArtifactNamespaceContext.NAMESPACE_URI,
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
85 ArtifactNamespaceContext.NAMESPACE_PREFIX);
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
86
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
87 Element root = ProtocolUtils.createRootNode(creator);
115
b51e92fef704 The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 112
diff changeset
88 description.appendChild(root);
b51e92fef704 The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 112
diff changeset
89
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 115
diff changeset
90 State current = getCurrentState(context);
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 115
diff changeset
91
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
92 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 115
diff changeset
93 ProtocolUtils.appendState(creator, root, current);
112
0fab16cb4d44 Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 110
diff changeset
94 ProtocolUtils.appendReachableStates(creator, root, reachable);
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
95
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
96 Element ui = ProtocolUtils.createArtNode(
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
97 creator, "ui", null, null);
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
98
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
99 Element staticUI = ProtocolUtils.createArtNode(
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
100 creator, "static", null, null);
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
101
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
102 Element dynamic = current.describe(
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
103 description,
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
104 root,
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
105 context,
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
106 identifier());
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
107
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
108 ui.appendChild(dynamic);
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
109 root.appendChild(ui);
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
110
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
111 appendStaticUI(creator, ui);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
112
110
ff3335057f11 Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 109
diff changeset
113 return description;
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 }
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
115
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
116
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
117 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
118 * Returns the name of the concrete artifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
119 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
120 * @return the name of the concrete artifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
121 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
122 public String getName() {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
123 return ARTIFACT_NAME;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
124 }
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
125
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
126
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
127 /**
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
128 * This method appends the static data - that has already been inserted by
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
129 * the user - to the static node of the DESCRIBE document.
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
130 *
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
131 * @param cr The ElementCreator that is used to create new elements.
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
132 * @param ui The static ui node.
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
133 */
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
134 protected void appendStaticUI(XMLUtils.ElementCreator cr, Node ui) {
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
135 Set<String> keys = data.keySet();
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
136
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
137 // XXX This just handles single selection string values. If we need more
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
138 // complex (maybe multiselect) objects we should introduce a data
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
139 // structure for this - this structure should have a method that returns
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
140 // a <data> node that contains its items.
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
141 for (String k: keys) {
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
142 logger.debug("The key = " + k);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
143 StateData d = getData(k);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
144
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
145 Element dataElement = cr.create("data");
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
146 cr.addAttr(dataElement, "name", (String) d.getName(), true);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
147 cr.addAttr(dataElement, "type", d.getType(), true);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
148
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
149 Element itemElement = cr.create("item");
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
150 cr.addAttr(itemElement, "value", (String) d.getValue(), true);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
151 // TODO Description (human readable) is missing
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
152
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
153 dataElement.appendChild(itemElement);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
154 ui.appendChild(dataElement);
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
155 }
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
156 }
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 }
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org