2020-01-28 16:53:59 +01:00
|
|
|
package eu.dnetlib.ariadneplus.elasticsearch.model;
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.JsonElement;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
public class AriadneGeoPoint {
|
|
|
|
private String lat;
|
|
|
|
private String lon;
|
|
|
|
|
|
|
|
public String getLat() {
|
|
|
|
return lat;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLat(String lat) {
|
|
|
|
this.lat = lat;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getLon() {
|
|
|
|
return lon;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLon(String lon) {
|
|
|
|
this.lon = lon;
|
|
|
|
}
|
|
|
|
|
|
|
|
public AriadneGeoPoint() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public static AriadneGeoPoint fromJson (String json){
|
|
|
|
return new Gson().fromJson(json, AriadneGeoPoint.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static AriadneGeoPoint fromRDFJson(JsonElement json){
|
|
|
|
AriadneGeoPoint agp = new AriadneGeoPoint();
|
|
|
|
for (Map.Entry<String, JsonElement> stringJsonElementEntry : json.getAsJsonObject().entrySet()) {
|
|
|
|
switch (stringJsonElementEntry.getKey()){
|
2020-06-10 19:39:53 +02:00
|
|
|
case "https://www.ariadne-infrastructure.eu/property/lat":
|
2020-01-28 16:53:59 +01:00
|
|
|
agp.setLat(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
|
|
break;
|
2020-06-10 19:39:53 +02:00
|
|
|
case "https://www.ariadne-infrastructure.eu/property/lon":
|
2020-01-28 16:53:59 +01:00
|
|
|
agp.setLon(stringJsonElementEntry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return agp;
|
|
|
|
}
|
|
|
|
}
|