[Lada-commits] [PATCH 2 of 2] added autofill Mediadescription

Wald Commits scm-commit at wald.intevation.org
Wed Jul 15 14:25:06 CEST 2015


# HG changeset patch
# User Marco Lechner, Bundesamt fuer Strahlenschutz, SW 2.1 <mlechner at bfs.de>
# Date 1436962894 -7200
# Node ID e502e1af625676130be0e67362c142670385f95a
# Parent  e50c7f2f864d1fb1a565762a1c3ba828eeebaee4
added autofill Mediadescription

diff -r e50c7f2f864d -r e502e1af6256 src/main/java/de/intevation/lada/factory/ProbeFactory.java
--- 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(" ");
diff -r e50c7f2f864d -r e502e1af6256 src/main/java/de/intevation/lada/rest/ProbeService.java
--- 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();


More information about the Lada-commits mailing list