[Lada-commits] [PATCH 1 of 2] Return correct response if update failed

Wald Commits scm-commit at wald.intevation.org
Tue May 24 15:23:13 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1464083177 -7200
# Node ID 2c927b3edb9703e2a4cfdc8242741f3e7439fad6
# Parent  c9b84bca3e3d7f11e508bc93a42b8e23d73c0ce5
Return correct response if update failed.

diff -r c9b84bca3e3d -r 2c927b3edb97 src/main/java/de/intevation/lada/rest/MessprogrammMmtService.java
--- a/src/main/java/de/intevation/lada/rest/MessprogrammMmtService.java	Mon May 23 15:49:30 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/MessprogrammMmtService.java	Tue May 24 11:46:17 2016 +0200
@@ -219,6 +219,9 @@
         }
         messprogrammmmt.setLetzteAenderung(new Timestamp(new Date().getTime()));
         Response response = defaultRepo.update(messprogrammmmt, "land");
+        if (!response.getSuccess()) {
+            return response;
+        }
         Response updated = defaultRepo.getById(
             MessprogrammMmt.class,
             ((MessprogrammMmt)response.getData()).getId(), "land");
diff -r c9b84bca3e3d -r 2c927b3edb97 src/main/java/de/intevation/lada/rest/MessprogrammService.java
--- a/src/main/java/de/intevation/lada/rest/MessprogrammService.java	Mon May 23 15:49:30 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/MessprogrammService.java	Tue May 24 11:46:17 2016 +0200
@@ -298,6 +298,9 @@
             messprogramm = factory.findUmweltId(messprogramm);
         }
         Response response = defaultRepo.update(messprogramm, "land");
+        if (!response.getSuccess()) {
+            return response;
+        }
         Response updated = defaultRepo.getById(
             Messprogramm.class,
             ((Messprogramm)response.getData()).getId(), "land");
diff -r c9b84bca3e3d -r 2c927b3edb97 src/main/java/de/intevation/lada/rest/MessungService.java
--- a/src/main/java/de/intevation/lada/rest/MessungService.java	Mon May 23 15:49:30 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/MessungService.java	Tue May 24 11:46:17 2016 +0200
@@ -378,6 +378,9 @@
             return response;
         }
         Response response = repository.update(messung, "land");
+        if (!response.getSuccess()) {
+            return response;
+        }
         Response updated = repository.getById(
             LMessung.class,
             ((LMessung)response.getData()).getId(), "land");
diff -r c9b84bca3e3d -r 2c927b3edb97 src/main/java/de/intevation/lada/rest/MesswertService.java
--- a/src/main/java/de/intevation/lada/rest/MesswertService.java	Mon May 23 15:49:30 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/MesswertService.java	Tue May 24 11:46:17 2016 +0200
@@ -332,6 +332,9 @@
         }
 
         Response response = defaultRepo.update(messwert, "land");
+        if (!response.getSuccess()) {
+            return response;
+        }
         Response updated = defaultRepo.getById(
             LMesswert.class,
             ((LMesswert)response.getData()).getId(), "land");
diff -r c9b84bca3e3d -r 2c927b3edb97 src/main/java/de/intevation/lada/rest/OrtService.java
--- a/src/main/java/de/intevation/lada/rest/OrtService.java	Mon May 23 15:49:30 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/OrtService.java	Tue May 24 11:46:17 2016 +0200
@@ -288,6 +288,9 @@
 
         ort.setLetzteAenderung(new Timestamp(new Date().getTime()));
         Response response = defaultRepo.update(ort, "land");
+        if (!response.getSuccess()) {
+            return response;
+        }
         Response updated = defaultRepo.getById(
             LOrtszuordnung.class,
             ((LOrtszuordnung)response.getData()).getId(), "land");
diff -r c9b84bca3e3d -r 2c927b3edb97 src/main/java/de/intevation/lada/rest/ProbeService.java
--- a/src/main/java/de/intevation/lada/rest/ProbeService.java	Mon May 23 15:49:30 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/ProbeService.java	Tue May 24 11:46:17 2016 +0200
@@ -446,6 +446,9 @@
             factory.findUmweltId(probe);
         }
         Response response = repository.update(probe, "land");
+        if (!response.getSuccess()) {
+            return response;
+        }
         Response updated = repository.getById(
             LProbe.class,
             ((LProbe)response.getData()).getId(), "land");
diff -r c9b84bca3e3d -r 2c927b3edb97 src/main/java/de/intevation/lada/rest/ZusatzwertService.java
--- a/src/main/java/de/intevation/lada/rest/ZusatzwertService.java	Mon May 23 15:49:30 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/ZusatzwertService.java	Tue May 24 11:46:17 2016 +0200
@@ -247,6 +247,9 @@
             return new Response(false, 697, null);
         }
         Response response = defaultRepo.update(zusatzwert, "land");
+        if (!response.getSuccess()) {
+            return response;
+        }
         Response updated = defaultRepo.getById(
             LZusatzWert.class,
             ((LZusatzWert)response.getData()).getId(), "land");


More information about the Lada-commits mailing list