removed guava
This commit is contained in:
parent
8e5ef77686
commit
c7811f29b6
|
@ -6,7 +6,11 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="src/main/resources"/>
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
|
11
pom.xml
11
pom.xml
|
@ -81,11 +81,12 @@
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<version>1.6.4</version>
|
<version>1.6.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>log4j</groupId>
|
<!-- <dependency> -->
|
||||||
<artifactId>log4j</artifactId>
|
<!-- <groupId>com.google.guava</groupId> -->
|
||||||
<version>1.2.16</version>
|
<!-- <artifactId>guava</artifactId> -->
|
||||||
</dependency>
|
<!-- <version>31.0.1-jre</version> -->
|
||||||
|
<!-- </dependency> -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|
|
@ -0,0 +1,165 @@
|
||||||
|
//package org.gcube.spatial.data.geoutility;
|
||||||
|
//
|
||||||
|
//import java.util.EnumSet;
|
||||||
|
//import java.util.Map;
|
||||||
|
//import java.util.stream.Stream;
|
||||||
|
//
|
||||||
|
//import org.gcube.spatial.data.geoutility.CustomerTable.Column;
|
||||||
|
//
|
||||||
|
//import com.google.common.base.Predicate;
|
||||||
|
//import com.google.common.collect.HashBasedTable;
|
||||||
|
//import com.google.common.collect.Maps;
|
||||||
|
//import com.google.common.collect.Table;
|
||||||
|
//
|
||||||
|
//public class CustomerTable {
|
||||||
|
//
|
||||||
|
// public enum Column {
|
||||||
|
// PARENT_LOCATION_ID, LOCATION_ID, LOCATION_TYPE, LOCATION_DEN;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private Table<Integer, Column, String> table = HashBasedTable.create();
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// return table.toString();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void createRow(String[] values) {
|
||||||
|
// if (Column.values().length != values.length) {
|
||||||
|
// throw new IllegalArgumentException();
|
||||||
|
// }
|
||||||
|
// Integer rowNum = table.rowKeySet().size() + 1;
|
||||||
|
// for (int i = 0; i < values.length; i++) {
|
||||||
|
// table.put(rowNum, Column.values()[i], values[i]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// private void query() {
|
||||||
|
//// // TODO Auto-generated method stub
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// public Table<Integer, Column, String> query(Predicate<Map<Column, String>> query) {
|
||||||
|
//// return query(query, allOf(Column.class));
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// public Table<Integer, Column, String> query(Predicate<Map<Column, String>> query, EnumSet<Column> columns) {
|
||||||
|
// Map<Integer, Map<Column, String>> filtered = Maps.filterValues(table.rowMap(), query);
|
||||||
|
// return createResultTable(filtered, columns);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private Table<Integer, Column, String> createResultTable(Map<Integer, Map<Column, String>> resultMap,
|
||||||
|
// final EnumSet<Column> columns) {
|
||||||
|
//
|
||||||
|
// int i = 0;
|
||||||
|
// Table<Integer, Column, String> result = HashBasedTable.create();
|
||||||
|
// for (Map<Column, String> row : resultMap.values()) {
|
||||||
|
// i++;
|
||||||
|
// for (Column column : row.keySet()) {
|
||||||
|
// if (columns.contains(column)) {
|
||||||
|
// result.put(i, column, row.get(column));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Stream<Map<Column, String>> filter(String column, String value) {
|
||||||
|
// Stream<Map<Column, String>> stream = table.rowMap().values().stream().filter(row -> {
|
||||||
|
// return row.get(column).contains(value);
|
||||||
|
// });
|
||||||
|
// return stream;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Table<Integer, Column, String> table() {
|
||||||
|
//
|
||||||
|
// return table;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//class EqualPredicate implements Predicate<Map<CustomerTable.Column, String>> {
|
||||||
|
//
|
||||||
|
// private Column column;
|
||||||
|
// private String value;
|
||||||
|
//
|
||||||
|
// public EqualPredicate(Column column, String value) {
|
||||||
|
// this.column = column;
|
||||||
|
// this.value = value;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean apply(Map<Column, String> input) {
|
||||||
|
// return input.get(column) != null && input.get(column).equals(value);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static EqualPredicate equal(Column column, String value) {
|
||||||
|
// return new EqualPredicate(column, value);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// StringBuilder builder = new StringBuilder();
|
||||||
|
// builder.append("EqualPredicate [column=");
|
||||||
|
// builder.append(column);
|
||||||
|
// builder.append(", value=");
|
||||||
|
// builder.append(value);
|
||||||
|
// builder.append("]");
|
||||||
|
// return builder.toString();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//class Location {
|
||||||
|
//
|
||||||
|
// String parentId;
|
||||||
|
// String id;
|
||||||
|
// String type;
|
||||||
|
// String name; // is denominazione
|
||||||
|
//
|
||||||
|
// public Location(String parentId, String id, String type, String name) {
|
||||||
|
// super();
|
||||||
|
// this.parentId = parentId;
|
||||||
|
// this.id = id;
|
||||||
|
// this.type = type;
|
||||||
|
// this.name = name;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getParentId() {
|
||||||
|
// return parentId;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getId() {
|
||||||
|
// return id;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getType() {
|
||||||
|
// return type;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getName() {
|
||||||
|
// return name;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// StringBuilder builder = new StringBuilder();
|
||||||
|
// builder.append("Location [parentId=");
|
||||||
|
// builder.append(parentId);
|
||||||
|
// builder.append(", id=");
|
||||||
|
// builder.append(id);
|
||||||
|
// builder.append(", type=");
|
||||||
|
// builder.append(type);
|
||||||
|
// builder.append(", name=");
|
||||||
|
// builder.append(name);
|
||||||
|
// builder.append("]");
|
||||||
|
// return builder.toString();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -3,17 +3,22 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.spatial.data.geoutility;
|
package org.gcube.spatial.data.geoutility;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//import org.gcube.spatial.data.geoutility.CustomerTable.Column;
|
||||||
import org.gcube.spatial.data.geoutility.shared.wfs.FeatureRow;
|
import org.gcube.spatial.data.geoutility.shared.wfs.FeatureRow;
|
||||||
import org.gcube.spatial.data.geoutility.shared.wfs.WFSParameter;
|
import org.gcube.spatial.data.geoutility.shared.wfs.WFSParameter;
|
||||||
import org.gcube.spatial.data.geoutility.wfs.FeatureParser;
|
import org.gcube.spatial.data.geoutility.wfs.FeatureParser;
|
||||||
import org.gcube.spatial.data.geoutility.wfs.WFSQueryBuilder;
|
import org.gcube.spatial.data.geoutility.wfs.WFSQueryBuilder;
|
||||||
import org.gcube.spatial.data.geoutility.wms.WmsUrlValidator;
|
import org.gcube.spatial.data.geoutility.wms.WmsUrlValidator;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
//import com.google.common.collect.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class GeoJUnitTest.
|
* The Class GeoJUnitTest.
|
||||||
*
|
*
|
||||||
|
@ -21,10 +26,13 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public class GeoJUnitTest {
|
public class GeoJUnitTest {
|
||||||
|
|
||||||
|
// CustomerTable tableReg = new CustomerTable();
|
||||||
|
// CustomerTable tableProv = new CustomerTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test get styles.
|
* Test get styles.
|
||||||
*/
|
*/
|
||||||
//@Test
|
// @Test
|
||||||
public void testGetStyles() {
|
public void testGetStyles() {
|
||||||
// String wmsRequest = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows?service=wms&version=1.1.0&request=GetMap&layers==IGG:area_temp_1000&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers&bbox=-85.5,-180.0,90.0,180.0";
|
// String wmsRequest = "http://repoigg.services.iit.cnr.it:8080/geoserver/IGG/ows?service=wms&version=1.1.0&request=GetMap&layers==IGG:area_temp_1000&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers&bbox=-85.5,-180.0,90.0,180.0";
|
||||||
// String wmsRequest = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto&bbox=-85.0,-180.0,85.0,180.0";
|
// String wmsRequest = "http://thredds-d-d4s.d4science.org/thredds/wms/public/netcdf/test20.nc?service=wms&version=1.3.0&request=GetMap&layers=analyzed_field&styles=&width=640&height=480&srs=EPSG:4326&CRS=EPSG:4326&format=image/png&COLORSCALERANGE=auto&bbox=-85.0,-180.0,85.0,180.0";
|
||||||
|
@ -78,16 +86,17 @@ public class GeoJUnitTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
/*@Before
|
||||||
public void testWFSRequest() {
|
public void fillRegioneProvinceComuniWFSRequest() {
|
||||||
|
|
||||||
String wfsEndPoint = "https://geoserver1.dev.d4science.org/geoserver/devvre/wfs";
|
String wfsEndPoint = "https://geoserver1.dev.d4science.org/geoserver/devvre/wfs";
|
||||||
try {
|
try {
|
||||||
//REGIONI
|
// REGIONI
|
||||||
String layerName = "devvre:Reg01012021_g_WGS84";
|
String layerName = "devvre:Reg01012021_g_WGS84";
|
||||||
List<String> propertyName = new ArrayList<String>();
|
List<String> propertyName = new ArrayList<String>();
|
||||||
propertyName.add("devvre:COD_REG");
|
propertyName.add("devvre:COD_REG");
|
||||||
propertyName.add("devvre:DEN_REG");
|
propertyName.add("devvre:DEN_REG");
|
||||||
//Querying list of Regioni
|
// Querying list of Regioni
|
||||||
WFSQueryBuilder queryBuilder = new WFSQueryBuilder();
|
WFSQueryBuilder queryBuilder = new WFSQueryBuilder();
|
||||||
queryBuilder.addParameter(WFSParameter.SERVICE, WFSParameter.SERVICE.getValue());
|
queryBuilder.addParameter(WFSParameter.SERVICE, WFSParameter.SERVICE.getValue());
|
||||||
queryBuilder.addParameter(WFSParameter.VERSION, "2.0.0");
|
queryBuilder.addParameter(WFSParameter.VERSION, "2.0.0");
|
||||||
|
@ -95,22 +104,27 @@ public class GeoJUnitTest {
|
||||||
queryBuilder.addParameter(WFSParameter.TYPENAME, layerName);
|
queryBuilder.addParameter(WFSParameter.TYPENAME, layerName);
|
||||||
queryBuilder.addParameter(WFSParameter.OUTPUTFORMAT, WFSParameter.OUTPUTFORMAT.getValue());
|
queryBuilder.addParameter(WFSParameter.OUTPUTFORMAT, WFSParameter.OUTPUTFORMAT.getValue());
|
||||||
queryBuilder.addParameter(WFSParameter.PROPERTYNAME, propertyName, ",");
|
queryBuilder.addParameter(WFSParameter.PROPERTYNAME, propertyName, ",");
|
||||||
|
System.out.println(queryBuilder.getQuery());
|
||||||
FeatureParser fp = new FeatureParser();
|
FeatureParser fp = new FeatureParser();
|
||||||
List<FeatureRow> rows = fp.getWFSFeatures(wfsEndPoint, queryBuilder);
|
List<FeatureRow> rows = fp.getWFSFeatures(wfsEndPoint, queryBuilder);
|
||||||
System.out.println("Regioni: ");
|
System.out.println("Regioni: ");
|
||||||
|
|
||||||
for (FeatureRow featureRow : rows) {
|
for (FeatureRow featureRow : rows) {
|
||||||
System.out.println(featureRow);
|
System.out.println(featureRow);
|
||||||
|
Map<String, List<String>> properties = featureRow.getMapProperties();
|
||||||
|
tableReg.createRow(new String[] { "", properties.get("COD_REG").get(0), "Regione",
|
||||||
|
properties.get("DEN_REG").get(0) });
|
||||||
}
|
}
|
||||||
|
System.out.println("Table regioni: " + tableReg);
|
||||||
|
|
||||||
//PROVINCE
|
// PROVINCE
|
||||||
layerName = "devvre:ProvCM01012021_g_WGS84";
|
layerName = "devvre:ProvCM01012021_g_WGS84";
|
||||||
propertyName = new ArrayList<String>();
|
propertyName = new ArrayList<String>();
|
||||||
propertyName.add("devvre:COD_REG");
|
propertyName.add("devvre:COD_REG");
|
||||||
propertyName.add("devvre:COD_PROV");
|
propertyName.add("devvre:COD_PROV");
|
||||||
propertyName.add("devvre:DEN_PROV");
|
propertyName.add("devvre:DEN_PROV");
|
||||||
propertyName.add("devvre:DEN_CM"); //è pieno per i capoluoghi di provincia
|
propertyName.add("devvre:DEN_CM"); // è pieno per i capoluoghi di provincia
|
||||||
|
|
||||||
queryBuilder = new WFSQueryBuilder();
|
queryBuilder = new WFSQueryBuilder();
|
||||||
queryBuilder.addParameter(WFSParameter.SERVICE, WFSParameter.SERVICE.getValue());
|
queryBuilder.addParameter(WFSParameter.SERVICE, WFSParameter.SERVICE.getValue());
|
||||||
queryBuilder.addParameter(WFSParameter.VERSION, "2.0.0");
|
queryBuilder.addParameter(WFSParameter.VERSION, "2.0.0");
|
||||||
|
@ -118,20 +132,169 @@ public class GeoJUnitTest {
|
||||||
queryBuilder.addParameter(WFSParameter.TYPENAME, layerName);
|
queryBuilder.addParameter(WFSParameter.TYPENAME, layerName);
|
||||||
queryBuilder.addParameter(WFSParameter.OUTPUTFORMAT, WFSParameter.OUTPUTFORMAT.getValue());
|
queryBuilder.addParameter(WFSParameter.OUTPUTFORMAT, WFSParameter.OUTPUTFORMAT.getValue());
|
||||||
queryBuilder.addParameter(WFSParameter.PROPERTYNAME, propertyName, ",");
|
queryBuilder.addParameter(WFSParameter.PROPERTYNAME, propertyName, ",");
|
||||||
queryBuilder.addParameter(WFSParameter.CQL_FILTER, URLEncoder.encode("devvre:COD_REG=9", "UTF-8"));
|
// queryBuilder.addParameter(WFSParameter.CQL_FILTER,
|
||||||
|
// URLEncoder.encode("devvre:COD_REG=9", "UTF-8"));
|
||||||
|
System.out.println(queryBuilder.getQuery());
|
||||||
fp = new FeatureParser();
|
fp = new FeatureParser();
|
||||||
rows = fp.getWFSFeatures(wfsEndPoint, queryBuilder);
|
rows = fp.getWFSFeatures(wfsEndPoint, queryBuilder);
|
||||||
|
|
||||||
System.out.println("PROVINCE: ");
|
System.out.println("PROVINCE: ");
|
||||||
for (FeatureRow featureRow : rows) {
|
for (FeatureRow featureRow : rows) {
|
||||||
System.out.println(featureRow);
|
System.out.println(featureRow);
|
||||||
}
|
Map<String, List<String>> properties = featureRow.getMapProperties();
|
||||||
|
String denProv = properties.get("DEN_PROV").get(0);
|
||||||
|
if (denProv == null || denProv.isEmpty() || denProv.equals("-")) {
|
||||||
|
denProv = properties.get("DEN_CM").get(0); // è un capoluogo di provincia
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println(queryBuilder.getQuery());
|
tableProv.createRow(new String[] { properties.get("COD_REG").get(0), properties.get("COD_PROV").get(0),
|
||||||
|
"Provincia", denProv });
|
||||||
|
}
|
||||||
|
|
||||||
|
// COMUNI
|
||||||
|
// layerName = "devvre:Com01012021_g_WGS84";
|
||||||
|
// propertyName = new ArrayList<String>();
|
||||||
|
// //propertyName.add("devvre:COD_REG");
|
||||||
|
// propertyName.add("devvre:COD_PROV");
|
||||||
|
// propertyName.add("devvre:COMUNE");
|
||||||
|
//
|
||||||
|
// queryBuilder = new WFSQueryBuilder();
|
||||||
|
// queryBuilder.addParameter(WFSParameter.SERVICE, WFSParameter.SERVICE.getValue());
|
||||||
|
// queryBuilder.addParameter(WFSParameter.VERSION, "2.0.0");
|
||||||
|
// queryBuilder.addParameter(WFSParameter.REQUEST, "GetFeature");
|
||||||
|
// queryBuilder.addParameter(WFSParameter.TYPENAME, layerName);
|
||||||
|
// queryBuilder.addParameter(WFSParameter.OUTPUTFORMAT, WFSParameter.OUTPUTFORMAT.getValue());
|
||||||
|
// queryBuilder.addParameter(WFSParameter.PROPERTYNAME, propertyName, ",");
|
||||||
|
// queryBuilder.addParameter(WFSParameter.CQL_FILTER, URLEncoder.encode("devvre:COD_PROV=9", "UTF-8"));
|
||||||
|
// System.out.println(queryBuilder.getQuery());
|
||||||
|
// fp = new FeatureParser();
|
||||||
|
// rows = fp.getWFSFeatures(wfsEndPoint, queryBuilder);
|
||||||
|
//
|
||||||
|
// System.out.println("COMUNI: ");
|
||||||
|
// for (FeatureRow featureRow : rows) {
|
||||||
|
// System.out.println(featureRow);
|
||||||
|
// Map<String, List<String>> properties = featureRow.getMapProperties();
|
||||||
|
// String denProv = properties.get("DEN_PROV").get(0);
|
||||||
|
// if(denProv==null || denProv.isEmpty()) {
|
||||||
|
// denProv = properties.get("DEN_CM").get(0); //è un capoluogo di provincia
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// tableProv.createRow(new String[] {properties.get("COD_REG").get(0),properties.get("COD_PROV").get(0),"Provincia",denProv});
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*@Test
|
||||||
|
public void testQueryTableRegioneProvince() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Table<Integer, Column, String> theTableProv = tableReg.table();
|
||||||
|
List<Location> locations = new ArrayList<Location>();
|
||||||
|
for (Integer tableRowId : theTableProv.rowKeySet()) {
|
||||||
|
Location location = rowToLocation(theTableProv, tableRowId);
|
||||||
|
locations.add(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Location Regioni: " + locations);
|
||||||
|
|
||||||
|
String regID = "9";
|
||||||
|
EqualPredicate equalPredicate = new EqualPredicate(Column.PARENT_LOCATION_ID, regID);
|
||||||
|
EnumSet<Column> returnColumn = EnumSet.of(Column.PARENT_LOCATION_ID, Column.LOCATION_ID,
|
||||||
|
Column.LOCATION_TYPE, Column.LOCATION_DEN);
|
||||||
|
|
||||||
|
Table<Integer, Column, String> tableResult = tableProv.query(equalPredicate, returnColumn);
|
||||||
|
|
||||||
|
List<Location> locationResult = new ArrayList<Location>();
|
||||||
|
for (Integer rowId : tableResult.rowKeySet()) {
|
||||||
|
Location location = rowToLocation(tableResult, rowId);
|
||||||
|
locationResult.add(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Query location for " + equalPredicate + ":");
|
||||||
|
System.out.println(locationResult);
|
||||||
|
|
||||||
|
//
|
||||||
|
// String valueType = "Regione";
|
||||||
|
// String regId = "9"; //Toscana
|
||||||
|
// Stream<Map<Column, String>> stream1 = tableReg.table().rowMap().values().stream().filter(row -> {
|
||||||
|
// return row.get(Column.LOCATION_TYPE) != null && row.get(Column.LOCATION_ID) !=null && row.get(Column.LOCATION_TYPE).equals(valueType) && row.get(Column.LOCATION_ID).equals(regId);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// EqualPredicate equalPredicate = new EqualPredicate(Column.LOCATION_ID, regId);
|
||||||
|
// stream1.forEach(s -> System.out.println(s));
|
||||||
|
// // Print the stream
|
||||||
|
// System.out.println("Query regione:" +tableReg.query(equalPredicate,returnColumn));
|
||||||
|
//
|
||||||
|
// CustomerTable tableProv = new CustomerTable();
|
||||||
|
//
|
||||||
|
// //PROVINCE
|
||||||
|
// layerName = "devvre:ProvCM01012021_g_WGS84";
|
||||||
|
// propertyName = new ArrayList<String>();
|
||||||
|
// propertyName.add("devvre:COD_REG");
|
||||||
|
// propertyName.add("devvre:COD_PROV");
|
||||||
|
// propertyName.add("devvre:DEN_PROV");
|
||||||
|
// propertyName.add("devvre:DEN_CM"); //è pieno per i capoluoghi di provincia
|
||||||
|
//
|
||||||
|
// queryBuilder = new WFSQueryBuilder();
|
||||||
|
// queryBuilder.addParameter(WFSParameter.SERVICE, WFSParameter.SERVICE.getValue());
|
||||||
|
// queryBuilder.addParameter(WFSParameter.VERSION, "2.0.0");
|
||||||
|
// queryBuilder.addParameter(WFSParameter.REQUEST, "GetFeature");
|
||||||
|
// queryBuilder.addParameter(WFSParameter.TYPENAME, layerName);
|
||||||
|
// queryBuilder.addParameter(WFSParameter.OUTPUTFORMAT, WFSParameter.OUTPUTFORMAT.getValue());
|
||||||
|
// queryBuilder.addParameter(WFSParameter.PROPERTYNAME, propertyName, ",");
|
||||||
|
// //queryBuilder.addParameter(WFSParameter.CQL_FILTER, URLEncoder.encode("devvre:COD_REG=9", "UTF-8"));
|
||||||
|
// fp = new FeatureParser();
|
||||||
|
// rows = fp.getWFSFeatures(wfsEndPoint, queryBuilder);
|
||||||
|
// System.out.println("PROVINCE: ");
|
||||||
|
// for (FeatureRow featureRow : rows) {
|
||||||
|
// //System.out.println(featureRow);
|
||||||
|
// Map<String, List<String>> properties = featureRow.getMapProperties();
|
||||||
|
// String denProv = properties.get("DEN_PROV").get(0);
|
||||||
|
// if(denProv==null || denProv.isEmpty()) {
|
||||||
|
// denProv = properties.get("DEN_CM").get(0); //è un capoluogo di provincia
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// tableProv.createRow(new String[] {properties.get("COD_REG").get(0),properties.get("COD_PROV").get(0),"Provincia",denProv});
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println("Table PROVINCE: "+tableProv);
|
||||||
|
//
|
||||||
|
// Table<Integer, Column, String> theTableProv = tableProv.table();
|
||||||
|
// List<Location> locationsProv = new ArrayList<Location>();
|
||||||
|
// for (Integer tableRowId : theTableProv.rowKeySet()) {
|
||||||
|
// Location location = rowToLocation(table, tableRowId);
|
||||||
|
// locationsProv.add(location);
|
||||||
|
// }
|
||||||
|
// System.out.println("Location Province: "+locationsProv);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// EqualPredicate ep = new EqualPredicate(Column.PARENT_LOCATION_ID,"5");
|
||||||
|
// Table<Integer, Column, String> provQuery = tableProv.query(ep, returnColumn);
|
||||||
|
// System.out.println("Query PROVINCIA: "+provQuery);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println(queryBuilder.getQuery());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public static Location rowToLocation(Table<Integer, Column, String> table, Integer rowId) {
|
||||||
|
Map<Column, String> column = table.row(rowId);
|
||||||
|
column.get(Column.PARENT_LOCATION_ID);
|
||||||
|
column.get(Column.LOCATION_ID);
|
||||||
|
column.get(Column.LOCATION_TYPE);
|
||||||
|
column.get(Column.LOCATION_DEN);
|
||||||
|
return new Location(column.get(Column.PARENT_LOCATION_ID), column.get(Column.LOCATION_ID),
|
||||||
|
column.get(Column.LOCATION_TYPE), column.get(Column.LOCATION_DEN));
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue