changeset 164:c85743232d75

Added new Services for Messeinheiten and Zusatzwerte
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 19 Jun 2013 15:13:13 +0200
parents b4bc655685aa
children 917ee8501517
files src/main/java/de/intevation/lada/rest/SMesseinheitService.java src/main/java/de/intevation/lada/rest/SProbenzusatzService.java
diffstat 2 files changed, 108 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/rest/SMesseinheitService.java	Wed Jun 19 15:13:13 2013 +0200
@@ -0,0 +1,47 @@
+package de.intevation.lada.rest;
+
+import java.util.logging.Logger;
+
+import javax.faces.bean.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import de.intevation.lada.data.Repository;
+import de.intevation.lada.model.SMessEinheit;
+
+/**
+ * This class produces a RESTful service to read the contents of SDatenbasis table.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
+@Path("/datenbasis")
+@RequestScoped
+public class SMesseinheitService
+{
+    /**
+     * The Repository for SDatenbasis.
+     */
+    @Inject
+    @Named("readonlyrepository")
+    private Repository repository;
+
+    /**
+     * The logger for this class
+     */
+    @Inject
+    private Logger logger;
+
+    /**
+     * Request all SDatenbasis objects.
+     *
+     * @return JSON Object via Rest service
+     */
+    @GET
+    @Produces("text/json")
+    public Response findAll() {
+        return repository.findAll(SMessEinheit.class);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/rest/SProbenzusatzService.java	Wed Jun 19 15:13:13 2013 +0200
@@ -0,0 +1,61 @@
+package de.intevation.lada.rest;
+
+import java.util.logging.Logger;
+
+import javax.faces.bean.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+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.SDatenbasis;
+
+/**
+ * This class produces a RESTful service to read the contents of SDatenbasis table.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
+@Path("/datenbasis")
+@RequestScoped
+public class SProbenzusatzService
+{
+    /**
+     * The Repository for SDatenbasis.
+     */
+    @Inject
+    @Named("readonlyrepository")
+    private Repository repository;
+
+    /**
+     * The logger for this class
+     */
+    @Inject
+    private Logger logger;
+
+    /**
+     * Request all SDatenbasis objects.
+     *
+     * @return JSON Object via Rest service
+     */
+    @GET
+    @Produces("text/json")
+    public Response findAll() {
+        return repository.findAll(SDatenbasis.class);
+    }
+
+    /**
+     * Request a single SDatenbasis via its id.
+     *
+     * @param id The mst_id
+     * @return JSON Object via REST service.
+     */
+    @GET
+    @Path("/{id}")
+    @Produces("text/json")
+    public Response findById(@PathParam("id") String id) {
+        return repository.findById(SDatenbasis.class, id);
+    }
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)