Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 5377:a5f5599f6fd5 2.9.14
merge
author | Bettina Gruenbauer <bettina@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 11:02:08 +0100 |
parents | 92c07d5c433c |
children | a916e1202f0f |
comparison
equal
deleted
inserted
replaced
5376:9b2482a3b9fe | 5377:a5f5599f6fd5 |
---|---|
73 || outputName.equals("duration_curve"); | 73 || outputName.equals("duration_curve"); |
74 } | 74 } |
75 }); | 75 }); |
76 } | 76 } |
77 | 77 |
78 | |
78 /** | 79 /** |
79 * Trivial Constructor. | 80 * Trivial Constructor. |
80 */ | 81 */ |
81 public MainValuesArtifact() { | 82 public MainValuesArtifact() { |
82 logger.debug("MainValuesArtifact.MainValuesartifact()"); | 83 logger.debug("MainValuesArtifact.MainValuesartifact()"); |
124 Resources.getMsg( | 125 Resources.getMsg( |
125 callMeta, | 126 callMeta, |
126 "facet.discharge_curves.mainvalues.q", | 127 "facet.discharge_curves.mainvalues.q", |
127 "facet.discharge_curves.mainvalues.q"), | 128 "facet.discharge_curves.mainvalues.q"), |
128 true); | 129 true); |
130 Facet qfacet3 = new MainValuesQFacet( | |
131 HISTORICAL_DISCHARGE_MAINVALUES_Q, | |
132 Resources.getMsg( | |
133 callMeta, | |
134 "historical_discharge.mainvalues.q", | |
135 "historical_discharge.mainvalues.q"), | |
136 false); | |
129 | 137 |
130 fs.add(qfacet0); | 138 fs.add(qfacet0); |
131 fs.add(qfacet1); | 139 fs.add(qfacet1); |
132 fs.add(qfacet2); | 140 fs.add(qfacet2); |
141 fs.add(qfacet3); | |
133 } | 142 } |
134 if (!restricted || restriction.endsWith("w")) { | 143 if (!restricted || restriction.endsWith("w")) { |
135 Facet wfacet1 = new MainValuesWFacet( | 144 Facet wfacet1 = new MainValuesWFacet( |
136 COMPUTED_DISCHARGE_MAINVALUES_W, | 145 COMPUTED_DISCHARGE_MAINVALUES_W, |
137 Resources.getMsg( | 146 Resources.getMsg( |
138 callMeta, | 147 callMeta, |
139 "facet.discharge_curves.mainvalues.w", | 148 "facet.discharge_curves.mainvalues.w", |
140 "facet.discharge_curves.mainvalues.w"), | 149 "facet.discharge_curves.mainvalues.w"), |
141 false); | 150 false); |
142 Facet wfacet2 = new MainValuesWFacet( | 151 Facet wfacet2 = new MainValuesWFacet( |
143 MAINVALUES_W, | 152 MAINVALUES_W, |
144 Resources.getMsg( | 153 Resources.getMsg( |
145 callMeta, | 154 callMeta, |
146 "facet.discharge_curves.mainvalues.w", | 155 "facet.discharge_curves.mainvalues.w", |
147 "facet.discharge_curves.mainvalues.w"), | 156 "facet.discharge_curves.mainvalues.w"), |
148 true); | 157 true); |
158 Facet wfacet3 = new MainValuesWFacet( | |
159 HISTORICAL_DISCHARGE_MAINVALUES_W, | |
160 Resources.getMsg( | |
161 callMeta, | |
162 "historical_discharge.mainvalues.w", | |
163 "historical_discharge.mainvalues.w"), | |
164 true); | |
149 fs.add(wfacet1); | 165 fs.add(wfacet1); |
150 fs.add(wfacet2); | 166 fs.add(wfacet2); |
167 fs.add(wfacet3); | |
151 } | 168 } |
152 } | 169 } |
153 | 170 |
154 | 171 |
155 /** | 172 /** |
168 state.getOutputs().add(mainValuesOutput); | 185 state.getOutputs().add(mainValuesOutput); |
169 return state; | 186 return state; |
170 } | 187 } |
171 | 188 |
172 | 189 |
190 /** Get important data from the 'calling' artifact. */ | |
173 @Override | 191 @Override |
174 protected void initialize(Artifact artifact, Object context, CallMeta meta) { | 192 protected void initialize(Artifact artifact, Object context, CallMeta meta) { |
175 logger.debug("MainValuesArtifact.initialize"); | 193 logger.debug("MainValuesArtifact.initialize"); |
176 FLYSArtifact winfo = (FLYSArtifact) artifact; | 194 FLYSArtifact winfo = (FLYSArtifact) artifact; |
177 RangeAccess rangeAccess = new RangeAccess(winfo, null); | 195 RangeAccess rangeAccess = new RangeAccess(winfo, null); |
184 } | 202 } |
185 else { | 203 else { |
186 logger.error("No location for mainvalues given."); | 204 logger.error("No location for mainvalues given."); |
187 } | 205 } |
188 importData(winfo, "river"); | 206 importData(winfo, "river"); |
207 // In the case of DischargeWQCurves, there are no locations, but a gauge. | |
208 if (getDataAsString("ld_locations") == null) { | |
209 // TODO its a tad difficult to remodel Range/Gauge-Access to | |
210 // do this. | |
211 String refGaugeID = winfo.getDataAsString("reference_gauge"); | |
212 if (refGaugeID != null) { | |
213 Gauge g = Gauge.getGaugeByOfficialNumber(Integer.parseInt(refGaugeID)); | |
214 addData("ld_locations", new DefaultStateData("ld_locations", null, null, | |
215 String.valueOf(g.getStation()))); | |
216 } | |
217 else { | |
218 logger.error("MainValuesArtifact: No location/gauge."); | |
219 } | |
220 } | |
189 } | 221 } |
190 | 222 |
191 | 223 |
192 /** | 224 /** |
193 * Get a list containing the one and only State. | 225 * Get a list containing the one and only State. |