annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 1669:0296684a5553

Bugfix: #330 Add problem if no data was found for duration curves. flys-artifacts/trunk@2881 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 04 Oct 2011 13:38:21 +0000
parents 4aec853a2f85
children 71d369ab789d
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;
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
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 /**
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 * Clone of an WINFOArtifact to expose waterlevels only.
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa).
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 public class WaterlevelArtifact extends WINFOArtifact {
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 /** The logger for this class. */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 private static Logger logger = Logger.getLogger(WaterlevelArtifact.class);
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 /** The name of the artifact. */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 public static final String ARTIFACT_NAME = "waterlevel";
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28
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 /**
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 * The default constructor.
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 public WaterlevelArtifact() {
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
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 * Clone important stuff of an WINFOArtifact (called from factory).
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 protected void initialize(Artifact artifact,
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 Object context,
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 CallMeta meta) {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 WINFOArtifact winfo = (WINFOArtifact) artifact;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 this.data = winfo.cloneData();
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 logger.debug("Cloned data of winfo artifact.");
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 // Statically add Facets.
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 List<Facet> fs = new ArrayList<Facet>();
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 DefaultState state = (DefaultState) getCurrentState(context);
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 state.computeInit(this, hash(), context, meta, fs);
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 if (!fs.isEmpty()) {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 logger.debug("Facets to add in WaterlevelArtifact.initialize .");
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 facets.put(getCurrentStateId(), fs);
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 else {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 logger.debug("No facets to add in WaterlevelArtifact.initialize ("+state.getID()+").");
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 this.filterFacets = null;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 /**
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 * Prevent filtering from taking place.
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 @Override
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 protected List<Output> filterOutputs(List<Output> outs) {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 return outs;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 /**
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 * Returns the name of the concrete artifact.
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 *
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 * @return the name of the concrete artifact.
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 */
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 public String getName() {
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 return ARTIFACT_NAME;
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 }
4aec853a2f85 Added WaterlevelArtifact and respective infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org