[Lada-commits] [PATCH 1 of 2] Allow reset of 'fertig'-flag

Wald Commits scm-commit at wald.intevation.org
Mon Dec 16 11:23:49 CET 2013


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1387189376 -3600
# Node ID 479728d368092882266030f2165f7d43d1888bd3
# Parent  b580503410405d31eb59ad869305cc3d0c9ce714
Allow reset of 'fertig'-flag.

diff -r b58050341040 -r 479728d36809 src/main/java/de/intevation/lada/rest/LMessungService.java
--- a/src/main/java/de/intevation/lada/rest/LMessungService.java	Thu Dec 05 11:16:06 2013 +0100
+++ b/src/main/java/de/intevation/lada/rest/LMessungService.java	Mon Dec 16 11:22:56 2013 +0100
@@ -108,7 +108,7 @@
             String probeId = messung.getProbeId();
             int messungsId = messung.getId().getMessungsId();
             if (authentication.hasAccess(headers, probeId) &&
-                !isReadOnly(probeId, messungsId)) {
+                !isReadOnly(probeId, messungsId, messung)) {
                 return repository.update(messung);
             }
             return new Response(false, 698, new ArrayList<LMessung>());
@@ -151,7 +151,7 @@
         }
     }
 
-    private boolean isReadOnly(String probeId, Integer messungsId) {
+    private boolean isReadOnly(String probeId, Integer messungsId, LMessung messung) {
         QueryBuilder<LMessung> builder =
             new QueryBuilder<LMessung>(
                 repository.getEntityManager(),
@@ -166,6 +166,10 @@
         if (messungen.size() > 1) {
             return true;
         }
+
+        if (messungen.get(0).isFertig() && !messung.isFertig()) {
+        	return false;
+        }
         return messungen.get(0).isFertig();
     }
 


More information about the Lada-commits mailing list