Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQAdapted.java @ 5867:59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 15:23:01 +0200 |
parents | 73da40528cf2 |
children | af13ceeba52a |
comparison
equal
deleted
inserted
replaced
5866:9a6741ccf6d4 | 5867:59ff03ff48f1 |
---|---|
30 import org.dive4elements.river.model.Gauge; | 30 import org.dive4elements.river.model.Gauge; |
31 import org.dive4elements.river.model.Range; | 31 import org.dive4elements.river.model.Range; |
32 import org.dive4elements.river.model.River; | 32 import org.dive4elements.river.model.River; |
33 import org.dive4elements.river.model.Wst; | 33 import org.dive4elements.river.model.Wst; |
34 | 34 |
35 import org.dive4elements.river.artifacts.FLYSArtifact; | 35 import org.dive4elements.river.artifacts.D4EArtifact; |
36 | 36 |
37 import org.dive4elements.river.artifacts.model.RangeWithValues; | 37 import org.dive4elements.river.artifacts.model.RangeWithValues; |
38 import org.dive4elements.river.artifacts.model.WstFactory; | 38 import org.dive4elements.river.artifacts.model.WstFactory; |
39 import org.dive4elements.river.utils.RiverUtils; | 39 import org.dive4elements.river.utils.RiverUtils; |
40 | 40 |
133 String name, | 133 String name, |
134 CallContext context) | 134 CallContext context) |
135 { | 135 { |
136 logger.debug("WQAdapted.createValueItems"); | 136 logger.debug("WQAdapted.createValueItems"); |
137 | 137 |
138 FLYSArtifact flysArtifact = (FLYSArtifact) artifact; | 138 D4EArtifact flysArtifact = (D4EArtifact) artifact; |
139 | 139 |
140 RangeAccess rangeAccess = new RangeAccess(flysArtifact, context); | 140 RangeAccess rangeAccess = new RangeAccess(flysArtifact, context); |
141 double[] dist = rangeAccess.getKmRange(); | 141 double[] dist = rangeAccess.getKmRange(); |
142 // TODO use Access to get River and gauges. | 142 // TODO use Access to get River and gauges. |
143 River river = RiverUtils.getRiver(flysArtifact); | 143 River river = RiverUtils.getRiver(flysArtifact); |
301 public boolean validate(Artifact artifact) | 301 public boolean validate(Artifact artifact) |
302 throws IllegalArgumentException | 302 throws IllegalArgumentException |
303 { | 303 { |
304 logger.debug("WQAdapted.validate"); | 304 logger.debug("WQAdapted.validate"); |
305 | 305 |
306 FLYSArtifact flys = (FLYSArtifact) artifact; | 306 D4EArtifact flys = (D4EArtifact) artifact; |
307 StateData data = getData(flys, FIELD_WQ_MODE); | 307 StateData data = getData(flys, FIELD_WQ_MODE); |
308 | 308 |
309 String mode = data != null ? (String) data.getValue() : null; | 309 String mode = data != null ? (String) data.getValue() : null; |
310 boolean isQ = mode != null | 310 boolean isQ = mode != null |
311 ? Boolean.valueOf(mode) | 311 ? Boolean.valueOf(mode) |
325 | 325 |
326 protected boolean validateW(Artifact artifact) | 326 protected boolean validateW(Artifact artifact) |
327 throws IllegalArgumentException | 327 throws IllegalArgumentException |
328 { | 328 { |
329 logger.debug("WQAdapted.validateW"); | 329 logger.debug("WQAdapted.validateW"); |
330 FLYSArtifact flys = (FLYSArtifact) artifact; | 330 D4EArtifact flys = (D4EArtifact) artifact; |
331 | 331 |
332 RangeWithValues[] rwvs = extractInput(getData(flys, "wq_values")); | 332 RangeWithValues[] rwvs = extractInput(getData(flys, "wq_values")); |
333 | 333 |
334 if (rwvs == null) { | 334 if (rwvs == null) { |
335 throw new IllegalArgumentException("error_missing_wq_data"); | 335 throw new IllegalArgumentException("error_missing_wq_data"); |
336 } | 336 } |
337 | 337 |
338 List<Gauge> gauges = RiverUtils.getGauges((FLYSArtifact) artifact); | 338 List<Gauge> gauges = RiverUtils.getGauges((D4EArtifact) artifact); |
339 | 339 |
340 for (Gauge gauge: gauges) { | 340 for (Gauge gauge: gauges) { |
341 Range range = gauge.getRange(); | 341 Range range = gauge.getRange(); |
342 double lower = range.getA().doubleValue(); | 342 double lower = range.getA().doubleValue(); |
343 double upper = range.getB().doubleValue(); | 343 double upper = range.getB().doubleValue(); |
355 | 355 |
356 protected boolean validateQ(Artifact artifact) | 356 protected boolean validateQ(Artifact artifact) |
357 throws IllegalArgumentException | 357 throws IllegalArgumentException |
358 { | 358 { |
359 logger.debug("WQAdapted.validateQ"); | 359 logger.debug("WQAdapted.validateQ"); |
360 FLYSArtifact flys = (FLYSArtifact) artifact; | 360 D4EArtifact flys = (D4EArtifact) artifact; |
361 | 361 |
362 RangeWithValues[] rwvs = extractInput(getData(flys, "wq_values")); | 362 RangeWithValues[] rwvs = extractInput(getData(flys, "wq_values")); |
363 | 363 |
364 if (rwvs == null) { | 364 if (rwvs == null) { |
365 throw new IllegalArgumentException("error_missing_wq_data"); | 365 throw new IllegalArgumentException("error_missing_wq_data"); |