Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 1707:3bf464ec436f
Added a further attribute to the feature type description for barriers.
flys-artifacts/trunk@2953 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 12 Oct 2011 16:52:43 +0000 |
parents | 71d369ab789d |
children | e99b4bd32cd5 |
rev | line source |
---|---|
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifactdatabase.state.Facet; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifactdatabase.state.Output; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.Artifact; |
1703
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
7 import de.intevation.artifacts.ArtifactFactory; |
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.CallMeta; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
1703
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
10 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
11 |
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.artifacts.states.DefaultState; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import java.util.ArrayList; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import java.util.List; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import org.apache.log4j.Logger; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
1703
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
19 import de.intevation.artifacts.common.utils.XMLUtils; |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
20 import org.w3c.dom.Document; |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
21 |
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 /** |
1703
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
24 * Clone of an WINFOArtifact to expose exactly one waterlevel only. |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
25 * All Facets of the "longitudinal_section" output will be added to the |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
26 * "w_differences" output and filterFacets adjusted accordingly. |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
27 * |
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa). |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 */ |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 public class WaterlevelArtifact extends WINFOArtifact { |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 /** The logger for this class. */ |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 private static Logger logger = Logger.getLogger(WaterlevelArtifact.class); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 /** The name of the artifact. */ |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 public static final String ARTIFACT_NAME = "waterlevel"; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 /** |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * The default constructor. |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 */ |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 public WaterlevelArtifact() { |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 } |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** |
1703
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
47 * Setup and restate longitudinal_section filterfacets to apply to the |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
48 * w_differences output, too. |
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 */ |
1703
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
50 public void setup( |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
51 String identifier, |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
52 ArtifactFactory factory, |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
53 Object context, |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
54 CallMeta callMeta, |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
55 Document data) |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
56 { |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
57 super.setup(identifier, factory, context, callMeta, data); |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
58 filterFacets.put( |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
59 "w_differences", |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
60 filterFacets.get("longitudinal_section")); |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
61 } |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
62 |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
63 /** |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
64 * Clone important stuff of an WINFOArtifact. |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
65 * @param artifact the WINFOArtifact to clone stuff from. |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
66 */ |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
67 protected void initialize( |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
68 Artifact artifact, |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
69 Object context, |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
70 CallMeta meta) |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
71 { |
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 WINFOArtifact winfo = (WINFOArtifact) artifact; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 this.data = winfo.cloneData(); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 logger.debug("Cloned data of winfo artifact."); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 // Statically add Facets. |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 List<Facet> fs = new ArrayList<Facet>(); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 DefaultState state = (DefaultState) getCurrentState(context); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 state.computeInit(this, hash(), context, meta, fs); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 if (!fs.isEmpty()) { |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 logger.debug("Facets to add in WaterlevelArtifact.initialize ."); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 facets.put(getCurrentStateId(), fs); |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 } |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 else { |
1703
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
84 logger.debug("No facets to add in WaterlevelArtifact.initialize (" |
71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1629
diff
changeset
|
85 + state.getID() + ")."); |
1629
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 } |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 } |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 /** |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 * Returns the name of the concrete artifact. |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 * |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 * @return the name of the concrete artifact. |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 */ |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 public String getName() { |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 return ARTIFACT_NAME; |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 } |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 } |
4aec853a2f85
Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |