Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java @ 631:a9af60c84dca
Small bugfixes in the WQ selection state.
flys-artifacts/trunk@1996 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 24 May 2011 13:24:24 +0000 |
parents | 929137ee8154 |
children | 627be3ca1ab6 |
comparison
equal
deleted
inserted
replaced
630:40d3039f85ac | 631:a9af60c84dca |
---|---|
269 | 269 |
270 protected boolean validateRange(Artifact artifact, CallContext context) | 270 protected boolean validateRange(Artifact artifact, CallContext context) |
271 throws IllegalArgumentException | 271 throws IllegalArgumentException |
272 { | 272 { |
273 logger.debug("WQSelect.validateRange"); | 273 logger.debug("WQSelect.validateRange"); |
274 | 274 FLYSArtifact flys = (FLYSArtifact) artifact; |
275 String mode = (String) data.get(WQ_MODE).getValue(); | 275 |
276 StateData data = flys.getData(WQ_MODE); | |
277 String mode = data != null ? (String) data.getValue() : null; | |
276 logger.debug("WQ Mode: " + mode); | 278 logger.debug("WQ Mode: " + mode); |
277 | 279 |
278 String fromStr = (String) data.get(WQ_FROM).getValue(); | 280 if (mode == null || mode.length() == 0) { |
279 String toStr = (String) data.get(WQ_TO).getValue(); | 281 throw new IllegalArgumentException("error_feed_invalid_wq_mode"); |
280 String stepStr = (String) data.get(WQ_STEP).getValue(); | 282 } |
283 | |
284 StateData dFrom = flys.getData(WQ_FROM); | |
285 StateData dTo = flys.getData(WQ_TO); | |
286 StateData dStep = flys.getData(WQ_STEP); | |
287 | |
288 String fromStr = dFrom != null ? (String) dFrom.getValue() : null; | |
289 String toStr = dTo != null ? (String) dTo.getValue() : null; | |
290 String stepStr = dStep != null ? (String) dStep.getValue() : null; | |
281 | 291 |
282 if (fromStr == null || toStr == null || stepStr == null) { | 292 if (fromStr == null || toStr == null || stepStr == null) { |
283 throw new IllegalArgumentException("error_empty_state"); | 293 throw new IllegalArgumentException("error_empty_state"); |
284 } | 294 } |
285 | 295 |
286 double from = Double.parseDouble(fromStr); | |
287 double to = Double.parseDouble(toStr); | |
288 double step = Double.parseDouble(stepStr); | |
289 | |
290 try { | 296 try { |
297 double from = Double.parseDouble(fromStr); | |
298 double to = Double.parseDouble(toStr); | |
299 double step = Double.parseDouble(stepStr); | |
300 | |
291 if (mode != null && mode.trim().toLowerCase().equals("w")) { | 301 if (mode != null && mode.trim().toLowerCase().equals("w")) { |
292 return validateW(artifact, context, from, to, step); | 302 return validateW(artifact, context, from, to, step); |
293 } | 303 } |
294 else if (mode != null && mode.trim().toLowerCase().equals("q")) { | 304 else if (mode != null && mode.trim().toLowerCase().equals("q")) { |
295 return validateQ(artifact, context, from, to, step); | 305 return validateQ(artifact, context, from, to, step); |