Mercurial > lada > lada-server
diff src/main/java/de/intevation/lada/rest/KommentarPService.java @ 469:d416f0a8277c
Added probekommentar getById service.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 17 Feb 2015 15:28:29 +0100 |
parents | e147de48162a |
children | 8d703ac5ad65 |
line wrap: on
line diff
--- 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"); + } }