[Lada-commits] [PATCH] Set the new created status protocol at messung

Wald Commits scm-commit at wald.intevation.org
Tue Oct 27 10:29:27 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1445938170 -3600
# Node ID 214508fd95e7d92c33c65f4fd74735d23da1704a
# Parent  9f3029b5fc906a832e090feeaeb4c9fcef80b0a7
Set the new created status protocol at messung.

diff -r 9f3029b5fc90 -r 214508fd95e7 src/main/java/de/intevation/lada/rest/StatusService.java
--- a/src/main/java/de/intevation/lada/rest/StatusService.java	Tue Oct 27 09:59:21 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/StatusService.java	Tue Oct 27 10:29:30 2015 +0100
@@ -26,6 +26,7 @@
 import de.intevation.lada.lock.LockConfig;
 import de.intevation.lada.lock.LockType;
 import de.intevation.lada.lock.ObjectLocker;
+import de.intevation.lada.model.land.LMessung;
 import de.intevation.lada.model.land.LStatusProtokoll;
 import de.intevation.lada.util.annotation.AuthorizationConfig;
 import de.intevation.lada.util.annotation.RepositoryConfig;
@@ -191,10 +192,17 @@
         ) {
             return new Response(false, 699, null);
         }
+        Response response = defaultRepo.create(status, "land");
+        LStatusProtokoll created = (LStatusProtokoll)response.getData();
+        Response messungResponse = defaultRepo.getById(
+            LMessung.class, status.getMessungsId(), "land");
+        LMessung messung = (LMessung)messungResponse.getData();
+        messung.setStatus(created.getId());
+        defaultRepo.update(messung, "land");
         /* Persist the new object*/
         return authorization.filter(
             request,
-            defaultRepo.create(status, "land"),
+            response,
             LStatusProtokoll.class);
     }
 


More information about the Lada-commits mailing list