diff --git a/src/main/java/org/gcube/application/geoportaldatamapper/Geoportal_JSON_Mapper.java b/src/main/java/org/gcube/application/geoportaldatamapper/Geoportal_JSON_Mapper.java index a249081..af8b3b6 100644 --- a/src/main/java/org/gcube/application/geoportaldatamapper/Geoportal_JSON_Mapper.java +++ b/src/main/java/org/gcube/application/geoportaldatamapper/Geoportal_JSON_Mapper.java @@ -134,7 +134,7 @@ public class Geoportal_JSON_Mapper { GcubeProfileDV gcubeProfileDV = gcubeProfileMetaForUCD.getGcubeProfile(); LOG.info("\n\n##### Creating the section: " + gcubeProfileDV.getSectionTitle()); - LOG.info("\n\nThe profile is: " + gcubeProfileDV); + LOG.debug("\n\nThe profile is: " + gcubeProfileDV); // Building JSON/section full PATH and section name String sectionJSONPath = ""; String parentPathFromProfile = gcubeProfileDV.getParentName() == null ? "" : gcubeProfileDV.getParentName(); @@ -248,14 +248,16 @@ public class Geoportal_JSON_Mapper { // Converting multiple values stored as array (e.g. [a,b,c]) in multiple // MetadataFieldWrapper // repeatable fields - LOG.debug("value " + theOBJFieldValue + " is instanceof Array"); + LOG.trace("converting value " + theOBJFieldValue); + LOG.trace("converting class " + theOBJFieldValue.getClass()); try { - JSONArray dataArray = new JSONArray(theOBJFieldValue + ""); LOG.debug("It is an Array"); - for (int j = 0; j < dataArray.length(); j++) { + List dataArray = (List) theOBJFieldValue; + //printList(dataArray); + for (int j = 0; j < dataArray.size(); j++) { List cloned = cloneList(Arrays.asList(metadataField)); MetadataFieldWrapper mfw = cloned.get(0); - mfw.setCurrentValue(dataArray.getString(j)); + mfw.setCurrentValue(dataArray.get(j)+""); // From the second repeated field settings // mandatory false and one instance @@ -323,6 +325,30 @@ public class Geoportal_JSON_Mapper { return projectEdit; } + + public static void printArrayValue(JSONArray dataArray) { + if(dataArray==null) + System.out.println("dataArray is null"); + + for (int i =0; i