Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 155:fbbb22e1e206
Changed the background color of discharge curves to white.
flys-artifacts/trunk@1597 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 28 Mar 2011 16:36:13 +0000 |
parents | c97f9bc9b642 |
children | 9a0e1289bab6 |
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 |
155
fbbb22e1e206
Changed the background color of discharge curves to white.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
153
diff
changeset
|
3 import java.awt.Color; |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
4 import java.io.IOException; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
5 import java.io.OutputStream; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
6 import java.util.ArrayList; |
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 import java.util.List; |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
8 import java.util.Map; |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
9 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
|
10 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 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
|
12 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
|
13 import org.w3c.dom.Node; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.apache.log4j.Logger; |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
17 import org.jfree.data.xy.DefaultXYDataset; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
18 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
19 import org.jfree.chart.ChartFactory; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
20 import org.jfree.chart.JFreeChart; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
21 import org.jfree.chart.plot.PlotOrientation; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
22 |
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
|
23 import de.intevation.artifacts.ArtifactNamespaceContext; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifacts.CallContext; |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
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
|
26 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
|
27 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
|
28 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
|
29 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
|
30 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
|
31 |
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
|
32 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
|
33 |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
34 import de.intevation.flys.model.Gauge; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
35 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
36 import de.intevation.flys.artifacts.model.DischargeTables; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
37 import de.intevation.flys.artifacts.model.GaugesFactory; |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
38 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
|
39 import de.intevation.flys.artifacts.context.FLYSContext; |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
40 import de.intevation.flys.exports.ChartExportHelper; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * The default WINFO artifact. |
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 * @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
|
47 */ |
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
|
48 public class WINFOArtifact extends FLYSArtifact { |
105
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 /** The logger for this class */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 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
|
52 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
54 /** The name of the artifact.*/ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
55 public static final String ARTIFACT_NAME = "winfo"; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
56 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
57 /** XPath */ |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
58 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
|
59 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
60 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * The default constructor. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 public WINFOArtifact() { |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * 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
|
70 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 * @param data Some data. |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
72 * @param context The CallContext. |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 * @return the description of this artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 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
|
77 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
|
78 |
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 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
|
80 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
|
81 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
|
82 } |
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
|
83 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
|
84 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
|
85 } |
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
|
86 |
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
|
87 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
|
88 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
|
89 |
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
|
90 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
|
91 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
|
92 |
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 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
|
94 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
|
95 |
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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 |
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
|
102 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
|
103 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
|
104 |
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
|
105 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
|
106 |
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
|
107 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
|
108 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
|
109 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
|
110 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
111 Element ui = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
112 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
|
113 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
114 Element staticUI = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
115 creator, "static", null, null); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
116 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
121 appendStaticUI(description, staticUI, context, identifier()); |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
122 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
123 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
|
124 description, |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
125 root, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
126 context, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
127 identifier()); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
128 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
129 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
|
130 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
|
131 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
132 |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
133 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
|
134 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
135 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
|
136 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
|
137 |
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
|
138 return description; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
140 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
141 |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
142 @Override |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
143 public void out( |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
144 Document format, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
145 OutputStream out, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
146 CallContext context) |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
147 throws IOException |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
148 { |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
149 logger.info("WINFOArtifact.out"); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
150 String river = (String) getData("river").getValue(); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
151 String from = (String) getData("ld_from").getValue(); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
152 String to = (String) getData("ld_to").getValue(); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
153 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
154 double f = Double.parseDouble(from); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
155 double t = Double.parseDouble(to); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
156 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
157 List<double[]> ranges = new ArrayList<double[]>(); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
158 ranges.add(new double [] { f, t }); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
159 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
160 List<Gauge> gauges = GaugesFactory.getGauges(river); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
161 List<Gauge> filtered = GaugesFactory.filterRanges(gauges, ranges); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
162 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
163 if (logger.isDebugEnabled()) { |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
164 int numGauges = gauges != null ? gauges.size() : 0; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
165 int numFiltered = filtered != null ? filtered.size() : 0; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
166 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
167 logger.debug("++++++++++++++++++++"); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
168 logger.debug("Search gauges for river: " + river); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
169 logger.debug("-> ... from range: " + from); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
170 logger.debug("-> ... to range: " + to); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
171 logger.debug("-> Found " + numGauges + " gauges in total."); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
172 logger.debug("-> Found " + numFiltered + " gauges after filtering."); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
173 logger.debug("++++++++++++++++++++"); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
174 } |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
175 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
176 String[] gaugeNames = new String[filtered.size()]; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
177 int idx = 0; |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
178 for (Gauge gauge: filtered) { |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
179 gaugeNames[idx++] = gauge.getName(); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
180 } |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
181 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
182 DischargeTables dt = new DischargeTables(river, gaugeNames); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
183 Map<String, double[][]> gaugeValues = dt.getValues(100d); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
184 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
185 DefaultXYDataset dataset = new DefaultXYDataset(); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
186 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
187 for (String gauge: gaugeNames) { |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
188 double[][] values = gaugeValues.get(gauge); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
189 dataset.addSeries(gauge, values); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
190 } |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
191 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
192 JFreeChart chart = ChartFactory.createXYLineChart( |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
193 "Abflusskurven (" + river + ")", |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
194 "Q", "W", |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
195 dataset, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
196 PlotOrientation.VERTICAL, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
197 true, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
198 false, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
199 false); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
200 |
155
fbbb22e1e206
Changed the background color of discharge curves to white.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
153
diff
changeset
|
201 chart.setBackgroundPaint(Color.WHITE); |
fbbb22e1e206
Changed the background color of discharge curves to white.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
153
diff
changeset
|
202 chart.getPlot().setBackgroundPaint(Color.WHITE); |
fbbb22e1e206
Changed the background color of discharge curves to white.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
153
diff
changeset
|
203 |
153
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
204 ChartExportHelper.exportImage( |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
205 out, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
206 chart, |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
207 "png", |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
208 600, 400); |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
209 } |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
210 |
c97f9bc9b642
The out() operation of the WINFO artifact draws discharge tables for gauges specified by the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
144
diff
changeset
|
211 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
212 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
213 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
214 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
215 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
216 */ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
217 public String getName() { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
218 return ARTIFACT_NAME; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
219 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
220 |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
221 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 { |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
228 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
|
229 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
230 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
|
231 doc, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
232 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
|
233 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
|
234 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
235 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
|
236 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
|
237 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
|
238 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
239 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
|
240 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
|
241 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
|
242 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
243 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
|
244 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
|
245 continue; |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
246 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
247 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
248 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
|
249 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
250 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
251 // 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
|
252 // 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
|
253 // 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
|
254 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
255 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
256 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
257 /** |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
258 * 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
|
259 * 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
|
260 * |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
261 * @param doc The document. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
262 * @param ui The root node. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
263 * @param context The CallContext. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
264 * @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
|
265 */ |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
266 protected void appendStaticUI( |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
267 Document doc, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
268 Node ui, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
269 CallContext context, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
270 String uuid) |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
271 { |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
272 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
|
273 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
274 FLYSContext flysContext = getFlysContext(context); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
275 StateEngine engine = (StateEngine) flysContext.get( |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
276 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
|
277 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
278 for (String stateId: stateIds) { |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
283 |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
284 } |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |