Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/rest/SMessstelleService.java @ 45:a5ee8d69c0b4
Renamed existing rest services and make use of the generic repository.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 24 May 2013 11:53:46 +0200 |
parents | src/main/java/de/intevation/lada/rest/SMessstelleRESTService.java@e0a5477f657e |
children | 5abec5413d65 |
comparison
equal
deleted
inserted
replaced
44:2d89a04d5ad9 | 45:a5ee8d69c0b4 |
---|---|
1 package de.intevation.lada.rest; | |
2 | |
3 import java.util.List; | |
4 import java.util.logging.Logger; | |
5 | |
6 import javax.enterprise.context.RequestScoped; | |
7 import javax.inject.Inject; | |
8 import javax.ws.rs.GET; | |
9 import javax.ws.rs.Path; | |
10 import javax.ws.rs.PathParam; | |
11 import javax.ws.rs.Produces; | |
12 | |
13 import de.intevation.lada.data.Repository; | |
14 import de.intevation.lada.model.SMessStelle; | |
15 import javax.inject.Named; | |
16 | |
17 /** | |
18 * This class produces a RESTful service to read the contents of s_messstelle | |
19 * table. | |
20 * | |
21 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> | |
22 */ | |
23 @Path("/mst") | |
24 @RequestScoped | |
25 public class SMessstelleService | |
26 { | |
27 /** | |
28 * The Repository for SMessStelle. | |
29 */ | |
30 @Inject @Named | |
31 private Repository repository; | |
32 | |
33 /** | |
34 * The logger for this class | |
35 */ | |
36 @Inject | |
37 private Logger logger; | |
38 | |
39 /** | |
40 * Request all SMessStelle objects. | |
41 * | |
42 * @return JSON Object via Rest service | |
43 */ | |
44 @GET | |
45 @Produces("text/json") | |
46 public List<SMessStelle> findAll() { | |
47 List<SMessStelle> result = repository.findAll(SMessStelle.class); | |
48 return result; | |
49 } | |
50 | |
51 /** | |
52 * Request a single SMessStelle via its id. | |
53 * | |
54 * @param id The mst_id | |
55 * @return JSON Object via REST service. | |
56 */ | |
57 @GET | |
58 @Path("/{id}") | |
59 @Produces("text/json") | |
60 public SMessStelle findById(@PathParam("id") String id) { | |
61 return repository.findById(SMessStelle.class, id); | |
62 } | |
63 } |