annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 1785:661dfad9910a

Use compatibility matrix when creating collections output. flys-artifacts/trunk@3107 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 28 Oct 2011 10:04:22 +0000
parents c62ff9e72cea
children f6a190f6aaff
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
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 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
6 import de.intevation.artifacts.ArtifactFactory;
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import de.intevation.artifacts.CallMeta;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import de.intevation.flys.artifacts.states.DefaultState;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import java.util.ArrayList;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import java.util.List;
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 org.apache.log4j.Logger;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
1703
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
16 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
17
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 /**
1703
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
20 * 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
21 * 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
22 * "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
23 *
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa).
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 public class WaterlevelArtifact extends WINFOArtifact {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 /** The logger for this class. */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 private static Logger logger = Logger.getLogger(WaterlevelArtifact.class);
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 /** The name of the artifact. */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 public static final String ARTIFACT_NAME = "waterlevel";
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33
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 /**
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 * The default constructor.
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 public WaterlevelArtifact() {
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
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 /**
1703
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
43 * 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
44 * w_differences output, too.
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 */
1703
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
46 public void setup(
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
47 String identifier,
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
48 ArtifactFactory factory,
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
49 Object context,
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
50 CallMeta callMeta,
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
51 Document data)
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
52 {
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
53 super.setup(identifier, factory, context, callMeta, data);
1765
5d8b3880a553 Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1709
diff changeset
54 if(filterFacets != null) {
5d8b3880a553 Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1709
diff changeset
55 filterFacets.put(
5d8b3880a553 Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1709
diff changeset
56 "w_differences",
5d8b3880a553 Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1709
diff changeset
57 filterFacets.get("longitudinal_section"));
5d8b3880a553 Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1709
diff changeset
58 }
1703
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
59 }
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
60
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 * 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
63 * @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
64 */
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
65 protected void initialize(
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
66 Artifact artifact,
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
67 Object context,
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
68 CallMeta meta)
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
69 {
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 WINFOArtifact winfo = (WINFOArtifact) artifact;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 this.data = winfo.cloneData();
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 logger.debug("Cloned data of winfo artifact.");
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 // Statically add Facets.
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 List<Facet> fs = new ArrayList<Facet>();
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 DefaultState state = (DefaultState) getCurrentState(context);
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 state.computeInit(this, hash(), context, meta, fs);
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 if (!fs.isEmpty()) {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 logger.debug("Facets to add in WaterlevelArtifact.initialize .");
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
79 facets.put(getCurrentStateId(), fs);
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 else {
1703
71d369ab789d Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1629
diff changeset
82 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
83 + state.getID() + ").");
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 }
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 * Returns the name of the concrete artifact.
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 * @return 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 public String getName() {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 return ARTIFACT_NAME;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 }
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
96
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
97 /**
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
98 * Determines Facets initial disposition regarding activity (think of
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
99 * selection in Client ThemeList GUI).
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
100 * WaterlevelArtifact Facets should come to live "inactive" (always
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
101 * return 0).
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
102 *
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
103 * @param facetName name of the facet.
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
104 * @param index index of the facet.
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
105 *
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
106 * @return Always 0 to have Facets initial predisposition to "inactive".
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
107 */
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
108 @Override
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
109 public int getInitialFacetActivity(String facetName, int index) {
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
110 return 0;
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1708
diff changeset
111 }
1629
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org