Mercurial > lada > lada-server
changeset 469:d416f0a8277c
Added probekommentar getById service.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 17 Feb 2015 15:28:29 +0100 |
parents | b4e6c5648644 |
children | 94b2c82cc110 |
files | src/main/java/de/intevation/lada/rest/KommentarPService.java |
diffstat | 1 files changed, 23 insertions(+), 0 deletions(-) [+] |
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"); + } }