comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 689:f8ac04b2dbd0 facets-slt

Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact. flys-artifacts/branches/facets-slt@2129 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 16 Jun 2011 08:43:58 +0000
parents 06689035024c
children af393c5eb2c8
comparison
equal deleted inserted replaced
688:dc3613c4daf6 689:f8ac04b2dbd0
21 import de.intevation.artifacts.common.utils.XMLUtils; 21 import de.intevation.artifacts.common.utils.XMLUtils;
22 22
23 import de.intevation.flys.model.Gauge; 23 import de.intevation.flys.model.Gauge;
24 import de.intevation.flys.model.River; 24 import de.intevation.flys.model.River;
25 25
26 import de.intevation.flys.artifacts.states.CalculationSelect;
27 import de.intevation.flys.artifacts.states.DefaultState; 26 import de.intevation.flys.artifacts.states.DefaultState;
28 import de.intevation.flys.artifacts.context.FLYSContext; 27 import de.intevation.flys.artifacts.context.FLYSContext;
29 28
30 import de.intevation.flys.artifacts.model.ComputeCallback; 29 import de.intevation.flys.artifacts.model.ComputeCallback;
31 import de.intevation.flys.artifacts.model.DischargeTables; 30 import de.intevation.flys.artifacts.model.DischargeTables;
244 // METHODS FOR RETRIEVING COMPUTED DATA FOR DIFFERENT CHART TYPES 243 // METHODS FOR RETRIEVING COMPUTED DATA FOR DIFFERENT CHART TYPES
245 // 244 //
246 245
247 246
248 /** 247 /**
249 * Dispatches the computation request to compute(CallContext context, String
250 * hash) with the current hash value of the artifact which is provided by
251 * hash().
252 *
253 * @param context The CallContext.
254 */
255 public Object compute(CallContext context) {
256 return compute(context, hash());
257 }
258
259
260 /**
261 * Dispatches computation requests to the current state which needs to
262 * implement a createComputeCallback(String hash, FLYSArtifact artifact)
263 * method.
264 *
265 * @param context The CallContext.
266 * @param hash The hash value which is used to fetch computed data from
267 * cache.
268 *
269 * @return the computed data.
270 */
271 public Object compute(CallContext context, String hash) {
272 String calc = (String) getData(CalculationSelect.FIELD_MODE).getValue();
273
274 DefaultState current = (DefaultState) getCurrentState(context);
275
276 ComputeCallback callback = current.createComputeCallback(hash(), this);
277
278 if (callback == null) {
279 logger.info("There is no data which needs to be computed.");
280 return null;
281 }
282
283 return compute(hash, callback);
284 }
285
286
287 /**
288 * Returns the data that is computed by a waterlevel computation. 248 * Returns the data that is computed by a waterlevel computation.
289 * 249 *
290 * @return an array of data triples that consist of W, Q and Kms. 250 * @return an array of data triples that consist of W, Q and Kms.
291 */ 251 */
292 public WQKms[] getWaterlevelData() 252 public WQKms[] getWaterlevelData()

http://dive4elements.wald.intevation.org