Mercurial > dive4elements > river
changeset 622:02ca2ff96dee
flys/issue84: Forget to select wst kind.
flys-artifacts/trunk@1978 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 23 May 2011 13:35:52 +0000 |
parents | 4e0ca3890696 |
children | aa64fe4df8ab |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstFactory.java |
diffstat | 2 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Fri May 20 10:41:46 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon May 23 13:35:52 2011 +0000 @@ -1,3 +1,10 @@ +2011-05-23 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + flys/issue84 + + * src/main/java/de/intevation/flys/artifacts/model/WstFactory.java: + Forget to select wst kind. + 2011-05-20 Sascha L. Teichmann <sascha.teichmann@intevation.de> flys/issue81
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstFactory.java Fri May 20 10:41:46 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstFactory.java Mon May 23 13:35:52 2011 +0000 @@ -14,6 +14,8 @@ */ public class WstFactory { + public static final int DEFAULT_KIND = 0; + /** We don't need to instantiate concrete objects of this class. */ private WstFactory() { } @@ -27,15 +29,20 @@ * @return the Wst of <i>river</i>. */ public static Wst getWst(River river) { + return getWst(river, DEFAULT_KIND); + } + + public static Wst getWst(River river, int kind) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( - "from Wst where river=:river"); + "from Wst where river=:river and kind = :kind"); query.setParameter("river", river); + query.setInteger("kind", kind); - List<Wst> wst = query.list(); + List<Wst> wsts = query.list(); - return (wst != null && wst.size() > 0) ? wst.get(0) : null; + return wsts.isEmpty() ? null : wsts.get(0); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :