annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java @ 1726:e3b9164a85fe

Fetch name of static WKms. flys-artifacts/trunk@3008 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 18 Oct 2011 14:03:43 +0000
parents d9afb16d1fd4
children 2e5ebdeb8af9
rev   line source
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 import java.util.List;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import org.w3c.dom.Document;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
10 import de.intevation.artifactdatabase.data.DefaultStateData;
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
11
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import de.intevation.artifactdatabase.state.Facet;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import de.intevation.artifactdatabase.state.DefaultOutput;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import de.intevation.artifactdatabase.state.State;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.Artifact;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.artifacts.ArtifactFactory;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import de.intevation.artifacts.ArtifactNamespaceContext;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import de.intevation.artifacts.CallMeta;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.artifacts.model.WKms;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.artifacts.model.WKmsFacet;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.artifacts.model.WstValueTable;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 import de.intevation.flys.artifacts.model.WstValueTableFactory;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.artifacts.model.WKmsFactory;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 import de.intevation.flys.artifacts.states.StaticState;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 import de.intevation.flys.artifacts.resources.Resources;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 import de.intevation.flys.utils.FLYSUtils;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 import de.intevation.artifacts.common.utils.XMLUtils;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 * Artifact to access additional "waterlevel"-type of data, like the height
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 * of protective measures (dikes).
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 *
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 * This artifact neglects (Static)FLYSArtifacts capabilities of interaction
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 * with the StateEngine by overriding the getState*-methods.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 public class StaticWKmsArtifact
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 extends StaticFLYSArtifact
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 /** The logger for this class. */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 private static Logger logger =
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 Logger.getLogger(StaticWKmsArtifact.class);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 /** XPath to access initial parameter. */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 public static final String XPATH_DATA =
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 "/art:action/art:ids/@value";
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 /** One and only state to be in. */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 protected transient State state = null;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 * Trivial Constructor.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 public StaticWKmsArtifact() {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 logger.debug("StaticWKmsArtifact.StaticWKmsArtifact");
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 * Gets called from factory, to set things up.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 public void setup(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 String identifier,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 ArtifactFactory factory,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 Object context,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 CallMeta callMeta,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 Document data)
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 logger.debug("StaticWKmsArtifact.setup");
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 state = new StaticState(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 "state.additional_wkms.static",
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 "state.additional_wkms.static");
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
80
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 List<Facet> fs = new ArrayList<Facet>();
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 logger.debug(XMLUtils.toString(data));
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 String code = XMLUtils.xpathString(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 logger.debug("makes: " + code);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
88 // TODO Go for JSON, one day.
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 //ex.: flood_protection-wstv-114-12
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 if (code != null) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 String [] parts = code.split("-");
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
92
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
93 if (parts.length >= 4) {
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
94 try {
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
95 Integer.valueOf(parts[2]);
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
96 Integer.valueOf(parts[3]);
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
97 addStringData("col_pos", parts[2]);
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
98 addStringData("wst_id", parts[3]);
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
99 }
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
100 catch (Exception e) {}
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
101 }
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 Facet facet = new WKmsFacet(Resources.getMsg(callMeta,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 "facet.discharge_curves.mainvalues.w",
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 "facet.discharge_curves.mainvalues.w"));
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 fs.add(facet);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 facets.put(state.getID(), fs);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 spawnState();
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 super.setup(identifier, factory, context, callMeta, data);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 * Initialize the static state with output.
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
117 * @return static state
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 protected State spawnState() {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 state = new StaticState(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 "state.additional_wkms.static",
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 "state.additional_wkms.static");
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 List<Facet> fs = (List<Facet>) facets.get("state.additional_wkms.static");
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 DefaultOutput output = new DefaultOutput(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 "w_differences",
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 "w_differences.longitudinal_section", "image/png",
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 fs,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 "chart");
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 // TODO: also add longitudinal_section output?
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 state.getOutputs().add(output);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 return state;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 * Called via setup.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 protected void initialize(Artifact artifact, Object context, CallMeta meta) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 logger.debug("StaticWKmsArtifact.initialize");
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 WINFOArtifact winfo = (WINFOArtifact) artifact;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 // TODO: The river is of no interest, so far.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 addData("river", winfo.getData("river"));
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 * Get a list containing the one and only State.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 * @param context ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 * @return list with one and only state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 protected List<State> getStates(Object context) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 ArrayList<State> states = new ArrayList<State>();
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 states.add(getState());
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 return states;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 * Get the "current" state (there is but one).
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 * @param cc ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 * @return the "current" (only possible) state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 public State getCurrentState(Object cc) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 return getState();
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 * Get the only possible state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 * @return the state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 protected State getState() {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 return getState(null, null);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 * Get the state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 * @param context ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 * @param stateID ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185 * @return the state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 protected State getState(Object context, String stateID) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 if (state != null)
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 return state;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 else
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 return spawnState();
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 * Get WKms from factory.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 * @param TODO idx param is not needed
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 * @return WKms according to parameterization (can be null);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201 public WKms getWKms(int idx) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 logger.debug("StaticWKmsArtifact.getWKms");
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
203
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 return WKmsFactory.getWKms(
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
205 Integer.valueOf(getDataAsString("col_pos")),
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
206 Integer.valueOf(getDataAsString("wst_id")));
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org