comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 1629:4aec853a2f85

Added WaterlevelArtifact and respective infrastructure. flys-artifacts/trunk@2804 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 21 Sep 2011 14:28:39 +0000
parents
children 71d369ab789d
comparison
equal deleted inserted replaced
1628:16c74ca3586e 1629:4aec853a2f85
1 package de.intevation.flys.artifacts;
2
3 import de.intevation.artifactdatabase.state.Facet;
4 import de.intevation.artifactdatabase.state.Output;
5
6 import de.intevation.artifacts.Artifact;
7 import de.intevation.artifacts.CallMeta;
8
9 import de.intevation.flys.artifacts.states.DefaultState;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14 import org.apache.log4j.Logger;
15
16
17 /**
18 * Clone of an WINFOArtifact to expose waterlevels only.
19 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa).
20 */
21 public class WaterlevelArtifact extends WINFOArtifact {
22
23 /** The logger for this class. */
24 private static Logger logger = Logger.getLogger(WaterlevelArtifact.class);
25
26 /** The name of the artifact. */
27 public static final String ARTIFACT_NAME = "waterlevel";
28
29
30 /**
31 * The default constructor.
32 */
33 public WaterlevelArtifact() {
34 }
35
36
37 /**
38 * Clone important stuff of an WINFOArtifact (called from factory).
39 */
40 protected void initialize(Artifact artifact,
41 Object context,
42 CallMeta meta) {
43 WINFOArtifact winfo = (WINFOArtifact) artifact;
44 this.data = winfo.cloneData();
45 logger.debug("Cloned data of winfo artifact.");
46 // Statically add Facets.
47 List<Facet> fs = new ArrayList<Facet>();
48 DefaultState state = (DefaultState) getCurrentState(context);
49 state.computeInit(this, hash(), context, meta, fs);
50 if (!fs.isEmpty()) {
51 logger.debug("Facets to add in WaterlevelArtifact.initialize .");
52 facets.put(getCurrentStateId(), fs);
53 }
54 else {
55 logger.debug("No facets to add in WaterlevelArtifact.initialize ("+state.getID()+").");
56 }
57 this.filterFacets = null;
58 }
59
60
61 /**
62 * Prevent filtering from taking place.
63 */
64 @Override
65 protected List<Output> filterOutputs(List<Output> outs) {
66 return outs;
67 }
68
69
70 /**
71 * Returns the name of the concrete artifact.
72 *
73 * @return the name of the concrete artifact.
74 */
75 public String getName() {
76 return ARTIFACT_NAME;
77 }
78 }
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org