Skip to content

Commit f6447ca

Browse files
Set and get locations metadata field
1 parent acfb7e2 commit f6447ca

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/java/org/wise/portal/domain/project/impl/ProjectMetadataImpl.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public class ProjectMetadataImpl implements ProjectMetadata, Serializable {
132132
@Setter
133133
private String lessonPlan;
134134

135+
@Getter
136+
@Setter
137+
private String locations;
138+
135139
@Getter
136140
@Setter
137141
private String standards;
@@ -333,6 +337,8 @@ public void populateFromJSON(JSONObject metadataJSON) {
333337
}
334338
setLessonPlan(lessonPlan);
335339

340+
setLocations(metadataJSON.optString("locations", "[]"));
341+
336342
String standards = metadataJSON.optString("standards", this.standardsDefault);
337343
setStandards(standards);
338344

@@ -469,6 +475,19 @@ public String toJSONString() {
469475
metadata.put("tools", new JSONObject());
470476
}
471477

478+
String locationsString = metadata.getString("locations");
479+
if (locationsString != null && locationsString != "null") {
480+
JSONArray locationsJSON;
481+
try {
482+
locationsJSON = new JSONArray(locationsString);
483+
} catch (JSONException e) {
484+
locationsJSON = new JSONArray();
485+
}
486+
metadata.put("locations", locationsJSON);
487+
} else {
488+
metadata.put("locations", new JSONArray());
489+
}
490+
472491
String standardsString = metadata.getString("standards");
473492
if (standardsString != null && standardsString != "null") {
474493
JSONObject standardsJSON;

0 commit comments

Comments
 (0)