Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ProjectMetadata): Add Research Projects field #284

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading