[Lada-commits] [PATCH 5 of 7] Set the previous status as active status
Wald Commits
scm-commit at wald.intevation.org
Wed Nov 18 15:40:12 CET 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1447857527 -3600
# Node ID dea5ed4b7fa403fc9ca0fa4e73ca7d63adaabec2
# Parent 7133f611492046ff2659191322322e5201b22b04
Set the previous status as active status.
diff -r 7133f6114920 -r dea5ed4b7fa4 src/main/java/de/intevation/lada/rest/StatusService.java
--- a/src/main/java/de/intevation/lada/rest/StatusService.java Wed Nov 18 15:38:18 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/StatusService.java Wed Nov 18 15:38:47 2015 +0100
@@ -327,7 +327,22 @@
Response response = defaultRepo.create(statusNew, "land");
LStatusProtokoll created = (LStatusProtokoll)response.getData();
- messung.setStatus(created.getId());
+ if (status.getStatusWert() == 0) {
+ QueryBuilder<LStatusProtokoll> lastFilter =
+ new QueryBuilder<LStatusProtokoll>(
+ defaultRepo.entityManager("land"),
+ LStatusProtokoll.class);
+
+ lastFilter.and("messungsId", status.getMessungsId());
+ lastFilter.orderBy("datum", false);
+ List<LStatusProtokoll> protos =
+ defaultRepo.filterPlain(lastFilter.getQuery(), "land");
+ messung.setStatus(protos.get(protos.size() - 3).getId());
+ }
+ else {
+ messung.setStatus(created.getId());
+ }
+
defaultRepo.update(messung, "land");
return authorization.filter(
More information about the Lada-commits
mailing list