Mercurial > lada > lada-server
changeset 709:e502e1af6256
added autofill Mediadescription
author | Marco Lechner, Bundesamt fuer Strahlenschutz, SW 2.1 <mlechner@bfs.de> |
---|---|
date | Wed, 15 Jul 2015 14:21:34 +0200 |
parents | e50c7f2f864d |
children | 2ae27dde4823 |
files | src/main/java/de/intevation/lada/factory/ProbeFactory.java src/main/java/de/intevation/lada/rest/ProbeService.java |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/factory/ProbeFactory.java Wed Jul 15 14:17:02 2015 +0200 +++ b/src/main/java/de/intevation/lada/factory/ProbeFactory.java Wed Jul 15 14:21:34 2015 +0200 @@ -295,6 +295,15 @@ probe.setUmwId(findUmwelt(mediaDesk)); return probe; } + + public LProbe findMediaDesk(LProbe probe) { + probe.setMedia(repository + .queryFromString("SELECT get_media_from_media_desk( :mediaDesk );", "stamm") + .setParameter("mediaDesk", probe.getMediaDesk()) + .getSingleResult() + .toString()); + return probe; + } public Messprogramm findUmweltId(Messprogramm messprogramm) { String[] mediaDesk = messprogramm.getMediaDesk().split(" ");
--- a/src/main/java/de/intevation/lada/rest/ProbeService.java Wed Jul 15 14:17:02 2015 +0200 +++ b/src/main/java/de/intevation/lada/rest/ProbeService.java Wed Jul 15 14:21:34 2015 +0200 @@ -340,6 +340,9 @@ if (probe.getUmwId() == null || probe.getUmwId().equals("")) { probe = factory.findUmweltId(probe); } + if (probe.getMediaDesk() != null || probe.getMediaDesk().length() > 0) { + probe = factory.findMediaDesk(probe); + } /* Persist the new probe object*/ Response newProbe = defaultRepo.create(probe, "land"); LProbe ret = (LProbe)newProbe.getData();