diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/rest/SMessstelleService.java	Fri May 24 11:53:46 2013 +0200
@@ -0,0 +1,63 @@
+package de.intevation.lada.rest;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import de.intevation.lada.data.Repository;
+import de.intevation.lada.model.SMessStelle;
+import javax.inject.Named;
+
+/**
+ * This class produces a RESTful service to read the contents of s_messstelle
+ * table.
+ *
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
+@Path("/mst")
+@RequestScoped
+public class SMessstelleService
+{
+    /**
+     * The Repository for SMessStelle.
+     */
+    @Inject @Named
+    private Repository repository;
+
+    /**
+     * The logger for this class
+     */
+    @Inject
+    private Logger logger;
+
+    /**
+     * Request all SMessStelle objects.
+     *
+     * @return JSON Object via Rest service
+     */
+    @GET
+    @Produces("text/json")
+    public List<SMessStelle> findAll() {
+        List<SMessStelle> result = repository.findAll(SMessStelle.class);
+        return result;
+    }
+
+    /**
+     * Request a single SMessStelle via its id.
+     *
+     * @param id The mst_id
+     * @return JSON Object via REST service.
+     */
+    @GET
+    @Path("/{id}")
+    @Produces("text/json")
+    public SMessStelle findById(@PathParam("id") String id) {
+        return repository.findById(SMessStelle.class, id);
+    }
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)