comparison src/main/java/de/intevation/lada/rest/stamm/StatusKombiService.java @ 1035:4d95cc7f0a43 schema-update

Updated status workflow. * Using status_kombi instead of status_wert and status_stufe * new service for status_kombi * updated validators
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 31 Aug 2016 15:52:15 +0200
parents
children f92c96efa976
comparison
equal deleted inserted replaced
1034:61354a9fa58d 1035:4d95cc7f0a43
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8 package de.intevation.lada.rest.stamm;
9
10 import javax.enterprise.context.RequestScoped;
11 import javax.inject.Inject;
12 import javax.ws.rs.GET;
13 import javax.ws.rs.Path;
14 import javax.ws.rs.PathParam;
15 import javax.ws.rs.Produces;
16 import javax.ws.rs.core.Context;
17 import javax.ws.rs.core.HttpHeaders;
18 import javax.ws.rs.core.MediaType;
19 import javax.ws.rs.core.UriInfo;
20
21 import de.intevation.lada.model.stammdaten.StatusKombi;
22 import de.intevation.lada.model.stammdaten.StatusStufe;
23 import de.intevation.lada.util.annotation.RepositoryConfig;
24 import de.intevation.lada.util.data.Repository;
25 import de.intevation.lada.util.data.RepositoryType;
26 import de.intevation.lada.util.rest.Response;
27
28 /**
29 * REST service for StatusKombi objects.
30 * <p>
31 * The services produce data in the application/json media type.
32 * A typical response holds information about the action performed and the data.
33 * <pre>
34 * <code>
35 * {
36 * "success": [boolean];
37 * "message": [string],
38 * "data":[{
39 * "id": [number],
40 * "stufeId": [number],
41 * "wertId": [number]
42 * }],
43 * "errors": [object],
44 * "warnings": [object],
45 * "readonly": [boolean],
46 * "totalCount": [number]
47 * }
48 * </code>
49 * </pre>
50 *
51 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
52 */
53 @Path("rest/statuskombi")
54 @RequestScoped
55 public class StatusKombiService {
56
57 /**
58 * The data repository granting read access.
59 */
60 @Inject
61 @RepositoryConfig(type=RepositoryType.RO)
62 private Repository repository;
63
64 /**
65 * Get all StatusKombi objects.
66 * <p>
67 * Example: http://example.com/statuskombi
68 *
69 * @return Response object containing all StatusStufe objects.
70 */
71 @GET
72 @Path("/")
73 @Produces(MediaType.APPLICATION_JSON)
74 public Response get(
75 @Context HttpHeaders headers,
76 @Context UriInfo info
77 ) {
78 return repository.getAll(StatusKombi.class, "stamm");
79 }
80
81 /**
82 * Get a single StatusStufe object by id.
83 * <p>
84 * The id is appended to the URL as a path parameter.
85 * <p>
86 * Example: http://example.com/statusstufe/{id}
87 *
88 * @return Response object containing a single StatusStufe.
89 */
90 @GET
91 @Path("/{id}")
92 @Produces(MediaType.APPLICATION_JSON)
93 public Response getById(
94 @Context HttpHeaders headers,
95 @PathParam("id") String id
96 ) {
97 return repository.getById(
98 StatusKombi.class,
99 Integer.valueOf(id),
100 "stamm");
101 }
102 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)