annotate src/main/java/de/intevation/lada/rest/stamm/StatusKombiService.java @ 1345:883ab3a6f525 tip

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