[Lada-commits] [PATCH] Make ID for Messregime an integer

Wald Commits scm-commit at wald.intevation.org
Fri Jul 1 17:36:30 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1467387366 -7200
# Node ID ce1ec3cbde54ab023a71c43dc41b60a3a40af6b9
# Parent  ff07474b65e08c664583bf68df6971b3fdfadd7f
Make ID for Messregime an integer.

Using VARCHAR(1) has drawbacks such as an empty string being
a valid value.

diff -r ff07474b65e0 -r ce1ec3cbde54 db_schema/lada_data.sql
--- a/db_schema/lada_data.sql	Fri Jul 01 16:55:16 2016 +0200
+++ b/db_schema/lada_data.sql	Fri Jul 01 17:36:06 2016 +0200
@@ -30,7 +30,7 @@
 
 COPY probe (id, test, netzbetreiber_id, mst_id, labor_mst_id, hauptproben_nr, datenbasis_id, ba_id, probenart_id, media_desk, media, umw_id, probeentnahme_beginn, probeentnahme_ende, mittelungsdauer, letzte_aenderung, erzeuger_id, probe_nehmer_id, mp_kat, mpl_id, mpr_id, solldatum_beginn, solldatum_ende, tree_modified) FROM stdin;
 660	f	12	12020	12020	N0013KE12	2	1	1	D: 01 03 52 02 00 00 00 00 00 00 00	Schafkäse	N92	2012-01-26 11:30:00+01	\N	\N	2012-02-22 12:38:39	\N	784	1	\N	\N	2012-01-01 00:00:00	2012-01-31 21:59:59	2016-03-17 09:19:04.94469
-409	f	12	12010	12010	A0239MP12	2	U	1	D: 01 02 07 03 00 00 00 00 00 00 00	Magermilchpulver	N94	2012-03-15 11:00:00+01	\N	\N	2012-03-26 16:31:35	\N	1199	U	\N	\N	2012-03-01 00:00:00	2012-03-31 21:59:59	2016-03-17 09:19:04.94469
+409	f	12	12010	12010	A0239MP12	2	1	1	D: 01 02 07 03 00 00 00 00 00 00 00	Magermilchpulver	N94	2012-03-15 11:00:00+01	\N	\N	2012-03-26 16:31:35	\N	1199	U	\N	\N	2012-03-01 00:00:00	2012-03-31 21:59:59	2016-03-17 09:19:04.94469
 42	f	06	06010	06010	120109003	2	1	1	D: 01 03 26 03 04 02 00 00 00 00 00	Frischkäse Fettstufe auch mit Gewürzen/Kräutern	N91	2012-01-04 08:00:00+01	\N	\N	2012-01-23 08:48:21	\N	734	1	\N	\N	2012-01-01 00:00:00	2012-01-31 21:59:59	2016-03-17 09:19:04.94469
 313	f	11	11010	11010	122200001	2	1	1	D: 01 06 35 04 01 02 02 20 00 00 00	Suppenhuhn auch tiefgefroren	N54	2012-02-24 09:30:00+01	2012-02-24 09:30:00+01	\N	2012-03-01 13:35:02	\N	\N	1	\N	\N	2012-01-01 00:00:00	2012-12-31 21:59:59	2016-03-17 09:19:04.94469
 311	f	11	11010	11010	122100011	2	1	1	D: 01 06 40 04 01 02 02 11 00 00 00	Fleischteilstück Reh auch tiefgefroren	N56	2012-06-04 10:00:00+02	2012-06-04 10:00:00+02	\N	2012-06-18 08:47:25	\N	\N	1	\N	\N	2012-01-01 00:00:00	2012-06-30 21:59:59	2016-03-17 09:19:04.94469
diff -r ff07474b65e0 -r ce1ec3cbde54 db_schema/lada_schema.sql
--- a/db_schema/lada_schema.sql	Fri Jul 01 16:55:16 2016 +0200
+++ b/db_schema/lada_schema.sql	Fri Jul 01 17:36:06 2016 +0200
@@ -391,7 +391,7 @@
         REFERENCES stammdaten.mess_stelle,
     hauptproben_nr character varying(20),
     datenbasis_id smallint REFERENCES stammdaten.datenbasis,
-    ba_id character varying(1),
+    ba_id integer,
     probenart_id smallint NOT NULL REFERENCES stammdaten.probenart,
     media_desk character varying(100),
     media character varying(100),
@@ -573,7 +573,7 @@
     labor_mst_id character varying(5) NOT NULL
         REFERENCES stammdaten.mess_stelle,
     datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis,
-    ba_id character varying(1),
+    ba_id integer,
     gem_id character varying(8),
     ort_id integer NOT NULL REFERENCES stammdaten.ort,
     media_desk character varying(100),
diff -r ff07474b65e0 -r ce1ec3cbde54 src/main/java/de/intevation/lada/importer/laf/AttributeMapper.java
--- a/src/main/java/de/intevation/lada/importer/laf/AttributeMapper.java	Fri Jul 01 16:55:16 2016 +0200
+++ b/src/main/java/de/intevation/lada/importer/laf/AttributeMapper.java	Fri Jul 01 17:36:06 2016 +0200
@@ -129,7 +129,7 @@
         }
 
         if ("messprogramm_s".equals(key) && probe.getBaId() == null) {
-            probe.setBaId(value.toString());
+            probe.setBaId(Integer.valueOf(value.toString()));
         }
         else if ("messprogramm_s".equals(key) && probe.getBaId() != null){
             this.warnings.add(new ReportItem(key, value.toString(), 672));
diff -r ff07474b65e0 -r ce1ec3cbde54 src/main/java/de/intevation/lada/model/Probe.java
--- a/src/main/java/de/intevation/lada/model/Probe.java	Fri Jul 01 16:55:16 2016 +0200
+++ b/src/main/java/de/intevation/lada/model/Probe.java	Fri Jul 01 17:36:06 2016 +0200
@@ -32,7 +32,7 @@
     private Integer id;
 
     @Column(name="ba_id")
-    private String baId;
+    private Integer baId;
 
     @Column(name="datenbasis_id")
     private Integer datenbasisId;
@@ -81,11 +81,11 @@
         this.id = id;
     }
 
-    public String getBaId() {
+    public Integer getBaId() {
         return this.baId;
     }
 
-    public void setBaId(String baId) {
+    public void setBaId(Integer baId) {
         this.baId = baId;
     }
 
diff -r ff07474b65e0 -r ce1ec3cbde54 src/main/java/de/intevation/lada/model/land/Messprogramm.java
--- a/src/main/java/de/intevation/lada/model/land/Messprogramm.java	Fri Jul 01 16:55:16 2016 +0200
+++ b/src/main/java/de/intevation/lada/model/land/Messprogramm.java	Fri Jul 01 17:36:06 2016 +0200
@@ -32,7 +32,7 @@
     private Integer id;
 
     @Column(name="ba_id")
-    private String baId;
+    private Integer baId;
 
     @Column(name="datenbasis_id")
     private Integer datenbasisId;
@@ -102,11 +102,11 @@
         this.id = id;
     }
 
-    public String getBaId() {
+    public Integer getBaId() {
         return this.baId;
     }
 
-    public void setBaId(String baId) {
+    public void setBaId(Integer baId) {
         this.baId = baId;
     }
 


More information about the Lada-commits mailing list