Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/importer/ImportSedimentLoadLS.java @ 8031:6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 11 Jul 2014 13:10:05 +0200 |
parents | |
children | fd3a24336e6a |
rev | line source |
---|---|
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
3 * |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
7 */ |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
8 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.importer; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
10 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.util.ArrayList; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
12 import java.util.List; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
13 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
15 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
16 import org.hibernate.Session; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
17 import org.hibernate.Query; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
18 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
19 import org.dive4elements.river.model.GrainFraction; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
20 import org.dive4elements.river.model.River; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
21 import org.dive4elements.river.model.SedimentLoadLS; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
22 import org.dive4elements.river.model.TimeInterval; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
23 import org.dive4elements.river.model.Unit; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
24 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
25 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
26 public class ImportSedimentLoadLS { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
27 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
28 private static Logger log = Logger.getLogger(ImportSedimentLoadLS.class); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
29 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
30 private ImportGrainFraction grainFraction; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
31 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
32 private ImportUnit unit; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
33 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
34 private ImportTimeInterval timeInterval; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
35 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
36 private String description; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
37 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
38 private Integer kind; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
39 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
40 private List<ImportSedimentLoadLSValue> values; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
41 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
42 private SedimentLoadLS peer; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
43 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
44 public ImportSedimentLoadLS(String description) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
45 this.values = new ArrayList<ImportSedimentLoadLSValue>(); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
46 this.description = description; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
47 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
48 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
49 public void setTimeInterval(ImportTimeInterval timeInterval) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
50 this.timeInterval = timeInterval; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
51 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
52 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
53 public void setUnit(ImportUnit unit) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
54 this.unit = unit; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
55 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
56 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
57 public void setGrainFraction(ImportGrainFraction grainFraction) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
58 this.grainFraction = grainFraction; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
59 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
60 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
61 public void setKind(Integer kind) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
62 this.kind = kind; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
63 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
64 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
65 public void addValue(ImportSedimentLoadLSValue value) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
66 this.values.add(value); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
67 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
68 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
69 public void storeDependencies(River river) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
70 log.debug("store dependencies"); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
71 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
72 if (grainFraction != null) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
73 grainFraction.storeDependencies(); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
74 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
75 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
76 SedimentLoadLS peer = getPeer(river); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
77 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
78 if (peer != null) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
79 int i = 0; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
80 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
81 for (ImportSedimentLoadLSValue value : values) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
82 value.storeDependencies(peer); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
83 i++; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
84 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
85 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
86 log.info("stored " + i + " sediment yield values."); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
87 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
88 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
89 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
90 public SedimentLoadLS getPeer(River river) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
91 log.debug("get peer"); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
92 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
93 GrainFraction gf = grainFraction != null ? grainFraction.getPeer() |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
94 : null; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
95 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
96 Unit u = unit != null ? unit.getPeer() : null; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
97 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
98 TimeInterval ti = timeInterval != null ? timeInterval.getPeer() : null; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
99 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
100 if (ti == null || u == null) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
101 log.warn("Skip invalid SedimentYield: time interval or unit null!"); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
102 return null; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
103 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
104 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
105 if (peer == null) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
106 Session session = ImporterSession.getInstance() |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
107 .getDatabaseSession(); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
108 Query query = session.createQuery("from SedimentYield where " |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
109 + " river=:river and " |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
110 + " grainFraction=:grainFraction and " + " unit=:unit and " |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
111 + " timeInterval=:timeInterval and " |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
112 + " description=:description"); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
113 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
114 query.setParameter("river", river); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
115 query.setParameter("grainFraction", gf); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
116 query.setParameter("unit", u); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
117 query.setParameter("timeInterval", ti); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
118 query.setParameter("description", description); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
119 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
120 List<SedimentLoadLS> yields = query.list(); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
121 if (yields.isEmpty()) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
122 log.debug("create new SedimentYield"); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
123 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
124 peer = new SedimentLoadLS(river, u, ti, gf, description); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
125 peer.setKind(this.kind); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
126 session.save(peer); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
127 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
128 else { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
129 peer = yields.get(0); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
130 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
131 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
132 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
133 return peer; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
134 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
135 } |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
136 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |