[Lada-commits] [PATCH 1 of 3] Added model and services for statusstufe and statuswert
Wald Commits
scm-commit at wald.intevation.org
Tue Oct 27 09:59:16 CET 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1445936176 -3600
# Node ID 7e6a0227428d68819a1e54c231f543ec36cc3782
# Parent 56f9add7c902cea5709c171700f422ceaec2f383
Added model and services for statusstufe and statuswert.
diff -r 56f9add7c902 -r 7e6a0227428d src/main/java/de/intevation/lada/model/stamm/StatusStufe.java
--- /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.
+ */
+ at Entity
+ at 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;
+ }
+
+}
diff -r 56f9add7c902 -r 7e6a0227428d src/main/java/de/intevation/lada/model/stamm/StatusWert.java
--- /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.
+ *
+ */
+ at Entity
+ at 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;
+ }
+
+}
diff -r 56f9add7c902 -r 7e6a0227428d src/main/java/de/intevation/lada/rest/stamm/StatusStufeService.java
--- /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 at intevation.de">Raimund Renkert</a>
+ */
+ at Path("statusstufe")
+ at 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");
+ }
+}
diff -r 56f9add7c902 -r 7e6a0227428d src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java
--- /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 at intevation.de">Raimund Renkert</a>
+ */
+ at Path("statuswert")
+ at 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");
+ }
+}
More information about the Lada-commits
mailing list