Mercurial > lada > lada-server
changeset 882:2e9007297e78
merged
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 12 Feb 2016 12:10:09 +0100 |
parents | 501ccddaeaca (current diff) 2311374cc3e8 (diff) |
children | 2e264556f186 |
files | src/main/java/de/intevation/lada/rest/StatusService.java |
diffstat | 6 files changed, 40 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/db_schema/stammdaten_schema.sql Thu Feb 11 17:07:14 2016 +0100 +++ b/db_schema/stammdaten_schema.sql Fri Feb 12 12:10:09 2016 +0100 @@ -725,17 +725,16 @@ CREATE VIEW status_erreichbar AS ( - SELECT DISTINCT k.wert_id, - j.wert_id AS cur_wert, - j.stufe_id AS cur_stufe - FROM stammdaten.status_kombi k - JOIN (SELECT r.zu_id, - kom.wert_id, - kom.stufe_id - FROM stammdaten.status_reihenfolge r - JOIN stammdaten.status_kombi kom - ON kom.id = r.von_id) j - ON j.zu_id = k.id + SELECT r.id, + zu.wert_id, + zu.stufe_id, + von.wert_id AS cur_wert, + von.stufe_id AS cur_stufe + FROM stammdaten.status_reihenfolge r + JOIN stammdaten.status_kombi von + ON von.id = r.von_id + JOIN stammdaten.status_kombi zu + ON zu.id = r.zu_id ); -- Status workflow
--- a/src/main/java/de/intevation/lada/model/stamm/StatusErreichbar.java Thu Feb 11 17:07:14 2016 +0100 +++ b/src/main/java/de/intevation/lada/model/stamm/StatusErreichbar.java Fri Feb 12 12:10:09 2016 +0100 @@ -24,41 +24,38 @@ public class StatusErreichbar implements Serializable { private static final long serialVersionUID = 1L; + @Id + private Integer id; + + @Column(name="wert_id") + private Integer wertId; + + @Column(name="stufe_id") + private Integer stufeId; + @Column(name="cur_stufe") private Integer curStufe; @Column(name="cur_wert") private Integer curWert; - @Id - @Column(name="wert_id") - private Integer wertId; + public StatusErreichbar() { + } - public StatusErreichbar() { + public Integer getWertId() { + return this.wertId; + } + + public Integer getStufeId() { + return this.stufeId; } public Integer getCurStufe() { return this.curStufe; } - public void setCurStufe(Integer curStufe) { - this.curStufe = curStufe; - } - public Integer getCurWert() { return this.curWert; } - public void setCurWert(Integer curWert) { - this.curWert = curWert; - } - - public Integer getWertId() { - return this.wertId; - } - - public void setWertId(Integer wertId) { - this.wertId = wertId; - } - }
--- a/src/main/java/de/intevation/lada/rest/StatusService.java Thu Feb 11 17:07:14 2016 +0100 +++ b/src/main/java/de/intevation/lada/rest/StatusService.java Fri Feb 12 12:10:09 2016 +0100 @@ -257,10 +257,9 @@ i < userInfo.getFunktionenForMst(status.getErzeuger()).size(); i++ ) { - if (userInfo.getFunktionenForMst( - status.getErzeuger()).get(i) == - currentStatus.getStatusStufe() + 1 && - currentStatus.getStatusWert() != 0 + if (userInfo.getFunktionenForMst(status.getErzeuger()) + .get(i).equals(currentStatus.getStatusStufe() + 1) + && currentStatus.getStatusWert() != 0 ) { next = true; }
--- a/src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java Thu Feb 11 17:07:14 2016 +0100 +++ b/src/main/java/de/intevation/lada/rest/stamm/StatusWertService.java Fri Feb 12 12:10:09 2016 +0100 @@ -35,6 +35,7 @@ import de.intevation.lada.util.annotation.RepositoryConfig; import de.intevation.lada.util.auth.Authorization; import de.intevation.lada.util.auth.AuthorizationType; +import de.intevation.lada.util.auth.UserInfo; import de.intevation.lada.util.data.QueryBuilder; import de.intevation.lada.util.data.Repository; import de.intevation.lada.util.data.RepositoryType; @@ -101,7 +102,8 @@ return defaultRepo.getAll(StatusWert.class, "stamm"); } int messungsId = Integer.valueOf(params.getFirst("messungsId")); - List<StatusWert> werte = getReachable(messungsId); + UserInfo user = authorization.getInfo(request); + List<StatusWert> werte = getReachable(messungsId, user); Response response = new Response(true, 200, werte); return response; } @@ -128,7 +130,7 @@ "stamm"); } - private List<StatusWert> getReachable(int messungsId) { + private List<StatusWert> getReachable(int messungsId, UserInfo user) { List<StatusWert> list = new ArrayList<StatusWert>(); LMessung messung = defaultRepo.getByIdPlain(LMessung.class, messungsId, "land"); @@ -144,6 +146,7 @@ new QueryBuilder<StatusErreichbar>( defaultRepo.entityManager("stamm"), StatusErreichbar.class); + errFilter.andIn("stufeId", user.getFunktionen()); errFilter.and("curStufe", status.getStatusStufe()); errFilter.and("curWert", status.getStatusWert()); List<StatusErreichbar> erreichbare = defaultRepo.filterPlain(
--- a/src/main/java/de/intevation/lada/util/data/QueryBuilder.java Thu Feb 11 17:07:14 2016 +0100 +++ b/src/main/java/de/intevation/lada/util/data/QueryBuilder.java Fri Feb 12 12:10:09 2016 +0100 @@ -248,8 +248,8 @@ * * @return The current Querybuilder. */ - public QueryBuilder<T> orIn(String key, List<String> values) { - Expression<String> exp = this.root.get(key); + public <M> QueryBuilder<T> orIn(String key, List<M> values) { + Expression<M> exp = this.root.get(key); Predicate p = exp.in(values); if (this.filter == null) { this.filter = this.builder.or(p); @@ -269,8 +269,8 @@ * * @return The current Querybuilder. */ - public QueryBuilder<T> andIn(String key, List<String> values) { - Expression<String> exp = this.root.get(key); + public <M> QueryBuilder<T> andIn(String key, List<M> values) { + Expression<M> exp = this.root.get(key); Predicate p = exp.in(values); if (this.filter == null) { this.filter = this.builder.and(p);
--- a/src/main/java/de/intevation/lada/validation/rules/status/StatusFolge.java Thu Feb 11 17:07:14 2016 +0100 +++ b/src/main/java/de/intevation/lada/validation/rules/status/StatusFolge.java Fri Feb 12 12:10:09 2016 +0100 @@ -68,7 +68,7 @@ kombi2.and("stufeId", last.getStatusStufe()); kombi2.and("wertId", last.getStatusWert()); List<StatusKombi> result2 = - repository.filterPlain(kombi.getQuery(), "stamm"); + repository.filterPlain(kombi2.getQuery(), "stamm"); if (result2.isEmpty()) { Violation violation = new Violation(); violation.addError("status", 632);