Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportDepth.java @ 5441:7c1dd9c3f6bd
remove unit from sediment density and depths (always t/m3 respectively cm, otherwise a typo)
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Tue, 26 Mar 2013 19:29:39 +0100 |
parents | 8979f2294af9 |
children |
comparison
equal
deleted
inserted
replaced
5440:765013c837b1 | 5441:7c1dd9c3f6bd |
---|---|
20 protected Depth peer; | 20 protected Depth peer; |
21 | 21 |
22 protected BigDecimal lower; | 22 protected BigDecimal lower; |
23 protected BigDecimal upper; | 23 protected BigDecimal upper; |
24 | 24 |
25 protected ImportUnit unit; | |
26 | 25 |
27 | 26 public ImportDepth(BigDecimal lower, BigDecimal upper) { |
28 public ImportDepth(BigDecimal lower, BigDecimal upper, ImportUnit unit) { | |
29 this.lower = lower; | 27 this.lower = lower; |
30 this.upper = upper; | 28 this.upper = upper; |
31 this.unit = unit; | |
32 } | 29 } |
33 | 30 |
34 | 31 |
35 public void storeDependencies() { | 32 public void storeDependencies() { |
36 log.info("store dependencies"); | 33 log.info("store dependencies"); |
46 Session session = ImporterSession.getInstance().getDatabaseSession(); | 43 Session session = ImporterSession.getInstance().getDatabaseSession(); |
47 | 44 |
48 Query query = session.createQuery( | 45 Query query = session.createQuery( |
49 "from Depth where " + | 46 "from Depth where " + |
50 " lower=:lower and " + | 47 " lower=:lower and " + |
51 " upper=:upper and " + | 48 " upper=:upper"); |
52 " unit=:unit"); | |
53 | 49 |
54 query.setParameter("lower", lower); | 50 query.setParameter("lower", lower); |
55 query.setParameter("upper", upper); | 51 query.setParameter("upper", upper); |
56 query.setParameter("unit", unit.getPeer()); | |
57 | 52 |
58 List<Depth> depths = query.list(); | 53 List<Depth> depths = query.list(); |
59 | 54 |
60 if (depths.isEmpty()) { | 55 if (depths.isEmpty()) { |
61 log.debug("Create new Depth DB instance."); | 56 log.debug("Create new Depth DB instance."); |
62 | 57 |
63 peer = new Depth(lower, upper, unit.getPeer()); | 58 peer = new Depth(lower, upper); |
64 | 59 |
65 session.save(peer); | 60 session.save(peer); |
66 } | 61 } |
67 else { | 62 else { |
68 peer = depths.get(0); | 63 peer = depths.get(0); |