From d1e48b63f6b738f36b5f06e3c8ae71910c3096d8 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 4 May 2020 11:50:17 +0200 Subject: [PATCH] Updated logs --- .../server/datafeature/FeatureParser.java | 5 +-- .../server/datafeature/wfs/WFSExporter.java | 33 ++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java b/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java index ca4d76c..42af337 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java +++ b/src/main/java/org/gcube/portlets/user/gisviewer/server/datafeature/FeatureParser.java @@ -111,7 +111,7 @@ public class FeatureParser { table.setTitle(tableName); try { log.debug("Trying to convert to "+WebFeatureTable.class.getName()+" the csvFile with headers: "+csvFile.getHeaderRow()); - log.trace("Rows are: "+csvFile.getValueRows()); + log.trace("Rows are: "+csvFile.getValueRows().size()); List headers = csvFile.getHeaderRow().getListValues(); List csvRows = csvFile.getValueRows(); for (int i=0; i listValues = new ArrayList(); JSONObject theFeature = ((JSONObject)features.get(i)); log.debug("Building at index: "+i); log.trace("the feature: "+theFeature); @@ -193,18 +191,22 @@ public class WFSExporter { case geometry_type: JSONObject geometry = theFeature.getJSONObject("geometry"); String typeValue = geometry.getString("type"); + //is a string, so adding double quotes in case of export + if(toViewExport.equals(WFS_TO.EXPORT)) { + //adding double quotes in case of export + typeValue = String.format("%s%s%s", JSONUtil.DOUBLE_QUOTES, typeValue, JSONUtil.DOUBLE_QUOTES); + } row.addValue(typeValue); break; case geometry_coordinates: JSONObject geometry2 = theFeature.getJSONObject("geometry"); JSONArray coordinates = geometry2.getJSONArray("coordinates"); - String toCoordinates = null; + String toCoordinates = coordinates.toString(); + //is a string, so adding double quotes in case of export if(toViewExport.equals(WFS_TO.EXPORT)) { //adding double quotes in case of export - toCoordinates = String.format("%s%s%s", JSONUtil.DOUBLE_QUOTES, coordinates.toString(), JSONUtil.DOUBLE_QUOTES); - }else { - toCoordinates = coordinates.toString(); + toCoordinates = String.format("%s%s%s", JSONUtil.DOUBLE_QUOTES, toCoordinates, JSONUtil.DOUBLE_QUOTES); } row.addValue(toCoordinates); @@ -259,9 +261,10 @@ public class WFSExporter { } tableFile.addValueRow(row); - log.info("Added row "+row+" to exported properties"); + log.info("Added row "+row+" to exported properties. Number of values: "+row.getListValues().size()); } + log.info("Added header row "+headerRow+". Number of values: "+headerRow.getListValues().size()); tableFile.setHeaderRow(headerRow);