@@ -132,7 +132,6 @@ public class ProjectMetadataImpl implements ProjectMetadata, Serializable {
132132 @ Setter
133133 private String lessonPlan ;
134134
135- @ Column (name = "standards" , length = 5120000 , columnDefinition = "mediumtext" )
136135 @ Getter
137136 @ Setter
138137 private String standards ;
@@ -202,7 +201,17 @@ public class ProjectMetadataImpl implements ProjectMetadata, Serializable {
202201
203202 @ Getter
204203 @ Setter
205- private String researchProjects ;
204+ private String disciplines ;
205+
206+ @ Getter
207+ @ Setter
208+ private String resources ;
209+
210+ private String standardsDefault = "{\" commonCore\" : [], \" ngss\" : [], \" learningForJustice\" : []}" ;
211+
212+ @ Getter
213+ @ Setter
214+ private String unitType ;
206215
207216 public ProjectMetadataImpl () {
208217 }
@@ -240,11 +249,17 @@ public void populateFromJSON(JSONObject metadataJSON) {
240249 }
241250 setAuthors (authors .toString ());
242251
243- JSONArray researchProjects = metadataJSON .optJSONArray ("researchProjects" );
244- if (researchProjects == null ) {
245- researchProjects = new JSONArray ();
252+ JSONArray disciplines = metadataJSON .optJSONArray ("disciplines" );
253+ if (disciplines == null ) {
254+ disciplines = new JSONArray ();
255+ }
256+ setDisciplines (disciplines .toString ());
257+
258+ JSONArray resources = metadataJSON .optJSONArray ("resources" );
259+ if (resources == null ) {
260+ resources = new JSONArray ();
246261 }
247- setResearchProjects ( researchProjects .toString ());
262+ setResources ( resources .toString ());
248263
249264 JSONArray parentProjects = metadataJSON .optJSONArray ("parentProjects" );
250265 if (parentProjects == null ) {
@@ -318,10 +333,7 @@ public void populateFromJSON(JSONObject metadataJSON) {
318333 }
319334 setLessonPlan (lessonPlan );
320335
321- String standards = metadataJSON .optString ("standards" , "" );
322- if (standards .equals ("null" )) {
323- standards = "" ;
324- }
336+ String standards = metadataJSON .optString ("standards" , this .standardsDefault );
325337 setStandards (standards );
326338
327339 JSONObject standardsAddressed = metadataJSON .optJSONObject ("standardsAddressed" );
@@ -367,6 +379,8 @@ public void populateFromJSON(JSONObject metadataJSON) {
367379 postLevel = (long ) 5 ;
368380 }
369381 setPostLevel (postLevel );
382+
383+ setUnitType (metadataJSON .optString ("unitType" , "Platform" ));
370384 }
371385
372386 /**
@@ -455,12 +469,17 @@ public String toJSONString() {
455469 metadata .put ("tools" , new JSONObject ());
456470 }
457471
458- String standardsAddressedString = metadata .getString ("standardsAddressed" );
459- if (standardsAddressedString != null && standardsAddressedString != "null" ) {
460- JSONObject standardsAddressedJSON = new JSONObject (standardsAddressedString );
461- metadata .put ("standardsAddressed" , standardsAddressedJSON );
472+ String standardsString = metadata .getString ("standards" );
473+ if (standardsString != null && standardsString != "null" ) {
474+ JSONObject standardsJSON ;
475+ try {
476+ standardsJSON = new JSONObject (standardsString );
477+ } catch (JSONException e ) {
478+ standardsJSON = new JSONObject (standardsDefault );
479+ }
480+ metadata .put ("standards" , standardsJSON );
462481 } else {
463- metadata .put ("standardsAddressed " , new JSONObject ());
482+ metadata .put ("standards " , new JSONObject ());
464483 }
465484
466485 String parentProjectsString = metadata .getString ("parentProjects" );
@@ -471,14 +490,34 @@ public String toJSONString() {
471490 metadata .put ("parentProjects" , new JSONArray ());
472491 }
473492
474- String researchProjectsString = metadata .getString ("researchProjects " );
475- if (researchProjectsString != null && researchProjectsString != "null" ) {
476- JSONArray researchProjectsJSON = new JSONArray (researchProjectsString );
477- metadata .put ("researchProjects " , researchProjectsJSON );
493+ String disciplinesString = metadata .getString ("disciplines " );
494+ if (disciplinesString != null && disciplinesString != "null" ) {
495+ JSONArray disciplinesJSON = new JSONArray (disciplinesString );
496+ metadata .put ("disciplines " , disciplinesJSON );
478497 } else {
479- metadata .put ("researchProjects " , new JSONArray ());
498+ metadata .put ("disciplines " , new JSONArray ());
480499 }
481500
501+ String featuresString = metadata .getString ("features" );
502+ if (featuresString != null && featuresString != "null" ) {
503+ JSONArray featuresJSON ;
504+ try {
505+ featuresJSON = new JSONArray (featuresString );
506+ } catch (JSONException e ) {
507+ featuresJSON = new JSONArray ();
508+ }
509+ metadata .put ("features" , featuresJSON );
510+ } else {
511+ metadata .put ("features" , new JSONArray ());
512+ }
513+
514+ String resourcesString = metadata .getString ("resources" );
515+ if (resourcesString != null && resourcesString != "null" ) {
516+ JSONArray resourcesJSON = new JSONArray (resourcesString );
517+ metadata .put ("resources" , resourcesJSON );
518+ } else {
519+ metadata .put ("resources" , new JSONArray ());
520+ }
482521 } catch (JSONException e ) {
483522 e .printStackTrace ();
484523 }
0 commit comments