changeset 744:7e6a0227428d

Added model and services for statusstufe and statuswert.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 27 Oct 2015 09:56:16 +0100
parents 56f9add7c902
children e2a78d5afaaa
files src/main/java/de/intevation/lada/model/stamm/StatusStufe.java src/main/java/de/intevation/lada/model/stamm/StatusWert.java src/main/java/de/intevation/lada/rest/stamm/StatusStufeService.java src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java
diffstat 4 files changed, 299 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/model/stamm/StatusStufe.java	Tue Oct 27 09:56:16 2015 +0100
@@ -0,0 +1,49 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+package de.intevation.lada.model.stamm;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+
+/**
+ * The persistent class for the status_stufe database table.
+ */
+@Entity
+@Table(name="status_stufe")
+public class StatusStufe implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    private Integer id;
+
+    private String stufe;
+
+    public StatusStufe() {
+    }
+
+    public Integer getId() {
+        return this.id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getStufe() {
+        return this.stufe;
+    }
+
+    public void setStufe(String stufe) {
+        this.stufe = stufe;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/model/stamm/StatusWert.java	Tue Oct 27 09:56:16 2015 +0100
@@ -0,0 +1,50 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+package de.intevation.lada.model.stamm;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+
+/**
+ * The persistent class for the status_wert database table.
+ * 
+ */
+@Entity
+@Table(name="status_wert")
+public class StatusWert implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    private Integer id;
+
+    private String wert;
+
+    public StatusWert() {
+    }
+
+    public Integer getId() {
+        return this.id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getWert() {
+        return this.wert;
+    }
+
+    public void setWert(String wert) {
+        this.wert = wert;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/rest/stamm/StatusStufeService.java	Tue Oct 27 09:56:16 2015 +0100
@@ -0,0 +1,100 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+package de.intevation.lada.rest.stamm;
+
+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 javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import de.intevation.lada.model.stamm.StatusStufe;
+import de.intevation.lada.util.annotation.RepositoryConfig;
+import de.intevation.lada.util.data.Repository;
+import de.intevation.lada.util.data.RepositoryType;
+import de.intevation.lada.util.rest.Response;
+
+/**
+ * REST service for StatusStufe objects.
+ * <p>
+ * The services produce data in the application/json media type.
+ * A typical response holds information about the action performed and the data.
+ * <pre>
+ * <code>
+ * {
+ *  "success": [boolean];
+ *  "message": [string],
+ *  "data":[{
+ *      "id": [number],
+ *      "stufe": [string],
+ *  }],
+ *  "errors": [object],
+ *  "warnings": [object],
+ *  "readonly": [boolean],
+ *  "totalCount": [number]
+ * }
+ * </code>
+ * </pre>
+ *
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
+@Path("statusstufe")
+@RequestScoped
+public class StatusStufeService {
+
+    /**
+     * The data repository granting read access.
+     */
+    @Inject
+    @RepositoryConfig(type=RepositoryType.RO)
+    private Repository defaultRepo;
+
+    /**
+     * Get all StatusStufe objects.
+     * <p>
+     * Example: http://example.com/statustufe
+     *
+     * @return Response object containing all StatusStufe objects.
+     */
+    @GET
+    @Path("/")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response get(
+        @Context HttpHeaders headers,
+        @Context UriInfo info
+    ) {
+        return defaultRepo.getAll(StatusStufe.class, "stamm");
+    }
+
+    /**
+     * Get a single StatusStufe object by id.
+     * <p>
+     * The id is appended to the URL as a path parameter.
+     * <p>
+     * Example: http://example.com/statusstufe/{id}
+     *
+     * @return Response object containing a single StatusStufe.
+     */
+    @GET
+    @Path("/{id}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getById(
+        @Context HttpHeaders headers,
+        @PathParam("id") String id
+    ) {
+        return defaultRepo.getById(
+            StatusStufe.class,
+            Integer.valueOf(id),
+            "stamm");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java	Tue Oct 27 09:56:16 2015 +0100
@@ -0,0 +1,100 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+package de.intevation.lada.rest.stamm;
+
+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 javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import de.intevation.lada.model.stamm.StatusWert;
+import de.intevation.lada.util.annotation.RepositoryConfig;
+import de.intevation.lada.util.data.Repository;
+import de.intevation.lada.util.data.RepositoryType;
+import de.intevation.lada.util.rest.Response;
+
+/**
+ * REST service for StatusWert objects.
+ * <p>
+ * The services produce data in the application/json media type.
+ * A typical response holds information about the action performed and the data.
+ * <pre>
+ * <code>
+ * {
+ *  "success": [boolean];
+ *  "message": [string],
+ *  "data":[{
+ *      "id": [number],
+ *      "wert": [string],
+ *  }],
+ *  "errors": [object],
+ *  "warnings": [object],
+ *  "readonly": [boolean],
+ *  "totalCount": [number]
+ * }
+ * </code>
+ * </pre>
+ *
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
+@Path("statuswert")
+@RequestScoped
+public class StatusWertService {
+
+    /**
+     * The data repository granting read access.
+     */
+    @Inject
+    @RepositoryConfig(type=RepositoryType.RO)
+    private Repository defaultRepo;
+
+    /**
+     * Get all StatusWert objects.
+     * <p>
+     * Example: http://example.com/statuwert
+     *
+     * @return Response object containing all StatusWert objects.
+     */
+    @GET
+    @Path("/")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response get(
+        @Context HttpHeaders headers,
+        @Context UriInfo info
+    ) {
+        return defaultRepo.getAll(StatusWert.class, "stamm");
+    }
+
+    /**
+     * Get a single StatusWert object by id.
+     * <p>
+     * The id is appended to the URL as a path parameter.
+     * <p>
+     * Example: http://example.com/statuswert/{id}
+     *
+     * @return Response object containing a single StatusWert.
+     */
+    @GET
+    @Path("/{id}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getById(
+        @Context HttpHeaders headers,
+        @PathParam("id") String id
+    ) {
+        return defaultRepo.getById(
+            StatusWert.class,
+            Integer.valueOf(id),
+            "stamm");
+    }
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)