# HG changeset patch # User Raimund Renkert # Date 1445936361 -3600 # Node ID 9f3029b5fc906a832e090feeaeb4c9fcef80b0a7 # Parent e2a78d5afaaa8223d356a331a72a92dbde966e21# Parent c7fcc46c6a57b3c083082c5f4b7f4a0b6d9ca6f9 merged. diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/model/Messung.java --- 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; } diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/model/Status.java --- 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; - } -} diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/model/StatusProtokoll.java --- /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; + } +} diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/model/bund/Status.java --- 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; - -} diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/model/bund/StatusProtokoll.java --- /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; +} diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/model/land/LStatus.java --- 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; - } -} diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/model/land/LStatusProtokoll.java --- /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; +} diff -r c7fcc46c6a57 -r 9f3029b5fc90 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: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; + } + +} diff -r c7fcc46c6a57 -r 9f3029b5fc90 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: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; + } + +} diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/rest/MessungService.java --- 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( defaultRepo.entityManager("land"), LKommentarM.class); mkBuilder.and("messungsId", messungObj.getId()); - QueryBuilder msBuilder = - new QueryBuilder( - defaultRepo.entityManager("land"), LStatus.class); + QueryBuilder msBuilder = + new QueryBuilder( + defaultRepo.entityManager("land"), LStatusProtokoll.class); msBuilder.and("messungsId", messungObj.getId()); List messwerte = (List)defaultRepo.filter(mwBuilder.getQuery(), "land").getData(); List kommentare = (List)defaultRepo.filter(mkBuilder.getQuery(), "land").getData(); - List status = - (List)defaultRepo.filter(msBuilder.getQuery(), "land").getData(); + List status = + (List)defaultRepo.filter(msBuilder.getQuery(), "land").getData(); if (!messwerte.isEmpty() || !kommentare.isEmpty() || diff -r c7fcc46c6a57 -r 9f3029b5fc90 src/main/java/de/intevation/lada/rest/StatusService.java --- 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 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 builder = - new QueryBuilder( + QueryBuilder builder = + new QueryBuilder( 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); } diff -r c7fcc46c6a57 -r 9f3029b5fc90 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: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. + *

+ * The services produce data in the application/json media type. + * A typical response holds information about the action performed and the data. + *

+ * 
+ * {
+ *  "success": [boolean];
+ *  "message": [string],
+ *  "data":[{
+ *      "id": [number],
+ *      "stufe": [string],
+ *  }],
+ *  "errors": [object],
+ *  "warnings": [object],
+ *  "readonly": [boolean],
+ *  "totalCount": [number]
+ * }
+ * 
+ * 
+ * + * @author Raimund Renkert + */ +@Path("statusstufe") +@RequestScoped +public class StatusStufeService { + + /** + * The data repository granting read access. + */ + @Inject + @RepositoryConfig(type=RepositoryType.RO) + private Repository defaultRepo; + + /** + * Get all StatusStufe objects. + *

+ * 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. + *

+ * The id is appended to the URL as a path parameter. + *

+ * 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 c7fcc46c6a57 -r 9f3029b5fc90 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: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. + *

+ * The services produce data in the application/json media type. + * A typical response holds information about the action performed and the data. + *

+ * 
+ * {
+ *  "success": [boolean];
+ *  "message": [string],
+ *  "data":[{
+ *      "id": [number],
+ *      "wert": [string],
+ *  }],
+ *  "errors": [object],
+ *  "warnings": [object],
+ *  "readonly": [boolean],
+ *  "totalCount": [number]
+ * }
+ * 
+ * 
+ * + * @author Raimund Renkert + */ +@Path("statuswert") +@RequestScoped +public class StatusWertService { + + /** + * The data repository granting read access. + */ + @Inject + @RepositoryConfig(type=RepositoryType.RO) + private Repository defaultRepo; + + /** + * Get all StatusWert objects. + *

+ * 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. + *

+ * The id is appended to the URL as a path parameter. + *

+ * 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"); + } +}