Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/DGMSelect.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | af13ceeba52a |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
29 /** | 29 /** |
30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
31 */ | 31 */ |
32 public class DGMSelect extends DefaultState { | 32 public class DGMSelect extends DefaultState { |
33 | 33 |
34 private static final Logger logger = Logger.getLogger(DGMSelect.class); | 34 private static final Logger log = Logger.getLogger(DGMSelect.class); |
35 | 35 |
36 public static final String ERR_EMPTY = "error_no_dgm_selected"; | 36 public static final String ERR_EMPTY = "error_no_dgm_selected"; |
37 public static final String ERR_INVALID_DGM = "error_invalid_dgm_selected"; | 37 public static final String ERR_INVALID_DGM = "error_invalid_dgm_selected"; |
38 public static final String ERR_BAD_DGM_RANGE = "error_bad_dgm_range"; | 38 public static final String ERR_BAD_DGM_RANGE = "error_bad_dgm_range"; |
39 public static final String ERR_BAD_DGM_RIVER = "error_bad_dgm_river"; | 39 public static final String ERR_BAD_DGM_RIVER = "error_bad_dgm_river"; |
67 return dataElement; | 67 return dataElement; |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 public static String getLabel(CallContext cc, String value) { | 71 public static String getLabel(CallContext cc, String value) { |
72 logger.debug("Create label for value: " + value); | 72 log.debug("Create label for value: " + value); |
73 | 73 |
74 try { | 74 try { |
75 DGM dgm = DGM.getDGM(Integer.parseInt(value)); | 75 DGM dgm = DGM.getDGM(Integer.parseInt(value)); |
76 | 76 |
77 File file = new File(dgm.getPath()); | 77 File file = new File(dgm.getPath()); |
78 return file.getName(); | 78 return file.getName(); |
79 } | 79 } |
80 catch (NumberFormatException nfe) { | 80 catch (NumberFormatException nfe) { |
81 logger.warn("Cannot parse int value: '" + value + "'"); | 81 log.warn("Cannot parse int value: '" + value + "'"); |
82 } | 82 } |
83 | 83 |
84 return ""; | 84 return ""; |
85 } | 85 } |
86 | 86 |
134 Integer dgmId = flys.getDataAsInteger("dgm"); | 134 Integer dgmId = flys.getDataAsInteger("dgm"); |
135 if (dgmId == null) { | 135 if (dgmId == null) { |
136 throw new IllegalArgumentException(ERR_EMPTY); | 136 throw new IllegalArgumentException(ERR_EMPTY); |
137 } | 137 } |
138 | 138 |
139 logger.debug("Found selected dgm: '" + dgmId + "'"); | 139 log.debug("Found selected dgm: '" + dgmId + "'"); |
140 | 140 |
141 return DGM.getDGM(dgmId); | 141 return DGM.getDGM(dgmId); |
142 } | 142 } |
143 catch (NumberFormatException nfe) { | 143 catch (NumberFormatException nfe) { |
144 throw new IllegalArgumentException(ERR_INVALID_DGM); | 144 throw new IllegalArgumentException(ERR_INVALID_DGM); |