From 2d06feb27fc281059b7a38f17e84c9f8a5fe4dd8 Mon Sep 17 00:00:00 2001 From: Jeremy Myers Date: Thu, 11 Apr 2024 12:46:36 -0400 Subject: [PATCH] Add optional visibleHelpPosition attribute to params --- Model/lib/rng/wdkModel.rng | 6 ++++++ .../main/java/org/gusdb/wdk/core/api/JsonKeys.java | 1 + .../java/org/gusdb/wdk/model/query/param/Param.java | 11 +++++++++++ .../gusdb/wdk/model/query/param/ParamReference.java | 13 +++++++++++++ .../wdk/service/formatter/param/ParamFormatter.java | 1 + 5 files changed, 32 insertions(+) diff --git a/Model/lib/rng/wdkModel.rng b/Model/lib/rng/wdkModel.rng index 765a2da896..f5528beac9 100644 --- a/Model/lib/rng/wdkModel.rng +++ b/Model/lib/rng/wdkModel.rng @@ -288,6 +288,9 @@ + + + @@ -986,6 +989,9 @@ + + + diff --git a/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java b/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java index 2114bfe730..a87926997c 100644 --- a/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java +++ b/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java @@ -164,6 +164,7 @@ public class JsonKeys { public static final String PARSER = "parser"; public static final String ALLOW_EMPTY_VALUE = "allowEmptyValue"; public static final String VISIBLE_HELP = "visibleHelp"; + public static final String VISIBLE_HELP_POSITION = "visibleHelpPosition"; // dataset-related keys public static final String DEFAULT_ID_LIST = "defaultIdList"; diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/Param.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/Param.java index 974babae8b..1b66b09b4c 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/Param.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/Param.java @@ -127,6 +127,7 @@ protected abstract ParamValidity validateValue(PartiallyValidatedStableValues co // requested by PRISM, array will contain different values for different projects private List _visibleHelps; protected String _visibleHelp; + protected String _visibleHelpPosition; // both default value and empty values will be used to construct default raw value. these values themselves // are neither valid raw values nor stable values. See FIXME below in getInternalValue() @@ -191,6 +192,7 @@ public Param(Param param) { _prompt = param._prompt; _help = param._help; _visibleHelp = param._visibleHelp; + _visibleHelpPosition = param._visibleHelpPosition; _xmlDefaultValue = param._xmlDefaultValue; _sanityDefaultValue = param._sanityDefaultValue; _visible = param._visible; @@ -292,6 +294,14 @@ void setVisibleHelp(String visibleHelp) { _visibleHelp = visibleHelp; } + public void setVisibleHelpPosition(String visibleHelpPosition) { + _visibleHelpPosition = visibleHelpPosition; + } + + public String getVisibleHelpPosition() { + return _visibleHelpPosition; + } + /** * Sets and validates a default value assigned in the model XML * @@ -422,6 +432,7 @@ public String toString() { .append(" prompt='").append(_prompt).append("'").append(NL) .append(" help='").append(_help).append("'").append(NL) .append(" visibleHelp='").append(_visibleHelp).append("'").append(NL) + .append(" visibleHelpPosition='").append(_visibleHelpPosition).append("'").append(NL) .append(" xmlDefault='").append(_xmlDefaultValue).append("'").append(NL) .append(" sanityDefault='").append(_sanityDefaultValue).append("'").append(NL) .append(" readonly=").append(_readonly).append(NL) diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java index 95b9c310fe..42531668ef 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java @@ -71,6 +71,10 @@ public static Param resolveReference(WdkModel wdkModel, if (visibleHelp != null) param.setVisibleHelp(visibleHelp); + String visibleHelpPosition = paramRef.getVisibleHelpPosition(); + if (visibleHelpPosition != null) + param.setVisibleHelpPosition(visibleHelpPosition); + // set prompt if any String prompt = paramRef.getPrompt(); if (prompt != null) @@ -276,6 +280,7 @@ public static Param resolveReference(WdkModel wdkModel, private List _visibleHelps = new ArrayList(); private String _visibleHelp; + private String _visibleHelpPosition; // this property only applies to timestamp param. private Long _interval; @@ -570,6 +575,14 @@ public String getVisibleHelp() { return _visibleHelp; } + public void setVisibleHelpPosition(String visibleHelpPosition) { + _visibleHelpPosition = visibleHelpPosition; + } + + public String getVisibleHelpPosition() { + return _visibleHelpPosition; + } + public void setPrompt(String prompt) { _prompt = prompt; } diff --git a/Service/src/main/java/org/gusdb/wdk/service/formatter/param/ParamFormatter.java b/Service/src/main/java/org/gusdb/wdk/service/formatter/param/ParamFormatter.java index 16562aac1e..0768203177 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/formatter/param/ParamFormatter.java +++ b/Service/src/main/java/org/gusdb/wdk/service/formatter/param/ParamFormatter.java @@ -50,6 +50,7 @@ protected > JSONObject getBaseJson(D pJson.put(JsonKeys.IS_READ_ONLY, _param.isReadonly()); pJson.put(JsonKeys.ALLOW_EMPTY_VALUE, _param.isAllowEmpty()); pJson.put(JsonKeys.VISIBLE_HELP, _param.getVisibleHelp()); + pJson.put(JsonKeys.VISIBLE_HELP_POSITION, _param.getVisibleHelpPosition()); pJson.put(JsonKeys.DEPENDENT_PARAMS, new JSONArray( mapToList(_param.getDependentParams(), NamedObject::getName))); pJson.put(JsonKeys.INITIAL_DISPLAY_VALUE,