Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 1703:71d369ab789d
Fix remainder of flys/issue304 (Erweiterte Funktionen W-Differenzen).
flys-artifacts/trunk@2945 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 12 Oct 2011 10:21:59 +0000 |
parents | 4aec853a2f85 |
children | e99b4bd32cd5 |
comparison
equal
deleted
inserted
replaced
1702:6f019d1d3da9 | 1703:71d369ab789d |
---|---|
2 | 2 |
3 import de.intevation.artifactdatabase.state.Facet; | 3 import de.intevation.artifactdatabase.state.Facet; |
4 import de.intevation.artifactdatabase.state.Output; | 4 import de.intevation.artifactdatabase.state.Output; |
5 | 5 |
6 import de.intevation.artifacts.Artifact; | 6 import de.intevation.artifacts.Artifact; |
7 import de.intevation.artifacts.ArtifactFactory; | |
7 import de.intevation.artifacts.CallMeta; | 8 import de.intevation.artifacts.CallMeta; |
9 | |
10 import de.intevation.artifacts.common.ArtifactNamespaceContext; | |
8 | 11 |
9 import de.intevation.flys.artifacts.states.DefaultState; | 12 import de.intevation.flys.artifacts.states.DefaultState; |
10 | 13 |
11 import java.util.ArrayList; | 14 import java.util.ArrayList; |
12 import java.util.List; | 15 import java.util.List; |
13 | 16 |
14 import org.apache.log4j.Logger; | 17 import org.apache.log4j.Logger; |
15 | 18 |
19 import de.intevation.artifacts.common.utils.XMLUtils; | |
20 import org.w3c.dom.Document; | |
21 | |
16 | 22 |
17 /** | 23 /** |
18 * Clone of an WINFOArtifact to expose waterlevels only. | 24 * Clone of an WINFOArtifact to expose exactly one waterlevel only. |
25 * All Facets of the "longitudinal_section" output will be added to the | |
26 * "w_differences" output and filterFacets adjusted accordingly. | |
27 * | |
19 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa). | 28 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa). |
20 */ | 29 */ |
21 public class WaterlevelArtifact extends WINFOArtifact { | 30 public class WaterlevelArtifact extends WINFOArtifact { |
22 | 31 |
23 /** The logger for this class. */ | 32 /** The logger for this class. */ |
33 public WaterlevelArtifact() { | 42 public WaterlevelArtifact() { |
34 } | 43 } |
35 | 44 |
36 | 45 |
37 /** | 46 /** |
38 * Clone important stuff of an WINFOArtifact (called from factory). | 47 * Setup and restate longitudinal_section filterfacets to apply to the |
48 * w_differences output, too. | |
39 */ | 49 */ |
40 protected void initialize(Artifact artifact, | 50 public void setup( |
41 Object context, | 51 String identifier, |
42 CallMeta meta) { | 52 ArtifactFactory factory, |
53 Object context, | |
54 CallMeta callMeta, | |
55 Document data) | |
56 { | |
57 super.setup(identifier, factory, context, callMeta, data); | |
58 filterFacets.put( | |
59 "w_differences", | |
60 filterFacets.get("longitudinal_section")); | |
61 } | |
62 | |
63 /** | |
64 * Clone important stuff of an WINFOArtifact. | |
65 * @param artifact the WINFOArtifact to clone stuff from. | |
66 */ | |
67 protected void initialize( | |
68 Artifact artifact, | |
69 Object context, | |
70 CallMeta meta) | |
71 { | |
43 WINFOArtifact winfo = (WINFOArtifact) artifact; | 72 WINFOArtifact winfo = (WINFOArtifact) artifact; |
44 this.data = winfo.cloneData(); | 73 this.data = winfo.cloneData(); |
45 logger.debug("Cloned data of winfo artifact."); | 74 logger.debug("Cloned data of winfo artifact."); |
46 // Statically add Facets. | 75 // Statically add Facets. |
47 List<Facet> fs = new ArrayList<Facet>(); | 76 List<Facet> fs = new ArrayList<Facet>(); |
50 if (!fs.isEmpty()) { | 79 if (!fs.isEmpty()) { |
51 logger.debug("Facets to add in WaterlevelArtifact.initialize ."); | 80 logger.debug("Facets to add in WaterlevelArtifact.initialize ."); |
52 facets.put(getCurrentStateId(), fs); | 81 facets.put(getCurrentStateId(), fs); |
53 } | 82 } |
54 else { | 83 else { |
55 logger.debug("No facets to add in WaterlevelArtifact.initialize ("+state.getID()+")."); | 84 logger.debug("No facets to add in WaterlevelArtifact.initialize (" |
85 + state.getID() + ")."); | |
56 } | 86 } |
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 } | 87 } |
68 | 88 |
69 | 89 |
70 /** | 90 /** |
71 * Returns the name of the concrete artifact. | 91 * Returns the name of the concrete artifact. |