[Lada-commits] [PATCH 3 of 3] Added probekommentar getById service

Wald Commits scm-commit at wald.intevation.org
Tue Feb 17 15:27:49 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1424183309 -3600
# Node ID d416f0a8277c58c75d5f20c065bf851ca9bf5b6c
# Parent  b4e6c5648644708d61f0fcaede92a4f661954fd3
Added probekommentar getById service.

diff -r b4e6c5648644 -r d416f0a8277c src/main/java/de/intevation/lada/rest/KommentarPService.java
--- a/src/main/java/de/intevation/lada/rest/KommentarPService.java	Tue Feb 17 15:27:52 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/KommentarPService.java	Tue Feb 17 15:28:29 2015 +0100
@@ -11,6 +11,7 @@
 import javax.inject.Inject;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
@@ -84,4 +85,26 @@
         builder.and("probeId", probeId);
         return defaultRepo.filter(builder.getQuery(), "land");
     }
+
+    /**
+     * Get a kommentarP object by id.
+     *
+     * @return Response object containing a single kommentarP.
+     */
+    @GET
+    @Path("/{id}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getById(
+        @Context HttpHeaders headers,
+        @PathParam("id") String id
+    ) {
+        if (!authentication.isAuthenticated(headers)) {
+            logger.debug("User is not authenticated!");
+            return new Response(false, 699, null);
+        }
+        return defaultRepo.getById(
+            LKommentarP.class,
+            Integer.valueOf(id),
+            "land");
+    }
 }


More information about the Lada-commits mailing list