Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java @ 1723:690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
flys-artifacts/trunk@3005 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 18 Oct 2011 12:56:12 +0000 |
parents | |
children | d9afb16d1fd4 |
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 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 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
|
11 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
|
12 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
|
13 |
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.artifacts.Artifact; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 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
|
16 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
|
17 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
|
18 |
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.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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 |
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.states.StaticState; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 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
|
27 |
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.utils.FLYSUtils; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 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
|
30 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
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 * 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
|
34 * 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
|
35 * |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 * 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
|
37 * 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
|
38 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 public class StaticWKmsArtifact |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 extends StaticFLYSArtifact |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 /** 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
|
43 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
|
44 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
|
45 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** 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
|
47 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
|
48 "/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
|
49 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 /** 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
|
51 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
|
52 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 protected int col_pos; |
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 protected int wst_id; |
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 |
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 * Trivial Constructor. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 public StaticWKmsArtifact() { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 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
|
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 |
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 * 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
|
68 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 public void setup( |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 String identifier, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 ArtifactFactory factory, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 Object context, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 CallMeta callMeta, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 Document data) |
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 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
|
78 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 state = new StaticState( |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 "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
|
81 "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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 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
|
88 |
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("-"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 int col = Integer.valueOf(parts[2]); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 int wst = Integer.valueOf(parts[3]); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 // These shall be put in data (addData) |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 this.col_pos = col; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 this.wst_id = wst; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 // addDataAsString? |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 // Will get col_id and wst_id |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 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
|
103 "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
|
104 "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
|
105 fs.add(facet); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 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
|
107 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 spawnState(); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 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
|
110 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 |
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 * Initialize the static state with output. |
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 protected State spawnState() { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 state = new StaticState( |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 "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
|
119 "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
|
120 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
|
121 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
|
122 "w_differences", |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 "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
|
124 fs, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 "chart"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 // 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
|
127 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 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
|
129 return state; |
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 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 |
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 * Called via setup. |
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 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 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
|
138 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
|
139 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
|
140 // 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
|
141 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
|
142 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 |
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 * 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
|
147 * @param context ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 * @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
|
149 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 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
|
152 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
|
153 states.add(getState()); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 return states; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 |
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 * 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
|
160 * @param cc ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 * @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
|
162 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 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
|
165 return getState(); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 |
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 * 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
|
171 * @return the state. |
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 protected State getState() { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 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
|
175 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 |
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 * Get the state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 * @param context ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 * @param stateID ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 * @return the state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
185 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
|
186 if (state != null) |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
187 return state; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 else |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
189 return spawnState(); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 |
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 * 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
|
195 * @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
|
196 * @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
|
197 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 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
|
199 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
|
200 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 // TODO KIND is not needed. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 return WKmsFactory.getWKms( |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 WKmsFactory.KIND_PROTECTION, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 this.col_pos, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 this.wst_id); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 } |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |