Updated logs

This commit is contained in:
Francesco Mangiacrapa 2020-05-04 11:50:17 +02:00
parent ec30dd7f25
commit d1e48b63f6
2 changed files with 21 additions and 17 deletions

View File

@ -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<String> headers = csvFile.getHeaderRow().getListValues();
List<CSVRow> csvRows = csvFile.getValueRows();
for (int i=0; i<csvRows.size(); i++) {
@ -123,7 +123,8 @@ public class FeatureParser {
}
table.addRow(row);
}
log.debug("Returning table: "+table);
log.debug("Returning table with column names: "+table.getColumnNames()+". They are: "+table.getColumnNames().size());
log.debug("The table has "+table.getRows().size() + " rows");
}catch (Exception e) {
log.error("Error on trasforming the "+CSVFile.class.getSimpleName()+" to "+WebFeatureTable.class.getSimpleName(),e);
}

View File

@ -46,23 +46,22 @@ public class WFSExporter {
public WFSExporter() {
WFSExporterSystemDir wfsSystemDir = new WFSExporterSystemDir();
FeatureExporterFileConfig toWFSFileConfig;
try {
CSVReader toWFSExport = wfsSystemDir.getCSVFileConfig(WFS_TO.EXPORT);
toWFSFileConfig = getConfig(toWFSExport);
toWFSFileConfig.setWfsTo(WFS_TO.EXPORT);
mapWFSConfig.put(WFS_TO.EXPORT, toWFSFileConfig);
log.info("To WFS export file config has the map: "+toWFSFileConfig.getMap());
FeatureExporterFileConfig toWFSExportFileConfig = getConfig(toWFSExport);
toWFSExportFileConfig.setWfsTo(WFS_TO.EXPORT);
mapWFSConfig.put(WFS_TO.EXPORT, toWFSExportFileConfig);
log.info("To WFS export file config has the map: "+toWFSExportFileConfig.getMap());
} catch (FileNotFoundException e) {
log.error("Error on reading WFS config for "+WFS_TO.EXPORT, e);
}
try {
CSVReader toWFSView = wfsSystemDir.getCSVFileConfig(WFS_TO.VIEW);
toWFSFileConfig = getConfig(toWFSView);
toWFSFileConfig.setWfsTo(WFS_TO.VIEW);
mapWFSConfig.put(WFS_TO.VIEW, toWFSFileConfig);
log.info("To WFS view file config has the map: "+toWFSFileConfig.getMap());
FeatureExporterFileConfig toWFSViewFileConfig = getConfig(toWFSView);
toWFSViewFileConfig.setWfsTo(WFS_TO.VIEW);
mapWFSConfig.put(WFS_TO.VIEW, toWFSViewFileConfig);
log.info("To WFS view file config has the map: "+toWFSViewFileConfig.getMap());
} catch (FileNotFoundException e) {
log.error("Error on reading WFS config for "+WFS_TO.VIEW, e);
}
@ -184,7 +183,6 @@ public class WFSExporter {
for (int i=0; i<features.length(); i++) {
final CSVRow row = new CSVRow();
//List<String> listValues = new ArrayList<String>();
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);