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