Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/rest/MessungService.java @ 1034:61354a9fa58d schema-update
Make dynamic inserts on probe and messung objects to avoid 'not null'-constraint error.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 31 Aug 2016 15:50:54 +0200 |
parents | 1c41c7b8f7c2 |
children | f92c96efa976 |
comparison
equal
deleted
inserted
replaced
1033:812e0cace5ba | 1034:61354a9fa58d |
---|---|
291 } | 291 } |
292 | 292 |
293 /* Persist the new messung object*/ | 293 /* Persist the new messung object*/ |
294 Response response = repository.create(messung, "land"); | 294 Response response = repository.create(messung, "land"); |
295 Messung ret = (Messung)response.getData(); | 295 Messung ret = (Messung)response.getData(); |
296 Messung refreshed = repository.getByIdPlain(Messung.class, ret.getId(), "land"); | |
296 if(violation.hasWarnings()) { | 297 if(violation.hasWarnings()) { |
297 response.setWarnings(violation.getWarnings()); | 298 response.setWarnings(violation.getWarnings()); |
298 } | 299 } |
299 | 300 |
300 StatusProtokoll status = new StatusProtokoll(); | 301 StatusProtokoll status = new StatusProtokoll(); |
303 Probe probe = | 304 Probe probe = |
304 repository.getByIdPlain(Probe.class, ret.getProbeId(), "land"); | 305 repository.getByIdPlain(Probe.class, ret.getProbeId(), "land"); |
305 status.setMstId(probe.getMstId()); | 306 status.setMstId(probe.getMstId()); |
306 status.setStatusKombi(1); | 307 status.setStatusKombi(1); |
307 repository.create(status, "land"); | 308 repository.create(status, "land"); |
308 ret.setStatus(status.getId()); | 309 refreshed.setStatus(status.getId()); |
309 repository.update(ret, "land"); | 310 repository.update(refreshed, "land"); |
310 Response updated= | 311 Response updated= |
311 repository.getById(Messung.class, ret.getId(), "land"); | 312 repository.getById(Messung.class, refreshed.getId(), "land"); |
312 | 313 |
313 return authorization.filter( | 314 return authorization.filter( |
314 request, | 315 request, |
315 updated, | 316 updated, |
316 Messung.class); | 317 Messung.class); |