changeset 1213:aed3332cfacc

An Ort always has a location which is created from respective input.
author Tom Gottfried <tom@intevation.de>
date Thu, 08 Dec 2016 14:47:21 +0100
parents 6f206d8eab7e
children 6e6134bf1d6d
files db_schema/stammdaten_schema.sql src/main/java/de/intevation/lada/rest/stamm/OrtService.java
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/db_schema/stammdaten_schema.sql	Thu Dec 08 14:30:35 2016 +0100
+++ b/db_schema/stammdaten_schema.sql	Thu Dec 08 14:47:21 2016 +0100
@@ -431,7 +431,7 @@
     koord_y_extern character varying(22) NOT NULL,
     hoehe_land real,
     letzte_aenderung timestamp without time zone DEFAULT now(),
-    geom public.geometry(Point,4326),
+    geom public.geometry(Point,4326) NOT NULL,
     shape public.geometry(MultiPolygon,4326),
     ort_typ smallint REFERENCES ort_typ,
     kurztext character varying(15) NOT NULL,
--- a/src/main/java/de/intevation/lada/rest/stamm/OrtService.java	Thu Dec 08 14:30:35 2016 +0100
+++ b/src/main/java/de/intevation/lada/rest/stamm/OrtService.java	Thu Dec 08 14:47:21 2016 +0100
@@ -25,6 +25,7 @@
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
 
+import de.intevation.lada.factory.OrtFactory;
 import de.intevation.lada.model.stammdaten.Filter;
 import de.intevation.lada.model.stammdaten.Ort;
 import de.intevation.lada.util.annotation.AuthorizationConfig;
@@ -90,6 +91,9 @@
     @AuthorizationConfig(type=AuthorizationType.HEADER)
     private Authorization authorization;
 
+    @Inject
+    private OrtFactory ortFactory;
+
     /**
      * Get all SOrt objects.
      * <p>
@@ -265,6 +269,7 @@
             repository.filterPlain(builder.getQuery(), "stamm");
         if (orte.isEmpty() ||
             orte.get(0).getId() == ort.getId()) {
+            ortFactory.transformCoordinates(ort);
             return repository.create(ort, "stamm");
         }
         return new Response(false, 672, null);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)