[PATCH] (issue1755) Clarify how default mecahnism works and remove unused config value
Wald Commits
scm-commit at wald.intevation.org
Wed Mar 25 15:11:13 CET 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1427280096 -3600
# Node ID 054d1b57ae4a6dcf39f71430285f23ef36fd3feb
# Parent e7a2234e7c3faf00a543df9020643f95b945ecad
(issue1755) Clarify how default mecahnism works and remove unused config value.
diff -r e7a2234e7c3f -r 054d1b57ae4a artifacts/src/main/java/org/dive4elements/river/artifacts/states/DefaultState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DefaultState.java Wed Mar 25 11:25:28 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DefaultState.java Wed Mar 25 11:41:36 2015 +0100
@@ -48,11 +48,6 @@
private static Logger log = Logger.getLogger(DefaultState.class);
- /** Determines, if the DESCRIBE document should contain default values or
- * not. */
- public static final boolean USE_DEFAULTS =
- Boolean.getBoolean("flys.use.default.values");
-
/** The three possible compute types. */
public static enum ComputeType {
FEED, ADVANCE, INIT
@@ -207,30 +202,23 @@
/**
- * This method returns the default value and description for <i>data</i>.
- * Note, that this method returns the defaults only if <i>USE_DEFAULTS</i>
- * is set; otherwise, null is returned.
+ * This method returns the default value and label for <i>data</i>.
+ *
+ * Override this method in a subclass to set an appropiate default
+ * value.
+ * The default label can be ignored by the client (e.g. the gwt-client).
+ * but shall not be null.
+ *
+ * Example implementation:
+ * if (data != null && data.getName().equals("the_answer")) {
+ * return new String[] {"42", "the_answer"};
+ * }
+ *
* @param context The CallContext used for i18n.
* @param data The data objects that the defaults are for.
* @return a String[] with [default value, default label].
*/
protected String[] getDefaultsFor(CallContext context, StateData data) {
- if (USE_DEFAULTS) {
- String defValue = (String) data.getValue();
- String defDesc = null;
-
- if (defValue != null && defValue.length() > 0) {
- defDesc = Resources.getMsg(
- context.getMeta(),
- defValue,
- defValue);
- }
-
- if (defValue != null && defDesc != null) {
- return new String[] { defValue, defDesc };
- }
- }
-
return null;
}
More information about the Dive4Elements-commits
mailing list