changeset 81:8830934533b5

Set correct response when loading a probe.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 07 Jun 2013 14:29:27 +0200
parents 75d42f8063f8
children bd41680cc7d5
files src/main/java/de/intevation/lada/rest/LProbeService.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/LProbeService.java	Fri Jun 07 14:28:19 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/LProbeService.java	Fri Jun 07 14:29:27 2013 +0200
@@ -51,8 +51,15 @@
     @Path("/{id}")
     @Produces("text/json")
     public Response findById(@PathParam("id") String id) {
+        boolean success = true;
         LProbe item = repository.findById(LProbe.class, id);
-        return new Response(true, "200", item);
+        if (item == null) {
+            success = false;
+        }
+        Response response = new Response(success, repository.getGeneralError(), item);
+        response.setWarnings(repository.getWarnings());
+        response.setErrors(repository.getErrors());
+        return response;
     }
 
     /**
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)