comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java @ 3812:f788d2d901d6

merged flys-artifacts/pre2.6-2011-12-05
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:53 +0200
parents f6a190f6aaff
children e384d78ff78b
comparison
equal deleted inserted replaced
3808:5fab0fe3c445 3812:f788d2d901d6
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 * Clone important stuff of an WINFOArtifact.
63 * @param artifact the WINFOArtifact to clone stuff from.
64 */
65 protected void initialize(
66 Artifact artifact,
67 Object context,
68 CallMeta meta)
69 {
70 WINFOArtifact winfo = (WINFOArtifact) artifact;
71 this.data = winfo.cloneData();
72 logger.debug("Cloned data of winfo artifact.");
73 // Statically add Facets.
74 List<Facet> fs = new ArrayList<Facet>();
75 DefaultState state = (DefaultState) getCurrentState(context);
76 state.computeInit(this, hash(), context, meta, fs);
77 if (!fs.isEmpty()) {
78 logger.debug("Facets to add in WaterlevelArtifact.initialize .");
79 facets.put(getCurrentStateId(), fs);
80 }
81 else {
82 logger.debug("No facets to add in WaterlevelArtifact.initialize ("
83 + state.getID() + ").");
84 }
85 }
86
87
88 /**
89 * Returns the name of the concrete artifact.
90 *
91 * @return the name of the concrete artifact.
92 */
93 public String getName() {
94 return ARTIFACT_NAME;
95 }
96
97 /**
98 * Determines Facets initial disposition regarding activity (think of
99 * selection in Client ThemeList GUI).
100 * WaterlevelArtifact Facets should come to live "inactive" (always
101 * return 0).
102 *
103 * @param facetName name of the facet.
104 * @param index index of the facet.
105 *
106 * @return Always 0 to have Facets initial predisposition to "inactive".
107 */
108 @Override
109 public int getInitialFacetActivity(
110 String outputName,
111 String facetName,
112 int index)
113 {
114 return 0;
115 }
116 }
117 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org