diff --git a/Model/lib/rng/wdkModel.rng b/Model/lib/rng/wdkModel.rng
index 4b226cd9e4..aba16e5280 100644
--- a/Model/lib/rng/wdkModel.rng
+++ b/Model/lib/rng/wdkModel.rng
@@ -1383,6 +1383,7 @@
+
@@ -1400,6 +1401,15 @@
+
+
+
+
+
+
+
+
+
@@ -1430,12 +1440,7 @@
-
-
-
-
-
-
+
diff --git a/Model/src/main/java/org/gusdb/wdk/model/BuildTracking.java b/Model/src/main/java/org/gusdb/wdk/model/BuildTracking.java
new file mode 100644
index 0000000000..4e7178aeaa
--- /dev/null
+++ b/Model/src/main/java/org/gusdb/wdk/model/BuildTracking.java
@@ -0,0 +1,38 @@
+package org.gusdb.wdk.model;
+
+public interface BuildTracking {
+
+ WdkModel getWdkModel();
+
+ String getNewBuild();
+
+ void setNewBuild(String newBuild);
+
+ String getReviseBuild();
+
+ void setReviseBuild(String reviseBuild);
+
+ /**
+ * @return if the object is newly introduced in the current build
+ */
+ default boolean isNew() {
+ return buildMatches(getNewBuild());
+ }
+
+ /**
+ * @return if the object is revised in the current build
+ */
+ default boolean isRevised() {
+ return buildMatches(getReviseBuild());
+ }
+
+ default boolean buildMatches(String trackedBuild) {
+ String currentBuild = getWdkModel().getBuildNumber();
+ if (currentBuild == null)
+ return false; // current release is not set
+ else
+ return currentBuild.equals(trackedBuild);
+
+ }
+
+}
diff --git a/Model/src/main/java/org/gusdb/wdk/model/question/Question.java b/Model/src/main/java/org/gusdb/wdk/model/question/Question.java
index 335c9b4389..59d9d3a39b 100644
--- a/Model/src/main/java/org/gusdb/wdk/model/question/Question.java
+++ b/Model/src/main/java/org/gusdb/wdk/model/question/Question.java
@@ -20,6 +20,7 @@
import org.gusdb.fgputil.Named;
import org.gusdb.fgputil.Named.NamedObject;
import org.gusdb.fgputil.functional.Functions;
+import org.gusdb.wdk.model.BuildTracking;
import org.gusdb.wdk.model.Utilities;
import org.gusdb.wdk.model.WdkModel;
import org.gusdb.wdk.model.WdkModelBase;
@@ -65,7 +66,7 @@
* @version $Revision$ $Date: 2007-01-10 14:54:53 -0500 (Wed, 10 Jan
* 2007) $ $Author$
*/
-public class Question extends WdkModelBase implements AttributeFieldContainer, StepAnalysisContainer, NamedObject {
+public class Question extends WdkModelBase implements AttributeFieldContainer, StepAnalysisContainer, NamedObject, BuildTracking {
public static final String DYNAMIC_QUERY_SUFFIX = "_dynamic";
@@ -214,44 +215,26 @@ protected static String getInternalQuestionName(String prefix, RecordClass recor
return prefix + recordClass.getFullName().replace('.', '_');
}
+ @Override
public String getNewBuild() {
return _newBuild;
}
+ @Override
public void setNewBuild(String newBuild) {
_newBuild = newBuild;
}
+ @Override
public String getReviseBuild() {
return _reviseBuild;
}
+ @Override
public void setReviseBuild(String reviseBuild) {
_reviseBuild = reviseBuild;
}
- /**
- * @return if the question a newly introduced in the current build.
- */
- public boolean isNew() {
- String currentBuild = _wdkModel.getBuildNumber();
- if (currentBuild == null)
- return false; // current release is not set
- else
- return (currentBuild.equals(_newBuild));
- }
-
- /**
- * @return if the question is revised in the current build.
- */
- public boolean isRevised() {
- String currentBuild = _wdkModel.getBuildNumber();
- if (currentBuild == null)
- return false; // current release is not set
- else
- return (currentBuild.equals(_reviseBuild));
- }
-
public void addSuggestion(QuestionSuggestion suggestion) {
_suggestions.add(suggestion);
}
diff --git a/Model/src/main/java/org/gusdb/wdk/model/report/DynamicAttributeReporterReference.java b/Model/src/main/java/org/gusdb/wdk/model/report/DynamicAttributeReporterReference.java
index b6e501687a..3d03e0dbcc 100644
--- a/Model/src/main/java/org/gusdb/wdk/model/report/DynamicAttributeReporterReference.java
+++ b/Model/src/main/java/org/gusdb/wdk/model/report/DynamicAttributeReporterReference.java
@@ -98,9 +98,9 @@ public void setPluginProperties(String pluginProperties) throws WdkModelExceptio
public boolean hasAllDynamicFields() {
return (
getName() != null &&
- getDisplayName() != null &&
- getDescription() != null &&
- getImplementation() != null
+ getDisplayName() != null &&
+ //getDescription() != null && // description is allowed to be null
+ getImplementation() != null
);
}
@@ -109,7 +109,7 @@ public String getDynamicFieldsAsString() {
String propsPrint = properties == null ? null : prettyPrint(properties, FormatUtil.Style.MULTI_LINE);
return new StringBuilder("{").append(NL)
.append("name: ").append(getName()).append(NL)
- .append("displayName: ").append(getDisplayName()).append(NL)
+ .append("displayName: ").append(getDisplayName()).append(NL)
.append("description: ").append(getDescription()).append(NL)
.append("implementation: ").append(getImplementation()).append(NL)
.append("properties: ").append(propsPrint).append(NL)
diff --git a/Model/src/main/java/org/gusdb/wdk/model/report/ReporterRef.java b/Model/src/main/java/org/gusdb/wdk/model/report/ReporterRef.java
index 6252f1e344..40da13bc14 100644
--- a/Model/src/main/java/org/gusdb/wdk/model/report/ReporterRef.java
+++ b/Model/src/main/java/org/gusdb/wdk/model/report/ReporterRef.java
@@ -8,6 +8,7 @@
import java.util.Map;
import org.apache.log4j.Logger;
+import org.gusdb.wdk.model.BuildTracking;
import org.gusdb.wdk.model.RngAnnotations.RngOptional;
import org.gusdb.wdk.model.RngAnnotations.RngUndefined;
import org.gusdb.wdk.model.WdkModel;
@@ -24,7 +25,7 @@
* @author xingao
*
*/
-public class ReporterRef extends WdkModelBase implements ScopedField, PropertiesProvider {
+public class ReporterRef extends WdkModelBase implements ScopedField, PropertiesProvider, BuildTracking {
private static final Logger LOG = Logger.getLogger(ReporterRef.class);
@@ -37,6 +38,16 @@ public class ReporterRef extends WdkModelBase implements ScopedField, Properties
private List _propertyList = new ArrayList<>();
private Map _properties = new LinkedHashMap<>();
+ /**
+ * new build flag on what build this question is introduced.
+ */
+ private String _newBuild;
+
+ /**
+ * revise build flag on what build this question is revised.
+ */
+ private String _reviseBuild;
+
@Override
public WdkModel getWdkModel() {
return _wdkModel;
@@ -147,7 +158,29 @@ public void setDescription(WdkModelText description) {
}
public String getDescription() {
- return (_description == null ? _displayName : _description);
+ return _description;
+ }
+
+ @Override
+ public String getNewBuild() {
+ return _newBuild;
+ }
+
+ @Override
+ @RngOptional
+ public void setNewBuild(String newBuild) {
+ _newBuild = newBuild;
+ }
+
+ @Override
+ public String getReviseBuild() {
+ return _reviseBuild;
+ }
+
+ @Override
+ @RngOptional
+ public void setReviseBuild(String reviseBuild) {
+ _reviseBuild = reviseBuild;
}
public void addProperty(WdkModelText property) {
diff --git a/Service/doc/schema/wdk/includes/record-reporter.json b/Service/doc/schema/wdk/includes/record-reporter.json
index 725c2c04e8..2fc0b471b2 100644
--- a/Service/doc/schema/wdk/includes/record-reporter.json
+++ b/Service/doc/schema/wdk/includes/record-reporter.json
@@ -26,6 +26,12 @@
},
"type": {
"type": "string"
+ },
+ "newBuild": {
+ "type": "string"
+ },
+ "reviseBuild": {
+ "type": "string"
}
},
"required": [
diff --git a/Service/src/main/java/org/gusdb/wdk/service/formatter/RecordClassFormatter.java b/Service/src/main/java/org/gusdb/wdk/service/formatter/RecordClassFormatter.java
index f4cdab4701..6ffdb41b02 100644
--- a/Service/src/main/java/org/gusdb/wdk/service/formatter/RecordClassFormatter.java
+++ b/Service/src/main/java/org/gusdb/wdk/service/formatter/RecordClassFormatter.java
@@ -96,7 +96,9 @@ public static JSONArray getAnswerFormatsJson(Collection extends ReporterRef> r
.put(JsonKeys.DISPLAY_NAME, reporter.getDisplayName())
.put(JsonKeys.DESCRIPTION, reporter.getDescription())
.put(JsonKeys.IS_IN_REPORT, FieldScope.REPORT_MAKER.isFieldInScope(reporter))
- .put(JsonKeys.SCOPES, reporter.getScopesList());
+ .put(JsonKeys.SCOPES, reporter.getScopesList())
+ .put(JsonKeys.NEW_BUILD, reporter.getNewBuild())
+ .put(JsonKeys.REVISE_BUILD, reporter.getReviseBuild());
array.put(obj);
}
}