[Lada-commits] [PATCH 03 of 10] Set default in data model instead of on generation of Probe objects

Wald Commits scm-commit at wald.intevation.org
Thu Sep 29 16:54:44 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1474650820 -7200
# Node ID a435b9fd1d85053938c6688284885fd76afd77d0
# Parent  0d0362fe761969251e578d42ef1393df4dc616f1
Set default in data model instead of on generation of Probe objects.

diff -r 0d0362fe7619 -r a435b9fd1d85 db_schema/lada_schema.sql
--- a/db_schema/lada_schema.sql	Fri Sep 23 18:47:17 2016 +0200
+++ b/db_schema/lada_schema.sql	Fri Sep 23 19:13:40 2016 +0200
@@ -582,7 +582,7 @@
     probenintervall character varying(2) NOT NULL,
     teilintervall_von integer NOT NULL,
     teilintervall_bis integer NOT NULL,
-    intervall_offset integer,
+    intervall_offset integer NOT NULL DEFAULT 0,
     gueltig_von integer NOT NULL CHECK(gueltig_von BETWEEN 0 AND 364),
     gueltig_bis integer NOT NULL CHECK(gueltig_bis BETWEEN 0 AND 364),
     probe_nehmer_id integer,
diff -r 0d0362fe7619 -r a435b9fd1d85 src/main/java/de/intevation/lada/factory/ProbeFactory.java
--- a/src/main/java/de/intevation/lada/factory/ProbeFactory.java	Fri Sep 23 18:47:17 2016 +0200
+++ b/src/main/java/de/intevation/lada/factory/ProbeFactory.java	Fri Sep 23 19:13:40 2016 +0200
@@ -161,8 +161,7 @@
         Calendar start,
         Calendar end
     ) {
-        int offset = messprogramm.getIntervallOffset() == null ?
-            0 : messprogramm.getIntervallOffset();
+        int offset = messprogramm.getIntervallOffset();
         int teilVon = messprogramm.getTeilintervallVon() - 1;
         int teilBis = messprogramm.getTeilintervallBis();
         int manualDuration = teilBis - teilVon;
@@ -204,8 +203,7 @@
         Calendar start,
         Calendar end
     ) {
-        int offset = messprogramm.getIntervallOffset() == null ?
-            0 : messprogramm.getIntervallOffset();
+        int offset = messprogramm.getIntervallOffset();
         int teilVon = messprogramm.getTeilintervallVon() - 1;
         int teilBis = messprogramm.getTeilintervallBis();
         int manualDuration = teilBis - teilVon;
@@ -247,8 +245,7 @@
         Calendar start,
         Calendar end
     ) {
-        int offset = messprogramm.getIntervallOffset() == null ?
-            0 : messprogramm.getIntervallOffset();
+        int offset = messprogramm.getIntervallOffset();
         int teilVon = messprogramm.getTeilintervallVon() - 1;
         int teilBis = messprogramm.getTeilintervallBis();
         int manualDuration = teilBis - teilVon;
@@ -291,8 +288,7 @@
         Calendar end,
         int days
     ) {
-        int offset = messprogramm.getIntervallOffset() == null ?
-            0 : messprogramm.getIntervallOffset();
+        int offset = messprogramm.getIntervallOffset();
         int startDay = start.get(Calendar.DAY_OF_YEAR) +
             messprogramm.getTeilintervallVon() - 1 + offset;
         int endDay = end.get(Calendar.DAY_OF_YEAR);
diff -r 0d0362fe7619 -r a435b9fd1d85 src/main/java/de/intevation/lada/model/land/Messprogramm.java
--- a/src/main/java/de/intevation/lada/model/land/Messprogramm.java	Fri Sep 23 18:47:17 2016 +0200
+++ b/src/main/java/de/intevation/lada/model/land/Messprogramm.java	Fri Sep 23 19:13:40 2016 +0200
@@ -33,6 +33,9 @@
         if (baId == null) {
             baId = 1;
         }
+        if (intervallOffset == null) {
+            intervallOffset = 0;
+        }
     }
 
     @Id


More information about the Lada-commits mailing list