[Lada-commits] [PATCH 1 of 4] Changed query id from integer to String. Updated query 1 & 2

Wald Commits scm-commit at wald.intevation.org
Wed Feb 11 15:27:12 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1423664692 -3600
# Node ID 819747a8d037161ba32d38b548acd1d61a3f009a
# Parent  89a5dbeb5bd6510795f8d252a03f4bdf3b15b93e
Changed query id from integer to String. Updated query 1 & 2.

diff -r 89a5dbeb5bd6 -r 819747a8d037 src/main/java/de/intevation/lada/query/QueryConfig.java
--- a/src/main/java/de/intevation/lada/query/QueryConfig.java	Wed Feb 11 13:03:07 2015 +0100
+++ b/src/main/java/de/intevation/lada/query/QueryConfig.java	Wed Feb 11 15:24:52 2015 +0100
@@ -21,7 +21,7 @@
  */
 public class QueryConfig
 {
-    int id;
+    String id;
     String name;
     String description;
     String sql;
@@ -35,14 +35,14 @@
     /**
      * @return the id
      */
-    public int getId() {
+    public String getId() {
         return id;
     }
 
     /**
      * @param id the id to set
      */
-    public void setId(int id) {
+    public void setId(String id) {
         this.id = id;
     }
 
diff -r 89a5dbeb5bd6 -r 819747a8d037 src/main/java/de/intevation/lada/query/QueryTools.java
--- a/src/main/java/de/intevation/lada/query/QueryTools.java	Wed Feb 11 13:03:07 2015 +0100
+++ b/src/main/java/de/intevation/lada/query/QueryTools.java	Wed Feb 11 15:24:52 2015 +0100
@@ -69,7 +69,7 @@
             for (int i = 0; i < queries.size(); i++) {
                 JsonObject query = queries.getJsonObject(i);
                 QueryConfig qConf = new QueryConfig();
-                qConf.setId(query.getInt("id"));
+                qConf.setId(query.getString("id"));
                 qConf.setName(query.getString("name"));
                 qConf.setDescription(query.getString("description"));
                 qConf.setSql(query.getString("sql"));
diff -r 89a5dbeb5bd6 -r 819747a8d037 src/main/resources/queryconf.json
--- a/src/main/resources/queryconf.json	Wed Feb 11 13:03:07 2015 +0100
+++ b/src/main/resources/queryconf.json	Wed Feb 11 15:24:52 2015 +0100
@@ -1,8 +1,8 @@
 [
-{   "id": 1,
+{   "id": "1",
     "name": "Kein Filter",
     "description": "Abfrage der Proben ohne Filter",
-    "sql": "select probe_id, mst_id, umw_id from l_probe",
+    "sql": "select pt.probe_id_alt, mst_id, umw_id from probe join probe_translation pt on probe.id = pt.probe_id",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "mstId", "header": "MST", "width": 100},
@@ -11,10 +11,10 @@
     "filters": [
     ]
 },
-{   "id": 2,
+{   "id": "2",
     "name": "MST und UMW",
     "description": "Abfrage der Proben gefiltert nach Messtellen ID und ID des Umweltbereichs",
-    "sql": "select probe_id, mst_id, umw_id from l_probe where (mst_id = :mst_id OR '' = :mst_id) and (umw_id = :umw_id OR '' = :umw_id)",
+    "sql": "select pt.probe_id_alt, p.mst_id, p.umw_id from probe p join probe_translation pt on p.id = pt.probe_id where (p.mst_id = :mst_id OR '' = :mst_id) and (p.umw_id = :umw_id OR '' = :umw_id)",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "mstId", "header": "MST", "width": 100},
@@ -25,10 +25,10 @@
         {"dataIndex": "umw_id", "type": "listumw", "label": "Umweltbereich"}
     ]
 },
-{   "id": 3,
+{   "id": "3",
     "name": "Proben pro Land",
     "description": "Detailiertere Beschreibung der Abfrage",
-    "sql": "select probe_id, netzbetreiber_id, mst_id, umw_id, hauptproben_nr from l_probe where (netzbetreiber_id = :netz OR '' = :netz)",
+    "sql": "select probe_id, netzbetreiber_id, mst_id, umw_id, hauptproben_nr from probe where (netzbetreiber_id = :netz OR '' = :netz)",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "netzbetreiberId", "header": "Land", "width": 100},
@@ -40,10 +40,10 @@
         {"dataIndex": "netz", "type": "listnetz", "label": "Land"}
     ]
 },
-{   "id": 4,
+{   "id": "4",
     "name": "alle Proben mit Ort",
     "description": "alle Proben mit Entnahmeort",
-    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, lp.umw_id, lp.hauptproben_nr, ort.gem_id, s_verwaltungseinheit.bezeichnung from l_probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where l_ort.orts_typ = 'E' or l_ort.orts_typ is null",
+    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, lp.umw_id, lp.hauptproben_nr, ort.gem_id, s_verwaltungseinheit.bezeichnung from probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where l_ort.orts_typ = 'E' or l_ort.orts_typ is null",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "netzbetreiberId", "header": "Land", "width": 50},
@@ -56,10 +56,10 @@
     "filters": [
     ]
 },
-{   "id": 5,
+{   "id": "5",
     "name": "Proben pro Land und UMW (Multiselect)",
     "description": "Abfrage aller Proben gefiltert pro Land und Umweltbereich (mit Mehrfachauswahl)",
-    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, to_char(lp.probeentnahme_beginn,'YYYY-mm-dd HH24:MI') entnahme_von, to_char(lp.probeentnahme_ende,'YYYY-mm-dd HH24:MI') entnahme_bis, lp.umw_id, lp.hauptproben_nr, l_ort.orts_typ, ort.gem_id, s_verwaltungseinheit.bezeichnung from l_probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where (l_ort.orts_typ = 'E' or l_ort.orts_typ is null) and lp.netzbetreiber_id = :netz and (umw_id similar to (:umw_id) OR '' = :umw_id)",
+    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, to_char(lp.probeentnahme_beginn,'YYYY-mm-dd HH24:MI') entnahme_von, to_char(lp.probeentnahme_ende,'YYYY-mm-dd HH24:MI') entnahme_bis, lp.umw_id, lp.hauptproben_nr, l_ort.orts_typ, ort.gem_id, s_verwaltungseinheit.bezeichnung from probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where (l_ort.orts_typ = 'E' or l_ort.orts_typ is null) and lp.netzbetreiber_id = :netz and (umw_id similar to (:umw_id) OR '' = :umw_id)",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "netzbetreiberId", "header": "Land", "width": 50},
diff -r 89a5dbeb5bd6 -r 819747a8d037 src/test/resources/queryconf.json
--- a/src/test/resources/queryconf.json	Wed Feb 11 13:03:07 2015 +0100
+++ b/src/test/resources/queryconf.json	Wed Feb 11 15:24:52 2015 +0100
@@ -1,8 +1,8 @@
 [
-{   "id": 1,
+{   "id": "1",
     "name": "Kein Filter",
     "description": "Abfrage der Proben ohne Filter",
-    "sql": "select probe_id, mst_id, umw_id from l_probe",
+    "sql": "select pt.probe_id_alt, mst_id, umw_id from probe join probe_translation pt on probe.id = pt.probe_id",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "mstId", "header": "MST", "width": 100},
@@ -11,10 +11,10 @@
     "filters": [
     ]
 },
-{   "id": 2,
+{   "id": "2",
     "name": "MST und UMW",
     "description": "Abfrage der Proben gefiltert nach Messtellen ID und ID des Umweltbereichs",
-    "sql": "select probe_id, mst_id, umw_id from l_probe where (mst_id = :mst_id OR '' = :mst_id) and (umw_id = :umw_id OR '' = :umw_id)",
+    "sql": "select pt.probe_id_alt, p.mst_id, p.umw_id from probe p join probe_translation pt on p.id = pt.probe_id where (p.mst_id = :mst_id OR '' = :mst_id) and (p.umw_id = :umw_id OR '' = :umw_id)",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "mstId", "header": "MST", "width": 100},
@@ -25,10 +25,10 @@
         {"dataIndex": "umw_id", "type": "listumw", "label": "Umweltbereich"}
     ]
 },
-{   "id": 3,
+{   "id": "3",
     "name": "Proben pro Land",
     "description": "Detailiertere Beschreibung der Abfrage",
-    "sql": "select probe_id, netzbetreiber_id, mst_id, umw_id, hauptproben_nr from l_probe where (netzbetreiber_id = :netz OR '' = :netz)",
+    "sql": "select probe_id, netzbetreiber_id, mst_id, umw_id, hauptproben_nr from probe where (netzbetreiber_id = :netz OR '' = :netz)",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "netzbetreiberId", "header": "Land", "width": 100},
@@ -40,10 +40,10 @@
         {"dataIndex": "netz", "type": "listnetz", "label": "Land"}
     ]
 },
-{   "id": 4,
+{   "id": "4",
     "name": "alle Proben mit Ort",
     "description": "alle Proben mit Entnahmeort",
-    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, lp.umw_id, lp.hauptproben_nr, ort.gem_id, s_verwaltungseinheit.bezeichnung from l_probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where l_ort.orts_typ = 'E' or l_ort.orts_typ is null",
+    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, lp.umw_id, lp.hauptproben_nr, ort.gem_id, s_verwaltungseinheit.bezeichnung from probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where l_ort.orts_typ = 'E' or l_ort.orts_typ is null",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "netzbetreiberId", "header": "Land", "width": 50},
@@ -56,10 +56,10 @@
     "filters": [
     ]
 },
-{   "id": 5,
+{   "id": "5",
     "name": "Proben pro Land und UMW (Multiselect)",
     "description": "Abfrage aller Proben gefiltert pro Land und Umweltbereich (mit Mehrfachauswahl)",
-    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, to_char(lp.probeentnahme_beginn,'YYYY-mm-dd HH24:MI') entnahme_von, to_char(lp.probeentnahme_ende,'YYYY-mm-dd HH24:MI') entnahme_bis, lp.umw_id, lp.hauptproben_nr, l_ort.orts_typ, ort.gem_id, s_verwaltungseinheit.bezeichnung from l_probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where (l_ort.orts_typ = 'E' or l_ort.orts_typ is null) and lp.netzbetreiber_id = :netz and (umw_id similar to (:umw_id) OR '' = :umw_id)",
+    "sql": "select lp.probe_id, lp.netzbetreiber_id, lp.mst_id, to_char(lp.probeentnahme_beginn,'YYYY-mm-dd HH24:MI') entnahme_von, to_char(lp.probeentnahme_ende,'YYYY-mm-dd HH24:MI') entnahme_bis, lp.umw_id, lp.hauptproben_nr, l_ort.orts_typ, ort.gem_id, s_verwaltungseinheit.bezeichnung from probe left outer join l_ort on (lp.probe_id = l_ort.probe_id) left outer join ort on (l_ort.ort_id = ort.ort_id) left outer join s_verwaltungseinheit on (ort.gem_id = s_verwaltungseinheit.gem_id) where (l_ort.orts_typ = 'E' or l_ort.orts_typ is null) and lp.netzbetreiber_id = :netz and (umw_id similar to (:umw_id) OR '' = :umw_id)",
     "result": [
         {"dataIndex": "probeId", "header": "ProbeId", "width": 100},
         {"dataIndex": "netzbetreiberId", "header": "Land", "width": 50},


More information about the Lada-commits mailing list