changeset 395:479728d36809

Allow reset of 'fertig'-flag.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 16 Dec 2013 11:22:56 +0100
parents b58050341040
children 6ba7630c7e52
files src/main/java/de/intevation/lada/rest/LMessungService.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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();
     }
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)