changeset 403:0bc65c128530

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 08 Jan 2014 15:08:29 +0100
parents b9d8bcb49e4e (diff) 2cec94fcab05 (current diff)
children b6fcf49d75d5 c63281230bc3
files
diffstat 4 files changed, 39 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/config/import.json	Tue Jan 07 16:46:41 2014 +0100
+++ b/config/import.json	Wed Jan 08 15:08:29 2014 +0100
@@ -13,7 +13,7 @@
         "default": ""
     }, {
         "key": "datenbasis_s",
-        "regex": "[0-9]{2}",
+        "regex": "[0-9]{1,2}",
         "default": "00"
     }, {
         "key": "netzkennung",
@@ -108,6 +108,10 @@
         "regex": ".{1,100}",
         "default": ""
     }, {
+        "key": "medium",
+        "regex": ".{1,100}",
+        "default": ""
+    }, {
         "key": "rei_programmpunkt",
         "regex": ".{1,10}",
         "default": ""
@@ -142,7 +146,7 @@
         "default": ""
     }, {
         "key": "messzeit_sekunden",
-        "regex": "[0-9]{8}",
+        "regex": "[0-9]{1,8}",
         "default": ""
     }, {
         "key": "messmethode_c",
@@ -171,7 +175,11 @@
     }],
     "ort": [{
         "key": "ort_id",
-        "regex": "[0-9]{10}",
+        "regex": "[0-9]{1,10}",
+        "default": ""
+    }, {
+        "key": "ort_code",
+        "regex": ".{3,12}",
         "default": ""
     }, {
         "key": "ort_typ",
@@ -191,14 +199,14 @@
         "default": ""
     }, {
         "key": "ort_land_s",
-        "regex": "[0-9]{8}",
+        "regex": "[0-9]{1,8}",
         "default": ""
     }, {
         "key": "ort_netzbetreiber",
         "regex": ".{2}",
         "default": ""
     }, {
-        "key": "ort_gemeindeschlüssel",
+        "key": "ort_gemeindeschluessel",
         "regex": "[0-9]{8}",
         "default": ""
     }, {
@@ -227,7 +235,7 @@
         "default": ""
     }, {
         "key": "ort_nuts_code",
-        "regex": "[0-9]{10}",
+        "regex": ".{1,10}",
         "default": ""
     }, {
         "key": "ort_hoehe_land",
--- a/src/main/java/de/intevation/lada/data/exporter/LAFCreator.java	Tue Jan 07 16:46:41 2014 +0100
+++ b/src/main/java/de/intevation/lada/data/exporter/LAFCreator.java	Wed Jan 08 15:08:29 2014 +0100
@@ -227,9 +227,9 @@
                 new QueryBuilder<SKoordinatenArt>(
                     readonlyRepo.getEntityManager(), SKoordinatenArt.class);
             String koord = "";
+            koord += "05 ";
             koord += ort.get(0).getLatitude() + " ";
-            koord += ort.get(0).getLongitude() + " ";
-            koord += "UTM (WGS84)";
+            koord += ort.get(0).getLongitude();
             //TODO: use table koordinatenart and koord*extern!
             laf += lafLine("ORT_KOORDINATEN_S", koord);
             laf += lafLine("ORT_GEMEINDESCHLUESSEL", ort.get(0).getGemId());
--- a/src/main/java/de/intevation/lada/data/importer/OrtCreator.java	Tue Jan 07 16:46:41 2014 +0100
+++ b/src/main/java/de/intevation/lada/data/importer/OrtCreator.java	Wed Jan 08 15:08:29 2014 +0100
@@ -337,7 +337,7 @@
         if ("ort_land_s".equals(key)) {
             this.setLandS(value.toString());
         }
-        if ("ort_gemeindeschlüssel".equals(key)) {
+        if ("ort_gemeindeschluessel".equals(key)) {
             this.setGemSchluessel(value.toString());
         }
         if ("ort_bezeichnung".equals(key)) {
@@ -371,8 +371,8 @@
             return null;
         }
         Ort ort = new Ort();
+        ortRepo.create(ort);
         this.ortId = ort.getOrtId();
-        ort.setBezeichnung("D_" + ort.getOrtId());
         boolean koord = true;
         if (this.koordinatenS != null && this.koordinatenS.length() > 0) {
             ort = setKoordinatenS(ort);
@@ -435,7 +435,10 @@
             ort.setNutsCode(list.get(0).getNuts());
         }
         ort.setBeschreibung(beschreibung);
-        ort.setHoeheLand(Float.valueOf(hoehe));
+        if (this.hoehe != null) {
+        	ort.setHoeheLand(Float.valueOf(hoehe));
+        }
+        ortRepo.update(ort);
         return ort;
     }
 
@@ -507,7 +510,7 @@
             QueryBuilder<SStaat> builder =
                 new QueryBuilder<SStaat>(
                     readonlyRepo.getEntityManager(), SStaat.class);
-            builder.and("staat_id", this.landS);
+            builder.and("staatId", this.landS);
             Response response = readonlyRepo.filter(builder.getQuery());
             List<SStaat> list = (List<SStaat>)response.getData();
             if (list.isEmpty()) {
@@ -515,7 +518,9 @@
                 return ort;
             }
             ort.setKoordXExtern(list.get(0).getKoordXExtern());
+            ort.setLongitude(Double.valueOf(list.get(0).getKoordXExtern()));
             ort.setKoordYExtern(list.get(0).getKoordYExtern());
+            ort.setLatitude(Double.valueOf(list.get(0).getKoordYExtern()));
         }
         return ort;
     }
@@ -629,24 +634,24 @@
         String x = "";
         String y = "";
         String tmp = "";
-        if (this.koordinaten.startsWith("\"")) {
-            tmp = this.koordinaten.substring(1);
+        if (this.koordinatenS.startsWith("\"")) {
+            tmp = this.koordinatenS.substring(1);
             art = tmp.substring(0, tmp.indexOf("\""));
             tmp = tmp.substring(tmp.indexOf("\"") + 2);
         }
         else {
-            art = this.koordinaten.substring(0, this.koordinaten.indexOf(" "));
-            tmp = this.koordinaten.substring(
-                0, this.koordinaten.indexOf(" ") + 1);
+            art = this.koordinatenS.substring(0, this.koordinatenS.indexOf(" "));
+            tmp = this.koordinatenS.substring(
+                this.koordinatenS.indexOf(" ") + 1);
         }
         if (tmp.startsWith("\"")) {
             tmp = tmp.substring(1);
             x = tmp.substring(0, tmp.indexOf("\""));
-            tmp = tmp.substring(0, tmp.indexOf("\"") + 2);
+            tmp = tmp.substring(tmp.indexOf("\"") + 2);
         }
         else {
             x = tmp.substring(0, tmp.indexOf(" "));
-            tmp = tmp.substring(0, tmp.indexOf(" ") + 1);
+            tmp = tmp.substring(tmp.indexOf(" ") + 1);
         }
         if (tmp.startsWith("\"")) {
             tmp = tmp.substring(1);
@@ -656,7 +661,9 @@
             y = tmp;
         }
         ort.setKoordXExtern(x);
+        ort.setLongitude(Double.valueOf(x));
         ort.setKoordYExtern(y);
+        ort.setLatitude(Double.valueOf(y));
         return ort;
     }
 
--- a/src/main/java/de/intevation/lada/validation/LOrtValidator.java	Tue Jan 07 16:46:41 2014 +0100
+++ b/src/main/java/de/intevation/lada/validation/LOrtValidator.java	Wed Jan 08 15:08:29 2014 +0100
@@ -71,7 +71,7 @@
      * @param warnings
      */
     private void validateVerwaltungseinheit(LOrt ort, Map<String, Integer> warnings) {
-        if (!ort.getOrtsTyp().equals("E")) {
+        if (!"E".equals(ort.getOrtsTyp())) {
             return;
         }
         QueryBuilder<Ort> ortBuilder =
@@ -84,6 +84,10 @@
                 readonlyRepo.getEntityManager(), SVerwaltungseinheit.class);
         veBuilder.and("gemId", orte.get(0).getGemId());
         Response ver = readonlyRepo.filter(veBuilder.getQuery());
+        if (((List<SVerwaltungseinheit>)ver.getData()).isEmpty()) {
+            warnings.put("verwaltungseinheit", 653);
+            return;
+        }
         SVerwaltungseinheit ve = ((List<SVerwaltungseinheit>)ver.getData()).get(0);
         QueryBuilder<DeVg> vg =
             new QueryBuilder<DeVg>(readonlyRepo.getEntityManager(), DeVg.class);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)