Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 3818:dc18457b1cef
merged flys-artifacts/pre2.7-2012-03-16
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:59 +0200 |
parents | e384d78ff78b |
children | 5642a83420f2 |
comparison
equal
deleted
inserted
replaced
2456:60ab1054069d | 3818:dc18457b1cef |
---|---|
1 package de.intevation.flys.artifacts; | |
2 | |
3 import de.intevation.artifactdatabase.state.Facet; | |
4 | |
5 import de.intevation.artifacts.Artifact; | |
6 import de.intevation.artifacts.ArtifactFactory; | |
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 import org.w3c.dom.Document; | |
17 | |
18 | |
19 /** | |
20 * Clone of an WINFOArtifact to expose exactly one waterlevel only. | |
21 * All Facets of the "longitudinal_section" output will be added to the | |
22 * "w_differences" output and filterFacets adjusted accordingly. | |
23 * | |
24 * @TODO Straighten inheritance-line (waterlevel-WINFO or vice versa). | |
25 */ | |
26 public class WaterlevelArtifact extends WINFOArtifact { | |
27 | |
28 /** The logger for this class. */ | |
29 private static Logger logger = Logger.getLogger(WaterlevelArtifact.class); | |
30 | |
31 /** The name of the artifact. */ | |
32 public static final String ARTIFACT_NAME = "waterlevel"; | |
33 | |
34 | |
35 /** | |
36 * The default constructor. | |
37 */ | |
38 public WaterlevelArtifact() { | |
39 } | |
40 | |
41 | |
42 /** | |
43 * Setup and restate longitudinal_section filterfacets to apply to the | |
44 * w_differences output, too. | |
45 */ | |
46 public void setup( | |
47 String identifier, | |
48 ArtifactFactory factory, | |
49 Object context, | |
50 CallMeta callMeta, | |
51 Document data) | |
52 { | |
53 super.setup(identifier, factory, context, callMeta, data); | |
54 if(filterFacets != null) { | |
55 filterFacets.put( | |
56 "w_differences", | |
57 filterFacets.get("longitudinal_section")); | |
58 } | |
59 } | |
60 | |
61 | |
62 /** | |
63 * Clone important stuff of an WINFOArtifact. | |
64 * @param artifact the WINFOArtifact to clone stuff from. | |
65 */ | |
66 protected void initialize( | |
67 Artifact artifact, | |
68 Object context, | |
69 CallMeta meta) | |
70 { | |
71 WINFOArtifact winfo = (WINFOArtifact) artifact; | |
72 this.data = winfo.cloneData(); | |
73 logger.debug("Cloned data of winfo artifact."); | |
74 // Statically add Facets. | |
75 List<Facet> fs = new ArrayList<Facet>(); | |
76 DefaultState state = (DefaultState) getCurrentState(context); | |
77 state.computeInit(this, hash(), context, meta, fs); | |
78 if (!fs.isEmpty()) { | |
79 logger.debug("Facets to add in WaterlevelArtifact.initialize ."); | |
80 facets.put(getCurrentStateId(), fs); | |
81 } | |
82 else { | |
83 logger.debug("No facets to add in WaterlevelArtifact.initialize (" | |
84 + state.getID() + ")."); | |
85 } | |
86 } | |
87 | |
88 | |
89 /** | |
90 * Returns the name of the concrete artifact. | |
91 * | |
92 * @return the name of the concrete artifact. | |
93 */ | |
94 public String getName() { | |
95 return ARTIFACT_NAME; | |
96 } | |
97 | |
98 | |
99 /** | |
100 * Determines Facets initial disposition regarding activity (think of | |
101 * selection in Client ThemeList GUI). | |
102 * WaterlevelArtifact Facets should come to live "inactive" (always | |
103 * return 0). | |
104 * | |
105 * @param facetName name of the facet. | |
106 * @param index index of the facet. | |
107 * | |
108 * @return Always 0 to have Facets initial predisposition to "inactive". | |
109 */ | |
110 @Override | |
111 public int getInitialFacetActivity( | |
112 String outputName, | |
113 String facetName, | |
114 int index) | |
115 { | |
116 return 0; | |
117 } | |
118 } | |
119 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |