Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/ChartArtifact.java @ 3977:172d31051316
dummy merge for repo head
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:15:52 +0200 |
parents | cbe2febe30cc |
children | 8e66293c5369 |
rev | line source |
---|---|
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Element; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.Artifact; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.ArtifactFactory; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.CallMeta; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.CallContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.common.utils.XMLUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.ProtocolUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifactdatabase.state.Facet; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifactdatabase.state.State; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifactdatabase.state.StateEngine; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifactdatabase.state.Output; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.utils.FLYSUtils; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.artifacts.states.DefaultState; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.artifacts.context.FLYSContext; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.artifacts.resources.Resources; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
3650
cbe2febe30cc
Merged revisions 5391-5392 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3555
diff
changeset
|
33 /** Artifact, open to generate any (?) out. */ |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 public class ChartArtifact extends FLYSArtifact { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 private static final Logger logger = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 Logger.getLogger(ChartArtifact.class); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 public void setup( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 String identifier, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 ArtifactFactory factory, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 Object context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 CallMeta callmeta, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 Document data) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 logger.debug("ChartArtifact.setup"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 this.identifier = identifier; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 name = "new_chart"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 List<State> states = getStates(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 setCurrentState(states.get(0)); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 @Override |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3083
diff
changeset
|
57 protected void appendBackgroundActivity( |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 ElementCreator cr, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 Element root, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 CallContext context |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 ) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 Element inBackground = cr.create("background-processing"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 root.appendChild(inBackground); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 cr.addAttr( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 inBackground, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 "value", |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 String.valueOf(context.isInBackground()), |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 true); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 /** |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 * Append output mode nodes to a document. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 */ |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3083
diff
changeset
|
76 @Override |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 protected void appendOutputModes( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 Document doc, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 Element outs, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 CallContext context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 String uuid) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 List<String> stateIds = getPreviousStateIds(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 doc, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 ArtifactNamespaceContext.NAMESPACE_URI, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 StateEngine engine = (StateEngine) flysContext.get( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 FLYSContext.STATE_ENGINE_KEY); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 for (String stateId: stateIds) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 logger.debug("Append output modes for state: " + stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 DefaultState state = (DefaultState) engine.getState(stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 List<Output> list = state.getOutputs(); |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3193
diff
changeset
|
99 if (list == null || list.isEmpty()) { |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 logger.debug("-> No output modes for this state."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 continue; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 List<Facet> fs = facets.get(stateId); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3193
diff
changeset
|
106 if (fs == null || fs.isEmpty()) { |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 logger.debug("No facets for previous state found."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 continue; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 logger.debug("Found " + fs.size() + " facets in previous states."); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 List<Output> generated = generateOutputs(list, fs); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 ProtocolUtils.appendOutputModes(doc, outs, generated); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 try { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 DefaultState cur = (DefaultState) getCurrentState(context); |
2158
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
120 List<Output> list = cur.getOutputs(); |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
121 if (list != null && list.size() > 0) { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
122 logger.debug( |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
123 "Append output modes for current state: " + cur.getID()); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 |
2158
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
125 List<Facet> fs = facets.get(cur.getID()); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 |
2158
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
127 if (fs != null && fs.size() > 0) { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
128 List<Output> generated = generateOutputs(list, fs); |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
129 |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
130 logger.debug("Found " + fs.size() + " current facets."); |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
131 if (!generated.isEmpty()) { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
132 ProtocolUtils.appendOutputModes( |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
133 doc, outs, generated); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 } |
2158
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
135 } |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
136 else { |
1ea555bf3c6b
Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2153
diff
changeset
|
137 logger.debug("No facets found for the current state."); |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 catch (IllegalArgumentException iae) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 // state is not valid, so we do not append its outputs. |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 public static class ChartState extends DefaultState { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 public static final String FIELD_MODE = "chart_type"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 public static final String DURATION_CURVE = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 "chart.new.durationcurve"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 public static final String COMPUTED_DISCHARGE_CURVE = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 "chart.new.computeddischargecurve"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 public static final String DISCHARGE_LONGITUDINAL_CURVE = |
2153
734d5f5e55c0
'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2120
diff
changeset
|
157 "chart.new.longitudinal_section"; |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 public static final String W_DIFFERENCES = |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 "chart.new.w_differences"; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 public static final String WATERLEVEL = |
2153
734d5f5e55c0
'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2120
diff
changeset
|
163 "chart.new.crosssection"; |
2113
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 public static final String[] CHARTS = { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 COMPUTED_DISCHARGE_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 DURATION_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 DISCHARGE_LONGITUDINAL_CURVE, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 W_DIFFERENCES, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 WATERLEVEL }; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 public Object computeAdvance( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 FLYSArtifact artifact, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 String hash, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 CallContext context, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 List<Facet> facets, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 Object old) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 logger.debug("ChartState.computeAdvance"); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 return null; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 @Override |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 protected Element[] createItems( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 XMLUtils.ElementCreator cr, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 Artifact artifact, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 String name, |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 CallContext context) |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 CallMeta meta = context.getMeta(); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 Element[] charts = new Element[CHARTS.length]; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 int i = 0; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 for (String chart: CHARTS) { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 charts[i++] = createItem( |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 cr, new String[] { |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 Resources.getMsg(meta, chart, chart), |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 chart |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 }); |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 return charts; |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 } |
d109e7702995
Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
212 } |
3083
4bd3d8bbb60c
Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
213 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |