Mercurial > lada > lada-server
changeset 452:819747a8d037
Changed query id from integer to String. Updated query 1 & 2.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 11 Feb 2015 15:24:52 +0100 |
parents | 89a5dbeb5bd6 |
children | 1d80d0c21a44 |
files | src/main/java/de/intevation/lada/query/QueryConfig.java src/main/java/de/intevation/lada/query/QueryTools.java src/main/resources/queryconf.json src/test/resources/queryconf.json |
diffstat | 4 files changed, 24 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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"));
--- 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},
--- 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},