Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java @ 222:3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Added the possibility to switch to an alternative Transition.
gnv-artifacts/trunk@284 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Thu, 05 Nov 2009 14:45:54 +0000 |
parents | 1b2fc94766c9 |
children | f1e7ddeef5bc |
comparison
equal
deleted
inserted
replaced
221:21152e1bf325 | 222:3e82b4f1c455 |
---|---|
20 public class InputValidator { | 20 public class InputValidator { |
21 /** | 21 /** |
22 * the logger, used to log exceptions and additonaly information | 22 * the logger, used to log exceptions and additonaly information |
23 */ | 23 */ |
24 private static Logger log = Logger.getLogger(InputValidator.class); | 24 private static Logger log = Logger.getLogger(InputValidator.class); |
25 | |
26 | |
27 public final static String NODATASELECTEDVALUE = "n/n"; | |
25 | 28 |
26 /** | 29 /** |
27 * Constructor | 30 * Constructor |
28 */ | 31 */ |
29 public InputValidator() { | 32 public InputValidator() { |
34 log.debug("InputValidator.isInputValid " + input + " " + type); | 37 log.debug("InputValidator.isInputValid " + input + " " + type); |
35 boolean returnValue = false; | 38 boolean returnValue = false; |
36 String[] values = input.split(","); | 39 String[] values = input.split(","); |
37 for (int i = 0; i < values.length; i++) { | 40 for (int i = 0; i < values.length; i++) { |
38 boolean valid; | 41 boolean valid; |
39 if ("Integer".equalsIgnoreCase(type)) { | 42 |
43 if (NODATASELECTEDVALUE.equals(values[i].trim())){ | |
44 valid = true; | |
45 } else if ("Integer".equalsIgnoreCase(type)) { | |
40 valid = GenericValidator.isInt(values[i].trim()); | 46 valid = GenericValidator.isInt(values[i].trim()); |
41 } else if ("Double".equalsIgnoreCase(type)) { | 47 } else if ("Double".equalsIgnoreCase(type)) { |
42 valid = GenericValidator.isDouble(values[i].trim()); | 48 valid = GenericValidator.isDouble(values[i].trim()); |
43 } else if ("String".equalsIgnoreCase(type)) { | 49 } else if ("String".equalsIgnoreCase(type)) { |
44 valid = GenericValidator.matchRegexp(values[i], "[a-zA-Z0-9]"); // TODO: | 50 valid = GenericValidator.matchRegexp(values[i], "[a-zA-Z0-9]"); // TODO: |