annotate artifacts/src/main/java/org/dive4elements/river/artifacts/ChartArtifact.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents 8d5ca5175038
children 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
9 package org.dive4elements.river.artifacts;
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 import java.util.List;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Document;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 import org.w3c.dom.Element;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
18 import org.dive4elements.artifacts.Artifact;
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
20 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
21 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
22 import org.dive4elements.artifacts.CallContext;
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
24 import org.dive4elements.artifacts.common.utils.XMLUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
25 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
27 import org.dive4elements.artifactdatabase.ProtocolUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
28 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
29 import org.dive4elements.artifactdatabase.state.State;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
30 import org.dive4elements.artifactdatabase.state.StateEngine;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
31 import org.dive4elements.artifactdatabase.state.Output;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
32
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
33 import org.dive4elements.river.utils.RiverUtils;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
34
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
35 import org.dive4elements.river.artifacts.states.DefaultState;
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
36 import org.dive4elements.river.artifacts.context.RiverContext;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
37 import org.dive4elements.river.artifacts.resources.Resources;
2113
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
3650
cbe2febe30cc Merged revisions 5391-5392 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3555
diff changeset
40 /** Artifact, open to generate any (?) out. */
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
41 public class ChartArtifact extends D4EArtifact {
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
43 private static final Logger log =
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 Logger.getLogger(ChartArtifact.class);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 @Override
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 public void setup(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 String identifier,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 ArtifactFactory factory,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 Object context,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 CallMeta callmeta,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 5994
diff changeset
52 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 5994
diff changeset
53 List<Class> loadFacets)
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
55 log.debug("ChartArtifact.setup");
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 this.identifier = identifier;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 name = "new_chart";
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 List<State> states = getStates(context);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 setCurrentState(states.get(0));
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 @Override
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
65 protected void appendBackgroundActivity(
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 ElementCreator cr,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 Element root,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 CallContext context
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 ) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 Element inBackground = cr.create("background-processing");
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 root.appendChild(inBackground);
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 cr.addAttr(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 inBackground,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 "value",
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 String.valueOf(context.isInBackground()),
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 true);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 /**
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 * Append output mode nodes to a document.
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 */
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3083
diff changeset
84 @Override
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 protected void appendOutputModes(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 Document doc,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 Element outs,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 CallContext context,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 String uuid)
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 List<String> stateIds = getPreviousStateIds();
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
93 RiverContext flysContext = RiverUtils.getFlysContext(context);
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 StateEngine engine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
95 RiverContext.STATE_ENGINE_KEY);
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 for (String stateId: stateIds) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
98 log.debug("Append output modes for state: " + stateId);
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 DefaultState state = (DefaultState) engine.getState(stateId);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 List<Output> list = state.getOutputs();
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3193
diff changeset
102 if (list == null || list.isEmpty()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
103 log.debug("-> No output modes for this state.");
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 continue;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4049
diff changeset
107 List<Facet> fs = getFacets(stateId);
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3193
diff changeset
109 if (fs == null || fs.isEmpty()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
110 log.debug("No facets for previous state found.");
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 continue;
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
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
114 log.debug("Found " + fs.size() + " facets in previous states.");
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 List<Output> generated = generateOutputs(list, fs);
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 ProtocolUtils.appendOutputModes(doc, outs, generated);
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 try {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 DefaultState cur = (DefaultState) getCurrentState(context);
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
123 List<Output> list = cur.getOutputs();
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
124 if (list != null && list.size() > 0) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
125 log.debug(
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
126 "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
127
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4049
diff changeset
128 List<Facet> fs = getFacets(cur.getID());
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
130 if (fs != null && fs.size() > 0) {
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
131 List<Output> generated = generateOutputs(list, fs);
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
132
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
133 log.debug("Found " + fs.size() + " current facets.");
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
134 if (!generated.isEmpty()) {
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
135 ProtocolUtils.appendOutputModes(
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
136 doc, outs, generated);
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 }
2158
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
138 }
1ea555bf3c6b Removed state validation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2153
diff changeset
139 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
140 log.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
141 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 }
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 catch (IllegalArgumentException iae) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 // 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
146 }
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
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 public static class ChartState extends DefaultState {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 public static final String FIELD_MODE = "chart_type";
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 DURATION_CURVE =
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 "chart.new.durationcurve";
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 COMPUTED_DISCHARGE_CURVE =
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 "chart.new.computeddischargecurve";
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 DISCHARGE_LONGITUDINAL_CURVE =
2153
734d5f5e55c0 'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2120
diff changeset
160 "chart.new.longitudinal_section";
2113
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 W_DIFFERENCES =
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 "chart.new.w_differences";
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 WATERLEVEL =
2153
734d5f5e55c0 'New chart' for cross sections.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2120
diff changeset
166 "chart.new.crosssection";
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 public static final String[] CHARTS = {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 COMPUTED_DISCHARGE_CURVE,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 DURATION_CURVE,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 DISCHARGE_LONGITUDINAL_CURVE,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 W_DIFFERENCES,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 WATERLEVEL };
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 @Override
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 public Object computeAdvance(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
179 D4EArtifact artifact,
2113
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 String hash,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 CallContext context,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 List<Facet> facets,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 Object old)
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
185 log.debug("ChartState.computeAdvance");
2113
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 return null;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 @Override
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 protected Element[] createItems(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 XMLUtils.ElementCreator cr,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 Artifact artifact,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 String name,
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 CallContext context)
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 CallMeta meta = context.getMeta();
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 Element[] charts = new Element[CHARTS.length];
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 int i = 0;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 for (String chart: CHARTS) {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 charts[i++] = createItem(
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 cr, new String[] {
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 Resources.getMsg(meta, chart, chart),
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 chart
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 });
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 return charts;
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 }
d109e7702995 Initial implementation for module 'new chart'.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2158
diff changeset
216 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org