Commit 95781d1f authored by Sebastian's avatar Sebastian

Bugfix: osm-Way abfragen (Danke Andrey)

parent 41eed0b8
......@@ -76,7 +76,7 @@ public class HibernateConfig {
hibernateProperties.setProperty("hibernate.dialect","org.hibernate.dialect.PostgreSQL94Dialect");
hibernateProperties.setProperty("hibernate.connection.driver_class","org.postgresql.Driver");
if(this.dev) {
hibernateProperties.setProperty("hibernate.hbm2ddl.auto","create");
hibernateProperties.setProperty("hibernate.hbm2ddl.auto","validate");
}else {
hibernateProperties.setProperty("hibernate.hbm2ddl.auto","validate");
}
......
......@@ -124,7 +124,7 @@ public class GeoElements {
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response getWayByOsmId(@PathParam("id") Long id) {
OsmReference element = osmRefService.getFirstOsmReferenceByOsmId(id,"node");
OsmReference element = osmRefService.getFirstOsmReferenceByOsmId(id,"way");
if(element == null) {
HashMap<String,String> map = new HashMap<String,String>();
map.put("error", "not found");
......@@ -168,11 +168,13 @@ public class GeoElements {
map.put("error", "parameter expected");
return Response.status(Status.BAD_REQUEST).entity(map).build();
}
if(kvpp.key == null || kvpp.key.isEmpty() || kvpp.value == null ||kvpp.value.isEmpty()) {
HashMap<String,String> map = new HashMap<String,String>();
map.put("error", "key and value may not be empty or null");
return Response.status(Status.BAD_REQUEST).entity(map).build();
}
for(KeyValuePair p : element.getTags()) {
if(p.getKey() == kvpp.key) {
HashMap<String,String> map = new HashMap<String,String>();
......@@ -180,10 +182,14 @@ public class GeoElements {
return Response.status(Status.CONFLICT).entity(map).build();
}
}
// parameter is valid and not attached already.
if(element.hasTag(kvpp.key)) {
HashMap<String,String> map = new HashMap<String,String>();
map.put("error", "tag exists. use PATCH to update.");
return Response.status(Status.CONFLICT).entity(map).build();
}
KeyValuePair kvp = new KeyValuePair();
kvp.setKey(kvpp.key);
kvp.setValue(kvpp.value);
kvp.setSource(kvpp.source);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment