Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportWst.java @ 467:c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
flys-backend/trunk@1703 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 15 Apr 2011 10:31:15 +0000 |
parents | 3169b559ca3c |
children | 3570e4af8cb2 |
comparison
equal
deleted
inserted
replaced
466:8bd50b41dea6 | 467:c8c09e31cdb8 |
---|---|
12 | 12 |
13 public class ImportWst | 13 public class ImportWst |
14 { | 14 { |
15 protected String description; | 15 protected String description; |
16 | 16 |
17 protected Integer kind; | |
18 | |
17 protected Map<String, ImportWstColumn> columns; | 19 protected Map<String, ImportWstColumn> columns; |
18 | 20 |
19 protected Wst peer; | 21 protected Wst peer; |
20 | 22 |
21 public ImportWst() { | 23 public ImportWst() { |
24 kind = 0; | |
22 columns = new HashMap<String, ImportWstColumn>(); | 25 columns = new HashMap<String, ImportWstColumn>(); |
23 } | 26 } |
24 | 27 |
25 public ImportWst(String description) { | 28 public ImportWst(String description) { |
26 this(); | 29 this(); |
55 public Wst getPeer(River river) { | 58 public Wst getPeer(River river) { |
56 if (peer == null) { | 59 if (peer == null) { |
57 Session session = Importer.sessionHolder.get(); | 60 Session session = Importer.sessionHolder.get(); |
58 Query query = session.createQuery( | 61 Query query = session.createQuery( |
59 "from Wst where " + | 62 "from Wst where " + |
60 "river=:river and description=:description"); | 63 "river=:river and description=:description and kind=:kind"); |
61 query.setParameter("river", river); | 64 query.setParameter("river", river); |
62 query.setParameter("description", description); | 65 query.setParameter("description", description); |
66 query.setParameter("kind", kind); | |
63 List<Wst> wsts = query.list(); | 67 List<Wst> wsts = query.list(); |
64 if (wsts.isEmpty()) { | 68 if (wsts.isEmpty()) { |
65 peer = new Wst(river, description); | 69 peer = new Wst(river, description, kind); |
66 session.save(peer); | 70 session.save(peer); |
67 } | 71 } |
68 else { | 72 else { |
69 peer = wsts.get(0); | 73 peer = wsts.get(0); |
70 } | 74 } |