diff --git a/dhp-workflows/dhp-usage-stats-update/src/main/java/eu/dnetlib/oa/graph/usagestats/export/SarcStats.java b/dhp-workflows/dhp-usage-stats-update/src/main/java/eu/dnetlib/oa/graph/usagestats/export/SarcStats.java index 4efa7a35a1..db7828a30a 100644 --- a/dhp-workflows/dhp-usage-stats-update/src/main/java/eu/dnetlib/oa/graph/usagestats/export/SarcStats.java +++ b/dhp-workflows/dhp-usage-stats-update/src/main/java/eu/dnetlib/oa/graph/usagestats/export/SarcStats.java @@ -192,7 +192,6 @@ public class SarcStats { * PrintWriter wr = new PrintWriter(new FileWriter("logs/" + simpleDateFormat.format(start.getTime()) + * ".json")); wr.print(text); wr.close(); */ - System.out.println("AAAAAAAAAAA text " + text); JSONParser parser = new JSONParser(); @@ -314,38 +313,37 @@ public class SarcStats { ConnectDB.getConnection().close(); } - + private void renameKeysRecursively(String delimiter, JSONArray givenJsonObj) throws Exception { - for (Object jjval : givenJsonObj) { - if (jjval instanceof JSONArray) - renameKeysRecursively(delimiter, (JSONArray) jjval); - else if (jjval instanceof JSONObject) - renameKeysRecursively(delimiter, (JSONObject) jjval); + for(Object jjval : givenJsonObj) { + if(jjval instanceof JSONArray) + renameKeysRecursively(delimiter, (JSONArray)jjval); + else if(jjval instanceof JSONObject) + renameKeysRecursively(delimiter, (JSONObject)jjval); // All other types of vals - else - ; + else; } } - + private void renameKeysRecursively(String delimiter, JSONObject givenJsonObj) throws Exception { Set jkeys = new HashSet(givenJsonObj.keySet()); for (String jkey : jkeys) { System.out.println("++++> " + jkey); - + String[] splitArray = jkey.split(delimiter); String newJkey = splitArray[splitArray.length - 1]; System.out.println("New jkey: " + jkey); - + Object jval = givenJsonObj.get(jkey); System.out.println("jval ===> " + jval.getClass().getName()); givenJsonObj.remove(jkey); givenJsonObj.put(newJkey, jval); - - if (jval instanceof JSONObject) - renameKeysRecursively(delimiter, (JSONObject) jval); - - if (jval instanceof JSONArray) { - renameKeysRecursively(delimiter, (JSONArray) jval); + + if(jval instanceof JSONObject) + renameKeysRecursively(delimiter, (JSONObject)jval); + + if(jval instanceof JSONArray) { + renameKeysRecursively(delimiter, (JSONArray)jval); } } }