Skip to content

Commit

Permalink
feat(ProjectMetadata): Add researchProjects field (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima authored Jan 13, 2025
1 parent 51cac64 commit c4a59e4
Showing 1 changed file with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class ProjectMetadataImpl implements ProjectMetadata, Serializable {
@Column(name = "tools", length = 32768, columnDefinition = "text")
@Getter
@Setter
private String tools; // text (blob) 2^15
private String tools; // text (blob) 2^15

@Column(name = "lesson_plan", length = 5120000, columnDefinition = "mediumtext")
@Getter
Expand Down Expand Up @@ -200,6 +200,10 @@ public class ProjectMetadataImpl implements ProjectMetadata, Serializable {
@Setter
private String navMode;

@Getter
@Setter
private String researchProjects;

public ProjectMetadataImpl() {
}

Expand Down Expand Up @@ -236,6 +240,12 @@ public void populateFromJSON(JSONObject metadataJSON) {
}
setAuthors(authors.toString());

JSONArray researchProjects = metadataJSON.optJSONArray("researchProjects");
if (researchProjects == null) {
researchProjects = new JSONArray();
}
setResearchProjects(researchProjects.toString());

JSONArray parentProjects = metadataJSON.optJSONArray("parentProjects");
if (parentProjects == null) {
parentProjects = new JSONArray();
Expand Down Expand Up @@ -372,7 +382,8 @@ public String getTechDetailsString() {
if (techReqs != null && !techReqs.equals("") && !techReqs.equals("null")) {
try {
JSONObject techReqsJSON = new JSONObject(techReqs);
if (techReqsJSON.has("java") && (techReqsJSON.getString("java").equals("checked") || techReqsJSON.getString("java").equals("true"))) {
if (techReqsJSON.has("java") && (techReqsJSON.getString("java").equals("checked")
|| techReqsJSON.getString("java").equals("true"))) {
techReqsAndDetailsStringBuf.append("Java");
}

Expand All @@ -383,14 +394,16 @@ public String getTechDetailsString() {
techReqsAndDetailsStringBuf.append("Flash");
}

if (techReqsJSON.has("quickTime") && (techReqsJSON.getString("quickTime").equals("checked") || techReqsJSON.getString("quickTime").equals("true"))) {
if (techReqsJSON.has("quickTime") && (techReqsJSON.getString("quickTime").equals("checked")
|| techReqsJSON.getString("quickTime").equals("true"))) {
if (techReqsAndDetailsStringBuf.length() != 0) {
techReqsAndDetailsStringBuf.append(", ");
}
techReqsAndDetailsStringBuf.append("QuickTime");
}

if (techReqsJSON.has("techDetails") && techReqsJSON.getString("techDetails") != null && !techReqsJSON.getString("techDetails").equals("")) {
if (techReqsJSON.has("techDetails") && techReqsJSON.getString("techDetails") != null
&& !techReqsJSON.getString("techDetails").equals("")) {
if (techReqsAndDetailsStringBuf.length() != 0) {
techReqsAndDetailsStringBuf.append(", ");
}
Expand Down Expand Up @@ -458,6 +471,14 @@ public String toJSONString() {
metadata.put("parentProjects", new JSONArray());
}

String researchProjectsString = metadata.getString("researchProjects");
if (researchProjectsString != null && researchProjectsString != "null") {
JSONArray researchProjectsJSON = new JSONArray(researchProjectsString);
metadata.put("researchProjects", researchProjectsJSON);
} else {
metadata.put("researchProjects", new JSONArray());
}

} catch (JSONException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit c4a59e4

Please sign in to comment.