Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java @ 2015:61667c3a0003
Disabled default values in Artifact's DESCRIBE document - added a system property to re-enable those default values.
flys-artifacts/trunk@3468 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 19 Dec 2011 16:11:13 +0000 |
parents | 41ba2276d785 |
children | 19518116a49a |
comparison
equal
deleted
inserted
replaced
2014:b11793a3e7c7 | 2015:61667c3a0003 |
---|---|
38 */ | 38 */ |
39 public abstract class DefaultState extends AbstractState { | 39 public abstract class DefaultState extends AbstractState { |
40 | 40 |
41 /** The logger that is used in this class. */ | 41 /** The logger that is used in this class. */ |
42 private static Logger logger = Logger.getLogger(DefaultState.class); | 42 private static Logger logger = Logger.getLogger(DefaultState.class); |
43 | |
44 | |
45 /** Determines, if the DESCRIBE document should contain default values or | |
46 * not. */ | |
47 public static final boolean USE_DEFAULTS = | |
48 Boolean.getBoolean("flys.use.default.values"); | |
43 | 49 |
44 /** The three possible compute types. */ | 50 /** The three possible compute types. */ |
45 public static enum ComputeType { | 51 public static enum ComputeType { |
46 FEED, ADVANCE, INIT | 52 FEED, ADVANCE, INIT |
47 } | 53 } |
203 | 209 |
204 data = data != null ? data : getData(name); | 210 data = data != null ? data : getData(name); |
205 | 211 |
206 Element select = createData(creator, artifact, data, context); | 212 Element select = createData(creator, artifact, data, context); |
207 | 213 |
208 String defValue = (String) data.getValue(); | 214 if (USE_DEFAULTS) { |
209 String defDesc = null; | 215 String defValue = (String) data.getValue(); |
210 | 216 String defDesc = null; |
211 if (defValue != null && defValue.length() > 0) { | 217 |
212 defDesc = Resources.getMsg( | 218 if (defValue != null && defValue.length() > 0) { |
213 context.getMeta(), | 219 defDesc = Resources.getMsg( |
214 defValue, | 220 context.getMeta(), |
215 defValue); | 221 defValue, |
216 } | 222 defValue); |
217 | 223 } |
218 if (defValue != null && defDesc != null) { | 224 |
219 creator.addAttr(select, "defaultValue", defValue, true); | 225 if (defValue != null && defDesc != null) { |
220 creator.addAttr(select, "defaultLabel", defDesc, true); | 226 creator.addAttr(select, "defaultValue", defValue, true); |
227 creator.addAttr(select, "defaultLabel", defDesc, true); | |
228 } | |
221 } | 229 } |
222 | 230 |
223 Element choices = ProtocolUtils.createArtNode( | 231 Element choices = ProtocolUtils.createArtNode( |
224 creator, "choices", null, null); | 232 creator, "choices", null, null); |
225 | 233 |