changeset 746:9f3029b5fc90

merged.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 27 Oct 2015 09:59:21 +0100
parents e2a78d5afaaa (diff) c7fcc46c6a57 (current diff)
children 214508fd95e7
files
diffstat 13 files changed, 528 insertions(+), 223 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/model/Messung.java	Mon Oct 26 15:49:15 2015 +0100
+++ b/src/main/java/de/intevation/lada/model/Messung.java	Tue Oct 27 09:59:21 2015 +0100
@@ -47,6 +47,9 @@
     @Column(name="probe_id")
     private Integer probeId;
 
+    @Column(name="status")
+    private Integer status;
+
     @Transient
     private boolean owner;
 
@@ -112,6 +115,14 @@
         this.probeId = probeId;
     }
 
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
     public boolean isOwner() {
         return owner;
     }
--- a/src/main/java/de/intevation/lada/model/Status.java	Mon Oct 26 15:49:15 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/* 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;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-
-/**
- * The persistent class for the status database table.
- */
-@MappedSuperclass
-@Table(name="status")
-public class Status implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id", nullable=false, insertable=false)
-    private Integer id;
-
-    private String erzeuger;
-
-    @Column(name="messungs_id")
-    private Integer messungsId;
-
-    @Column(name="s_datum")
-    private Timestamp sDatum;
-
-    @Column(name="s_kommentar")
-    private String sKommentar;
-
-    private Integer status;
-
-    @Transient
-    private boolean owner;
-
-    @Transient
-    private boolean readonly;
-
-    public Status() {
-    }
-
-    public Integer getId() {
-        return this.id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getErzeuger() {
-        return this.erzeuger;
-    }
-
-    public void setErzeuger(String erzeuger) {
-        this.erzeuger = erzeuger;
-    }
-
-    public Integer getMessungsId() {
-        return this.messungsId;
-    }
-
-    public void setMessungsId(Integer messungsId) {
-        this.messungsId = messungsId;
-    }
-
-    public Timestamp getSDatum() {
-        return this.sDatum;
-    }
-
-    public void setSDatum(Timestamp sDatum) {
-        this.sDatum = sDatum;
-    }
-
-    public String getSKommentar() {
-        return this.sKommentar;
-    }
-
-    public void setSKommentar(String sKommentar) {
-        this.sKommentar = sKommentar;
-    }
-
-    public Integer getStatus() {
-        return this.status;
-    }
-
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-
-    public boolean isOwner() {
-        return owner;
-    }
-
-    public void setOwner(boolean owner) {
-        this.owner = owner;
-    }
-
-    public boolean isReadonly() {
-        return readonly;
-    }
-
-    public void setReadonly(boolean readonly) {
-        this.readonly = readonly;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/model/StatusProtokoll.java	Tue Oct 27 09:59:21 2015 +0100
@@ -0,0 +1,143 @@
+/* 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;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+
+/**
+ * The persistent class for the status database table.
+ */
+@MappedSuperclass
+@Table(name="status_protokoll")
+public class StatusProtokoll implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id", nullable=false, insertable=false)
+    private Integer id;
+
+    @Column(name="messungs_id")
+    private Integer messungsId;
+
+    @Column(name="status_stufe")
+    private Integer statusStufe;
+
+    @Column(name="status_wert")
+    private Integer statusWert;
+
+    private String erzeuger;
+
+    @Column(name="datum")
+    private Timestamp datum;
+
+    @Column(name="text")
+    private String text;
+
+    @Column(name="tree_modified")
+    private Timestamp treeModified;
+
+    @Transient
+    private boolean owner;
+
+    @Transient
+    private boolean readonly;
+
+    public StatusProtokoll() {
+    }
+
+    public Integer getId() {
+        return this.id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getStatusStufe() {
+        return this.statusStufe;
+    }
+
+    public void setStatusStufe(Integer statusStufe) {
+        this.statusStufe = statusStufe;
+    }
+
+    public Integer getStatusWert() {
+        return this.statusWert;
+    }
+
+    public void setStatusWert(Integer statusWert) {
+        this.statusWert = statusWert;
+    }
+
+    public String getErzeuger() {
+        return this.erzeuger;
+    }
+
+    public void setErzeuger(String erzeuger) {
+        this.erzeuger = erzeuger;
+    }
+
+    public Integer getMessungsId() {
+        return this.messungsId;
+    }
+
+    public void setMessungsId(Integer messungsId) {
+        this.messungsId = messungsId;
+    }
+
+    public Timestamp getDatum() {
+        return this.datum;
+    }
+
+    public void setDatum(Timestamp datum) {
+        this.datum = datum;
+    }
+
+    public String getText() {
+        return this.text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public Timestamp getTreeModified() {
+        return treeModified;
+    }
+
+    public void setTreeModified(Timestamp treeModified) {
+        this.treeModified = treeModified;
+    }
+
+    public boolean isOwner() {
+        return owner;
+    }
+
+    public void setOwner(boolean owner) {
+        this.owner = owner;
+    }
+
+    public boolean isReadonly() {
+        return readonly;
+    }
+
+    public void setReadonly(boolean readonly) {
+        this.readonly = readonly;
+    }
+}
--- a/src/main/java/de/intevation/lada/model/bund/Status.java	Mon Oct 26 15:49:15 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/* 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.bund;
-
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-
-/**
- * The persistent class for the status database table.
- */
-@Entity
-@Table(name="status")
-public class Status extends de.intevation.lada.model.Status {
-    private static final long serialVersionUID = 1L;
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/model/bund/StatusProtokoll.java	Tue Oct 27 09:59:21 2015 +0100
@@ -0,0 +1,17 @@
+/* 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.bund;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "status_protokoll")
+public class StatusProtokoll extends de.intevation.lada.model.StatusProtokoll {
+    private static final long serialVersionUID = 1L;
+}
--- a/src/main/java/de/intevation/lada/model/land/LStatus.java	Mon Oct 26 15:49:15 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/* 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.land;
-
-import java.sql.Timestamp;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-
-/**
- * The persistent class for the status database table.
- */
-@Entity
-@Table(name="status")
-public class LStatus extends de.intevation.lada.model.Status {
-    private static final long serialVersionUID = 1L;
-
-    @Column(name="tree_modified", insertable=false, updatable=false)
-    private Timestamp treeModified;
-
-    @OneToOne
-    @JoinColumn(name="messungs_id", insertable=false, updatable=false)
-    private LMessung messung;
-
-    @Transient
-    private Timestamp parentModified;
-
-    public Timestamp getTreeModified() {
-        return treeModified;
-    }
-
-    public void setTreeModified(Timestamp treeModified) {
-        this.treeModified = treeModified;
-    }
-
-    public Timestamp getParentModified() {
-        if (this.parentModified == null && this.messung != null) {
-            return this.messung.getTreeModified();
-        }
-        return this.parentModified;
-    }
-
-    public void setParentModified(Timestamp parentModified) {
-        this.parentModified = parentModified;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/model/land/LStatusProtokoll.java	Tue Oct 27 09:59:21 2015 +0100
@@ -0,0 +1,22 @@
+/* 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.land;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import de.intevation.lada.model.StatusProtokoll;
+
+/**
+ * The persistent class for the probe database table.
+ */
+@Entity
+@Table(name="status_protokoll")
+public class LStatusProtokoll extends StatusProtokoll {
+    private static final long serialVersionUID = 1L;
+}
--- /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:59:21 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:59:21 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;
+    }
+
+}
--- a/src/main/java/de/intevation/lada/rest/MessungService.java	Mon Oct 26 15:49:15 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/MessungService.java	Tue Oct 27 09:59:21 2015 +0100
@@ -33,8 +33,8 @@
 import de.intevation.lada.model.land.LKommentarM;
 import de.intevation.lada.model.land.LMessung;
 import de.intevation.lada.model.land.LMesswert;
-import de.intevation.lada.model.land.LStatus;
 import de.intevation.lada.model.land.MessungTranslation;
+import de.intevation.lada.model.land.LStatusProtokoll;
 import de.intevation.lada.util.annotation.AuthorizationConfig;
 import de.intevation.lada.util.annotation.RepositoryConfig;
 import de.intevation.lada.util.auth.Authorization;
@@ -245,6 +245,17 @@
             created.setWarnings(violation.getWarnings());
         }
 
+        LStatusProtokoll status = new LStatusProtokoll();
+        status.setDatum(new Timestamp(new Date().getTime()));
+        status.setMessungsId(((LMessung)created.getData()).getId());
+        //TODO set the correct value. use the probe to get the "erzeuger"!?
+        status.setErzeuger("11010");
+        status.setStatusStufe(1);
+        status.setStatusWert(1);
+        defaultRepo.create(status, "land");
+        ret.setStatus(status.getId());
+        defaultRepo.update(ret, "land");
+
         return authorization.filter(
             request,
             created,
@@ -359,17 +370,17 @@
             new QueryBuilder<LKommentarM>(
                 defaultRepo.entityManager("land"), LKommentarM.class);
         mkBuilder.and("messungsId", messungObj.getId());
-        QueryBuilder<LStatus> msBuilder =
-            new QueryBuilder<LStatus>(
-                defaultRepo.entityManager("land"), LStatus.class);
+        QueryBuilder<LStatusProtokoll> msBuilder =
+            new QueryBuilder<LStatusProtokoll>(
+                defaultRepo.entityManager("land"), LStatusProtokoll.class);
         msBuilder.and("messungsId", messungObj.getId());
 
         List<LMesswert> messwerte =
             (List<LMesswert>)defaultRepo.filter(mwBuilder.getQuery(), "land").getData();
         List<LKommentarM> kommentare =
             (List<LKommentarM>)defaultRepo.filter(mkBuilder.getQuery(), "land").getData();
-        List<LStatus> status =
-            (List<LStatus>)defaultRepo.filter(msBuilder.getQuery(), "land").getData();
+        List<LStatusProtokoll> status =
+            (List<LStatusProtokoll>)defaultRepo.filter(msBuilder.getQuery(), "land").getData();
 
         if (!messwerte.isEmpty() ||
             !kommentare.isEmpty() ||
--- a/src/main/java/de/intevation/lada/rest/StatusService.java	Mon Oct 26 15:49:15 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/StatusService.java	Tue Oct 27 09:59:21 2015 +0100
@@ -26,7 +26,7 @@
 import de.intevation.lada.lock.LockConfig;
 import de.intevation.lada.lock.LockType;
 import de.intevation.lada.lock.ObjectLocker;
-import de.intevation.lada.model.land.LStatus;
+import de.intevation.lada.model.land.LStatusProtokoll;
 import de.intevation.lada.util.annotation.AuthorizationConfig;
 import de.intevation.lada.util.annotation.RepositoryConfig;
 import de.intevation.lada.util.auth.Authorization;
@@ -116,18 +116,18 @@
     ) {
         MultivaluedMap<String, String> params = info.getQueryParameters();
         if (params.isEmpty() || !params.containsKey("messungsId")) {
-            return defaultRepo.getAll(LStatus.class, "land");
+            return defaultRepo.getAll(LStatusProtokoll.class, "land");
         }
         String messungId = params.getFirst("messungsId");
-        QueryBuilder<LStatus> builder =
-            new QueryBuilder<LStatus>(
+        QueryBuilder<LStatusProtokoll> builder =
+            new QueryBuilder<LStatusProtokoll>(
                 defaultRepo.entityManager("land"),
-                LStatus.class);
+                LStatusProtokoll.class);
         builder.and("messungsId", messungId);
         return authorization.filter(
             request,
             defaultRepo.filter(builder.getQuery(), "land"),
-            LStatus.class);
+            LStatusProtokoll.class);
     }
 
     /**
@@ -149,8 +149,8 @@
     ) {
         return authorization.filter(
             request,
-            defaultRepo.getById(LStatus.class, Integer.valueOf(id), "land"),
-            LStatus.class);
+            defaultRepo.getById(LStatusProtokoll.class, Integer.valueOf(id), "land"),
+            LStatusProtokoll.class);
     }
 
     /**
@@ -181,13 +181,13 @@
     public Response create(
         @Context HttpHeaders headers,
         @Context HttpServletRequest request,
-        LStatus status
+        LStatusProtokoll status
     ) {
         if (!authorization.isAuthorized(
                 request,
                 status,
                 RequestMethod.POST,
-                LStatus.class)
+                LStatusProtokoll.class)
         ) {
             return new Response(false, 699, null);
         }
@@ -195,7 +195,7 @@
         return authorization.filter(
             request,
             defaultRepo.create(status, "land"),
-            LStatus.class);
+            LStatusProtokoll.class);
     }
 
     /**
@@ -226,13 +226,13 @@
     public Response update(
         @Context HttpHeaders headers,
         @Context HttpServletRequest request,
-        LStatus status
+        LStatusProtokoll status
     ) {
         if (!authorization.isAuthorized(
                 request,
                 status,
                 RequestMethod.PUT,
-                LStatus.class)
+                LStatusProtokoll.class)
         ) {
             return new Response(false, 699, null);
         }
@@ -241,12 +241,12 @@
         }
         Response response = defaultRepo.update(status, "land");
         Response updated = defaultRepo.getById(
-            LStatus.class,
-            ((LStatus)response.getData()).getId(), "land");
+            LStatusProtokoll.class,
+            ((LStatusProtokoll)response.getData()).getId(), "land");
         return authorization.filter(
             request,
             updated,
-            LStatus.class);
+            LStatusProtokoll.class);
     }
 
     /**
@@ -268,13 +268,13 @@
     ) {
         /* Get the object by id*/
         Response object =
-            defaultRepo.getById(LStatus.class, Integer.valueOf(id), "land");
-        LStatus obj = (LStatus)object.getData();
+            defaultRepo.getById(LStatusProtokoll.class, Integer.valueOf(id), "land");
+        LStatusProtokoll obj = (LStatusProtokoll)object.getData();
         if (!authorization.isAuthorized(
                 request,
                 obj,
                 RequestMethod.DELETE,
-                LStatus.class)
+                LStatusProtokoll.class)
         ) {
             return new Response(false, 699, null);
         }
--- /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:59:21 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:59:21 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)