diff --git a/src/main/java/org/wise/portal/domain/project/impl/ProjectMetadataImpl.java b/src/main/java/org/wise/portal/domain/project/impl/ProjectMetadataImpl.java index 84dd36156..28445b1d3 100644 --- a/src/main/java/org/wise/portal/domain/project/impl/ProjectMetadataImpl.java +++ b/src/main/java/org/wise/portal/domain/project/impl/ProjectMetadataImpl.java @@ -204,6 +204,14 @@ public class ProjectMetadataImpl implements ProjectMetadata, Serializable { @Setter private String researchProjects; + @Getter + @Setter + private String resources; + + @Getter + @Setter + private String unitType; + public ProjectMetadataImpl() { } @@ -246,6 +254,12 @@ public void populateFromJSON(JSONObject metadataJSON) { } setResearchProjects(researchProjects.toString()); + JSONArray resources = metadataJSON.optJSONArray("resources"); + if (resources == null) { + resources = new JSONArray(); + } + setResources(resources.toString()); + JSONArray parentProjects = metadataJSON.optJSONArray("parentProjects"); if (parentProjects == null) { parentProjects = new JSONArray(); @@ -367,6 +381,8 @@ public void populateFromJSON(JSONObject metadataJSON) { postLevel = (long) 5; } setPostLevel(postLevel); + + setUnitType(metadataJSON.optString("unitType", "Platform")); } /** @@ -479,6 +495,13 @@ public String toJSONString() { metadata.put("researchProjects", new JSONArray()); } + String resourcesString = metadata.getString("resources"); + if (resourcesString != null && resourcesString != "null") { + JSONArray resourcesJSON = new JSONArray(resourcesString); + metadata.put("resources", resourcesJSON); + } else { + metadata.put("resources", new JSONArray()); + } } catch (JSONException e) { e.printStackTrace(); }