annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 144:dde6904ba160

The DESCRIBE of the WINFO artifact contains the available output modes now. flys-artifacts/trunk@1544 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 23 Mar 2011 10:52:01 +0000
parents f3dfa188d8b2
children c97f9bc9b642
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;
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
4 import java.util.Vector;
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
5
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 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
7 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
8 import org.w3c.dom.Node;
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.apache.log4j.Logger;
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
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
12 import de.intevation.artifacts.ArtifactNamespaceContext;
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import de.intevation.artifacts.CallContext;
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
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
15 import de.intevation.artifactdatabase.ProtocolUtils;
144
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
16 import de.intevation.artifactdatabase.state.Output;
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.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
18 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
19 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
20
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
21 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
22
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
23 import de.intevation.flys.artifacts.states.DefaultState;
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
24 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
25
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 * The default WINFO artifact.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 *
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 * @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
31 */
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
32 public class WINFOArtifact extends FLYSArtifact {
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 /** The logger for this class */
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 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
36
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
38 /** The name of the artifact.*/
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
39 public static final String ARTIFACT_NAME = "winfo";
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
40
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
41 /** XPath */
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
42 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
43
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
44
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 /**
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 * The default constructor.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 */
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 public WINFOArtifact() {
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 }
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 * 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
54 *
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 * @param data Some data.
128
206312c2aa76 I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
56 * @param context The CallContext.
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 *
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 * @return the description of this artifact.
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 */
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 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
61 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
62
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
63 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
64 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
65 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
66 }
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 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
68 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
69 }
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
70
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
71 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
72 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
73
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 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
75 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
76
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 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
78 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
79
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 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
81 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
82 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
83 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
84 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
85
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 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
87 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
88
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
89 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
90
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
91 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
92 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
93 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
94
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
95 Element ui = ProtocolUtils.createArtNode(
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
96 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
97
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
98 Element staticUI = ProtocolUtils.createArtNode(
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
99 creator, "static", null, null);
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
100
144
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
101 Element outs = ProtocolUtils.createArtNode(
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
102 creator, "outputmodes", null, null);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
103 appendOutputModes(description, outs, context, identifier());
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
104
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
105 appendStaticUI(description, staticUI, context, identifier());
128
206312c2aa76 I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
106
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
107 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
108 description,
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
109 root,
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
110 context,
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
111 identifier());
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
112
144
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
113 if (dynamic != null) {
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
114 ui.appendChild(dynamic);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
115 }
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
116
128
206312c2aa76 I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
117 ui.appendChild(staticUI);
144
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
118
127
21d791e21aca Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 124
diff changeset
119 root.appendChild(ui);
144
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
120 root.appendChild(outs);
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
121
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
122 return description;
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 }
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
124
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
125
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
126 /**
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
127 * Returns the name of the concrete artifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
128 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
129 * @return the name of the concrete artifact.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
130 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
131 public String getName() {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
132 return ARTIFACT_NAME;
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
133 }
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
134
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
135
144
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
136 protected void appendOutputModes(
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
137 Document doc,
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
138 Element outs,
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
139 CallContext context,
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
140 String uuid)
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
141 {
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
142 Vector<String> stateIds = getPreviousStateIds();
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
143
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
144 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
145 doc,
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
146 ArtifactNamespaceContext.NAMESPACE_URI,
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
147 ArtifactNamespaceContext.NAMESPACE_PREFIX);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
148
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
149 FLYSContext flysContext = getFlysContext(context);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
150 StateEngine engine = (StateEngine) flysContext.get(
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
151 FLYSContext.STATE_ENGINE_KEY);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
152
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
153 for (String stateId: stateIds) {
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
154 logger.debug("Append output modes for state: " + stateId);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
155 State state = engine.getState(stateId);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
156
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
157 List<Output> list = state.getOutputs();
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
158 if (list == null || list.size() == 0) {
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
159 continue;
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
160 }
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
161
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
162 ProtocolUtils.appendOutputModes(creator, outs, list);
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
163 }
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
164
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
165 // TODO If the current state is already filled with data, the output is
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
166 // available as well! So we need some code to append the outputs of the
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
167 // current already filled state.
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
168 }
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
169
dde6904ba160 The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 134
diff changeset
170
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
171 /**
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
172 * 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
173 * 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
174 *
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
175 * @param doc The document.
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
176 * @param ui The root node.
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
177 * @param context The CallContext.
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
178 * @param uuid The identifier of the artifact.
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
179 */
128
206312c2aa76 I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
180 protected void appendStaticUI(
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
181 Document doc,
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
182 Node ui,
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
183 CallContext context,
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
184 String uuid)
128
206312c2aa76 I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 127
diff changeset
185 {
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
186 Vector<String> stateIds = getPreviousStateIds();
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
187
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
188 FLYSContext flysContext = getFlysContext(context);
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
189 StateEngine engine = (StateEngine) flysContext.get(
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
190 FLYSContext.STATE_ENGINE_KEY);
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
191
134
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
192 for (String stateId: stateIds) {
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
193 logger.debug("Append static data for state: " + stateId);
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
194 DefaultState state = (DefaultState) engine.getState(stateId);
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
195 ui.appendChild(state.describeStatic(doc, ui, context, uuid));
f3dfa188d8b2 Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 128
diff changeset
196 }
124
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
197
b7a9557957d1 Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
198 }
105
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 }
beb991dc4827 Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org