comparison 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
comparison
equal deleted inserted replaced
468:b4e6c5648644 469:d416f0a8277c
9 9
10 import javax.enterprise.context.RequestScoped; 10 import javax.enterprise.context.RequestScoped;
11 import javax.inject.Inject; 11 import javax.inject.Inject;
12 import javax.ws.rs.GET; 12 import javax.ws.rs.GET;
13 import javax.ws.rs.Path; 13 import javax.ws.rs.Path;
14 import javax.ws.rs.PathParam;
14 import javax.ws.rs.Produces; 15 import javax.ws.rs.Produces;
15 import javax.ws.rs.core.Context; 16 import javax.ws.rs.core.Context;
16 import javax.ws.rs.core.HttpHeaders; 17 import javax.ws.rs.core.HttpHeaders;
17 import javax.ws.rs.core.MediaType; 18 import javax.ws.rs.core.MediaType;
18 import javax.ws.rs.core.MultivaluedMap; 19 import javax.ws.rs.core.MultivaluedMap;
82 defaultRepo.entityManager("land"), 83 defaultRepo.entityManager("land"),
83 LKommentarP.class); 84 LKommentarP.class);
84 builder.and("probeId", probeId); 85 builder.and("probeId", probeId);
85 return defaultRepo.filter(builder.getQuery(), "land"); 86 return defaultRepo.filter(builder.getQuery(), "land");
86 } 87 }
88
89 /**
90 * Get a kommentarP object by id.
91 *
92 * @return Response object containing a single kommentarP.
93 */
94 @GET
95 @Path("/{id}")
96 @Produces(MediaType.APPLICATION_JSON)
97 public Response getById(
98 @Context HttpHeaders headers,
99 @PathParam("id") String id
100 ) {
101 if (!authentication.isAuthenticated(headers)) {
102 logger.debug("User is not authenticated!");
103 return new Response(false, 699, null);
104 }
105 return defaultRepo.getById(
106 LKommentarP.class,
107 Integer.valueOf(id),
108 "land");
109 }
87 } 110 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)