Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeArtifact.java @ 2723:5ce5abd173b9
Added skeleton for gauge discharge curves.
flys-artifacts/trunk@4454 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 22 May 2012 09:06:02 +0000 |
parents | |
children | ac9a03ed32c1 |
comparison
equal
deleted
inserted
replaced
2722:36631f23acdf | 2723:5ce5abd173b9 |
---|---|
1 package de.intevation.flys.artifacts; | |
2 | |
3 import java.util.ArrayList; | |
4 import java.util.List; | |
5 | |
6 import org.apache.log4j.Logger; | |
7 | |
8 import org.w3c.dom.Document; | |
9 | |
10 import de.intevation.artifactdatabase.state.Facet; | |
11 | |
12 import de.intevation.artifacts.Artifact; | |
13 import de.intevation.artifacts.ArtifactFactory; | |
14 import de.intevation.artifacts.ArtifactNamespaceContext; | |
15 import de.intevation.artifacts.CallMeta; | |
16 | |
17 import de.intevation.artifacts.common.utils.XMLUtils; | |
18 | |
19 import de.intevation.flys.artifacts.model.FacetTypes; | |
20 | |
21 import de.intevation.flys.artifacts.states.DefaultState; | |
22 | |
23 | |
24 | |
25 /** | |
26 * Artifact to store user-added points. | |
27 */ | |
28 public class GaugeDischargeArtifact | |
29 extends WINFOArtifact | |
30 implements FacetTypes | |
31 { | |
32 /** The logger for this class. */ | |
33 private static Logger logger = Logger.getLogger(GaugeDischargeArtifact.class); | |
34 | |
35 /** The name of the artifact. */ | |
36 public static final String ARTIFACT_NAME = "historicalq"; | |
37 | |
38 // TODO make this one globally available | |
39 public static final String XPATH_DATA = | |
40 "/art:action/art:ids/@value"; | |
41 | |
42 /** | |
43 * Trivial Constructor. | |
44 */ | |
45 public GaugeDischargeArtifact() { | |
46 logger.debug("GaugeDischargeArtifact.HistoricalQArtifact()"); | |
47 } | |
48 | |
49 | |
50 /** | |
51 * Gets called from factory, to set things up. | |
52 * Especially, when loaded via datacage mechanisms, provide the | |
53 * data document. | |
54 * @param data filled with stuff from dc, if any. | |
55 */ | |
56 @Override | |
57 public void setup( | |
58 String identifier, | |
59 ArtifactFactory factory, | |
60 Object context, | |
61 CallMeta callMeta, | |
62 Document data) | |
63 { | |
64 logger.debug("GaugeDischargeArtifact.setup"); | |
65 super.setup(identifier, factory, context, callMeta, data); | |
66 String ids = XMLUtils.xpathString( | |
67 data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE); | |
68 logger.debug("id for gaugedischarge: " + ids); | |
69 } | |
70 | |
71 | |
72 /** Return the name of this artifact. */ | |
73 public String getName() { | |
74 return ARTIFACT_NAME; | |
75 } | |
76 | |
77 | |
78 /** Access state data storing the jsonstring with points. | |
79 public String getPointsData(String facetName) { | |
80 return getDataAsString(facetName + ".data"); | |
81 }*/ | |
82 | |
83 | |
84 /** | |
85 * Setup state and facet, copy from master artifact. | |
86 */ | |
87 @Override | |
88 protected void initialize(Artifact art, Object context, CallMeta meta) { | |
89 logger.debug("GaugeDischargeArtifact.initialize"); | |
90 List<Facet> fs = new ArrayList<Facet>(); | |
91 FLYSArtifact artifact = (FLYSArtifact) art; | |
92 | |
93 // Get the location(s) | |
94 importData(artifact, "ld_mode"); | |
95 importData(artifact, "ld_from"); | |
96 importData(artifact, "ld_to"); | |
97 importData(artifact, "ld_locations"); | |
98 | |
99 DefaultState state = (DefaultState) getCurrentState(context); | |
100 state.computeInit(this, hash(), context, meta, fs); | |
101 if (!fs.isEmpty()) { | |
102 logger.debug("Facets to add in GaugeDischargeArtifact.initialize ."); | |
103 facets.put(getCurrentStateId(), fs); | |
104 } | |
105 else { | |
106 logger.debug("No facets to add in GaugeDischargeArtifact.initialize (" | |
107 + state.getID() + ")."); | |
108 } | |
109 } | |
110 | |
111 | |
112 | |
113 /** | |
114 * Determines Facets initial disposition regarding activity (think of | |
115 * selection in Client ThemeList GUI). This will be checked one time | |
116 * when the facet enters a collections describe document. | |
117 * | |
118 * @param facetName name of the facet. | |
119 * @param index index of the facet. | |
120 * @return 0 if not active | |
121 */ | |
122 @Override | |
123 public int getInitialFacetActivity( | |
124 String outputName, | |
125 String facetName, | |
126 int index) | |
127 { | |
128 return 1; | |
129 } | |
130 } | |
131 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |