comparison src/main/java/de/intevation/lada/rest/stamm/OrtszuordnungTypService.java @ 1271:ff12c3e3366a

Added services for stammdaten ort attributes.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 27 Jan 2017 17:08:16 +0100
parents
children
comparison
equal deleted inserted replaced
1270:6b3a551236ba 1271:ff12c3e3366a
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.OrtszuordnungTyp;
22 import de.intevation.lada.util.annotation.RepositoryConfig;
23 import de.intevation.lada.util.data.Repository;
24 import de.intevation.lada.util.data.RepositoryType;
25 import de.intevation.lada.util.rest.Response;
26
27 /**
28 * REST service for OrtszuordnungTyp objects.
29 * <p>
30 * The services produce data in the application/json media type.
31 * A typical response holds information about the action performed and the data.
32 * <pre>
33 * <code>
34 * {
35 * "success": [boolean];
36 * "message": [string],
37 * "data":[{
38 * "id": [number],
39 * "ortstyp": [string],
40 * }],
41 * "errors": [object],
42 * "warnings": [object],
43 * "readonly": [boolean],
44 * "totalCount": [number]
45 * }
46 * </code>
47 * </pre>
48 *
49 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
50 */
51 @Path("rest/ortszuordnungtyp")
52 @RequestScoped
53 public class OrtszuordnungTypService {
54
55 /**
56 * The data repository granting read access.
57 */
58 @Inject
59 @RepositoryConfig(type=RepositoryType.RO)
60 private Repository defaultRepo;
61
62 /**
63 * Get all OrtszuordnungTyp objects.
64 * <p>
65 * Example: http://example.com/ortszuordnungtyp
66 *
67 * @return Response object containing all OrtszuordnungTyp objects.
68 */
69 @GET
70 @Path("/")
71 @Produces(MediaType.APPLICATION_JSON)
72 public Response get(
73 @Context HttpHeaders headers,
74 @Context UriInfo info
75 ) {
76 return defaultRepo.getAll(OrtszuordnungTyp.class, "stamm");
77 }
78
79 /**
80 * Get a single OrtszuordnungTyp object by id.
81 * <p>
82 * The id is appended to the URL as a path parameter.
83 * <p>
84 * Example: http://example.com/ortszuordnungtyp/{id}
85 *
86 * @return Response object containing a single OrtszuordnungTyp.
87 */
88 @GET
89 @Path("/{id}")
90 @Produces(MediaType.APPLICATION_JSON)
91 public Response getById(
92 @Context HttpHeaders headers,
93 @PathParam("id") String id
94 ) {
95 return defaultRepo.getById(
96 OrtszuordnungTyp.class,
97 Integer.valueOf(id),
98 "stamm");
99 }
100 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)