Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/importer/ImportSedimentLoadLS.java @ 8056:d86cc6a17b7a
Importer: Import sediment load at measurement stations.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 18 Jul 2014 15:37:26 +0200 |
parents | fd3a24336e6a |
children | bde5f5ec7c72 |
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 SedimentLoadLS peer = getPeer(river); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
73 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
74 if (peer != null) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
75 int i = 0; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
76 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
77 for (ImportSedimentLoadLSValue value : values) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
78 value.storeDependencies(peer); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
79 i++; |
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 |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
82 log.info("stored " + i + " sediment load values."); |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
83 } |
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 public SedimentLoadLS getPeer(River river) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
87 log.debug("get peer"); |
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 GrainFraction gf = grainFraction != null ? grainFraction.getPeer() |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
90 : null; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
91 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
92 Unit u = unit != null ? unit.getPeer() : null; |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
93 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
94 TimeInterval ti = timeInterval != null ? timeInterval.getPeer() : 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 if (ti == null || u == null) { |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
97 log.warn("Skip invalid SedimentLoadLS: time interval or unit null!"); |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
98 return 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 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
101 if (peer == null) { |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
102 Session session = ImporterSession.getInstance() |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
103 .getDatabaseSession(); |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
104 Query query = session.createQuery("from SedimentLoadLS where " |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
105 + " river=:river and " |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
106 + " grainFraction=:grainFraction and " + " unit=:unit and " |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
107 + " timeInterval=:timeInterval and " |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
108 + " description=:description"); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
109 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
110 query.setParameter("river", river); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
111 query.setParameter("grainFraction", gf); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
112 query.setParameter("unit", u); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
113 query.setParameter("timeInterval", ti); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
114 query.setParameter("description", description); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
115 |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
116 List<SedimentLoadLS> loads = query.list(); |
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
117 if (loads.isEmpty()) { |
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
118 log.debug("create new SedimentLoadLS"); |
8031
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 peer = new SedimentLoadLS(river, u, ti, gf, description); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
121 peer.setKind(this.kind); |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
122 session.save(peer); |
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 else { |
8032
fd3a24336e6a
SCHEMA CHANGE and Importer (only longitudinal section data so far): only grain fractions given now in schema are valid. We are handling sediment loads, not yields.
"Tom Gottfried <tom@intevation.de>"
parents:
8031
diff
changeset
|
125 peer = loads.get(0); |
8031
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
126 } |
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 |
6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
129 return peer; |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |