Updated logs
This commit is contained in:
parent
ec30dd7f25
commit
d1e48b63f6
|
@ -111,7 +111,7 @@ public class FeatureParser {
|
||||||
table.setTitle(tableName);
|
table.setTitle(tableName);
|
||||||
try {
|
try {
|
||||||
log.debug("Trying to convert to "+WebFeatureTable.class.getName()+" the csvFile with headers: "+csvFile.getHeaderRow());
|
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<String> headers = csvFile.getHeaderRow().getListValues();
|
||||||
List<CSVRow> csvRows = csvFile.getValueRows();
|
List<CSVRow> csvRows = csvFile.getValueRows();
|
||||||
for (int i=0; i<csvRows.size(); i++) {
|
for (int i=0; i<csvRows.size(); i++) {
|
||||||
|
@ -123,7 +123,8 @@ public class FeatureParser {
|
||||||
}
|
}
|
||||||
table.addRow(row);
|
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) {
|
}catch (Exception e) {
|
||||||
log.error("Error on trasforming the "+CSVFile.class.getSimpleName()+" to "+WebFeatureTable.class.getSimpleName(),e);
|
log.error("Error on trasforming the "+CSVFile.class.getSimpleName()+" to "+WebFeatureTable.class.getSimpleName(),e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,23 +46,22 @@ public class WFSExporter {
|
||||||
public WFSExporter() {
|
public WFSExporter() {
|
||||||
|
|
||||||
WFSExporterSystemDir wfsSystemDir = new WFSExporterSystemDir();
|
WFSExporterSystemDir wfsSystemDir = new WFSExporterSystemDir();
|
||||||
FeatureExporterFileConfig toWFSFileConfig;
|
|
||||||
try {
|
try {
|
||||||
CSVReader toWFSExport = wfsSystemDir.getCSVFileConfig(WFS_TO.EXPORT);
|
CSVReader toWFSExport = wfsSystemDir.getCSVFileConfig(WFS_TO.EXPORT);
|
||||||
toWFSFileConfig = getConfig(toWFSExport);
|
FeatureExporterFileConfig toWFSExportFileConfig = getConfig(toWFSExport);
|
||||||
toWFSFileConfig.setWfsTo(WFS_TO.EXPORT);
|
toWFSExportFileConfig.setWfsTo(WFS_TO.EXPORT);
|
||||||
mapWFSConfig.put(WFS_TO.EXPORT, toWFSFileConfig);
|
mapWFSConfig.put(WFS_TO.EXPORT, toWFSExportFileConfig);
|
||||||
log.info("To WFS export file config has the map: "+toWFSFileConfig.getMap());
|
log.info("To WFS export file config has the map: "+toWFSExportFileConfig.getMap());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
log.error("Error on reading WFS config for "+WFS_TO.EXPORT, e);
|
log.error("Error on reading WFS config for "+WFS_TO.EXPORT, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CSVReader toWFSView = wfsSystemDir.getCSVFileConfig(WFS_TO.VIEW);
|
CSVReader toWFSView = wfsSystemDir.getCSVFileConfig(WFS_TO.VIEW);
|
||||||
toWFSFileConfig = getConfig(toWFSView);
|
FeatureExporterFileConfig toWFSViewFileConfig = getConfig(toWFSView);
|
||||||
toWFSFileConfig.setWfsTo(WFS_TO.VIEW);
|
toWFSViewFileConfig.setWfsTo(WFS_TO.VIEW);
|
||||||
mapWFSConfig.put(WFS_TO.VIEW, toWFSFileConfig);
|
mapWFSConfig.put(WFS_TO.VIEW, toWFSViewFileConfig);
|
||||||
log.info("To WFS view file config has the map: "+toWFSFileConfig.getMap());
|
log.info("To WFS view file config has the map: "+toWFSViewFileConfig.getMap());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
log.error("Error on reading WFS config for "+WFS_TO.VIEW, 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++) {
|
for (int i=0; i<features.length(); i++) {
|
||||||
final CSVRow row = new CSVRow();
|
final CSVRow row = new CSVRow();
|
||||||
//List<String> listValues = new ArrayList<String>();
|
|
||||||
JSONObject theFeature = ((JSONObject)features.get(i));
|
JSONObject theFeature = ((JSONObject)features.get(i));
|
||||||
log.debug("Building at index: "+i);
|
log.debug("Building at index: "+i);
|
||||||
log.trace("the feature: "+theFeature);
|
log.trace("the feature: "+theFeature);
|
||||||
|
@ -193,18 +191,22 @@ public class WFSExporter {
|
||||||
case geometry_type:
|
case geometry_type:
|
||||||
JSONObject geometry = theFeature.getJSONObject("geometry");
|
JSONObject geometry = theFeature.getJSONObject("geometry");
|
||||||
String typeValue = geometry.getString("type");
|
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);
|
row.addValue(typeValue);
|
||||||
break;
|
break;
|
||||||
case geometry_coordinates:
|
case geometry_coordinates:
|
||||||
JSONObject geometry2 = theFeature.getJSONObject("geometry");
|
JSONObject geometry2 = theFeature.getJSONObject("geometry");
|
||||||
JSONArray coordinates = geometry2.getJSONArray("coordinates");
|
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)) {
|
if(toViewExport.equals(WFS_TO.EXPORT)) {
|
||||||
//adding double quotes in case of export
|
//adding double quotes in case of export
|
||||||
toCoordinates = String.format("%s%s%s", JSONUtil.DOUBLE_QUOTES, coordinates.toString(), JSONUtil.DOUBLE_QUOTES);
|
toCoordinates = String.format("%s%s%s", JSONUtil.DOUBLE_QUOTES, toCoordinates, JSONUtil.DOUBLE_QUOTES);
|
||||||
}else {
|
|
||||||
toCoordinates = coordinates.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
row.addValue(toCoordinates);
|
row.addValue(toCoordinates);
|
||||||
|
@ -259,9 +261,10 @@ public class WFSExporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
tableFile.addValueRow(row);
|
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);
|
tableFile.setHeaderRow(headerRow);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue