Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxState.java @ 796:a5526908f92f
Added javadoc in state package.
gnv-artifacts/trunk@878 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 01 Apr 2010 09:15:36 +0000 |
parents | c4156275c1e1 |
children | feae2f9d6c6f |
comparison
equal
deleted
inserted
replaced
795:cdade5005cba | 796:a5526908f92f |
---|---|
31 import org.w3c.dom.Document; | 31 import org.w3c.dom.Document; |
32 import org.w3c.dom.Element; | 32 import org.w3c.dom.Element; |
33 import org.w3c.dom.Node; | 33 import org.w3c.dom.Node; |
34 | 34 |
35 /** | 35 /** |
36 * This state handles input of a min and max value and validates the user input. | |
37 * The min value needs to be equal or smaller than the max value, otherwise the | |
38 * input results in an error. | |
39 * | |
36 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> | 40 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
37 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 41 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
38 */ | 42 */ |
39 public class MinMaxState extends StateBase { | 43 public class MinMaxState extends StateBase { |
40 | 44 |
49 public MinMaxState() { | 53 public MinMaxState() { |
50 super(); | 54 super(); |
51 } | 55 } |
52 | 56 |
53 /** | 57 /** |
54 * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection, | 58 * The objects returned by the database are searched for two fields with |
55 * java.lang.String) | 59 * 'MIN' and 'MAX' as names. These objects are stored and used to be |
60 * displayed in the gui to give the user an orientation of the range he is | |
61 * able to insert. | |
62 * | |
63 * @param uuid | |
64 * @return | |
56 */ | 65 */ |
57 @Override | 66 @Override |
58 protected List<Object> purifyResult( | 67 protected List<Object> purifyResult( |
59 Collection<Result> result, String uuid) | 68 Collection<Result> result, String uuid) |
60 { | 69 { |
75 return describeData; | 84 return describeData; |
76 } | 85 } |
77 | 86 |
78 | 87 |
79 /** | 88 /** |
80 * @see de.intevation.gnv.state.StateBase#feed(java.util.Collection, | 89 * @param context |
81 * java.lang.String) | 90 * @param uuid |
91 * @param inputData | |
92 * @return | |
93 * @throws StateException | |
82 */ | 94 */ |
83 @Override | 95 @Override |
96 @SuppressWarnings("static-access") | |
84 public Document feed( | 97 public Document feed( |
85 CallContext context, | 98 CallContext context, |
86 Collection<InputData> inputData, | 99 Collection<InputData> inputData, |
87 String uuid) | 100 String uuid) |
88 throws StateException { | 101 throws StateException { |
111 String msg = "Input data not expected here. Data will be ignored."; | 124 String msg = "Input data not expected here. Data will be ignored."; |
112 log.warn(msg); | 125 log.warn(msg); |
113 return feedFailure(msg); | 126 return feedFailure(msg); |
114 } | 127 } |
115 | 128 |
116 boolean valid = iv.isInputValid(value, type); | 129 @SuppressWarnings("static-access") |
130 boolean valid = InputValidator.isInputValid(value, type); | |
117 if (!valid) { | 131 if (!valid) { |
118 String msg = "Input is not valid for this state."; | 132 String msg = "Input is not valid for this state."; |
119 log.error(msg); | 133 log.error(msg); |
120 return feedFailure(msg); | 134 return feedFailure(msg); |
121 } | 135 } |
127 if (name.equals(MAXVALUEFIELDNAME)) { | 141 if (name.equals(MAXVALUEFIELDNAME)) { |
128 max = value; | 142 max = value; |
129 } | 143 } |
130 | 144 |
131 if (min != null && max != null) { | 145 if (min != null && max != null) { |
132 if (!iv.isInputValid((String) min, (String) max, type)) { | 146 if (!InputValidator.isInputValid((String) min, (String) max, type)) { |
133 String msg = "Input is not valid for this state."; | 147 String msg = "Input is not valid for this state."; |
134 log.error(msg); | 148 log.error(msg); |
135 return feedFailure(msg); | 149 return feedFailure(msg); |
136 } | 150 } |
137 } | 151 } |
146 | 160 |
147 return feedSuccess(); | 161 return feedSuccess(); |
148 } | 162 } |
149 | 163 |
150 | 164 |
165 /** | |
166 * | |
167 * @param artCreator | |
168 * @param creator | |
169 * @param document | |
170 * @param staticNode | |
171 * @param callMeta | |
172 */ | |
151 @Override | 173 @Override |
152 protected void appendToStaticNode( | 174 protected void appendToStaticNode( |
153 XMLUtils.ElementCreator artCreator, | 175 XMLUtils.ElementCreator artCreator, |
154 XMLUtils.ElementCreator creator, | 176 XMLUtils.ElementCreator creator, |
155 Document document, | 177 Document document, |
218 groupNode.appendChild(inputMaxNode); | 240 groupNode.appendChild(inputMaxNode); |
219 | 241 |
220 staticNode.appendChild(groupNode); | 242 staticNode.appendChild(groupNode); |
221 } | 243 } |
222 } | 244 } |
223 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: | 245 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |