annotate backend/src/main/java/org/dive4elements/river/importer/ImportSedimentLoadLS.java @ 8059:bde5f5ec7c72

SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
author Tom Gottfried <tom@intevation.de>
date Fri, 18 Jul 2014 18:01:49 +0200
parents d86cc6a17b7a
children 5e38e2924c07
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
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
36 private ImportTimeInterval sqTimeInterval;
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
37
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
38 private String description;
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 Integer kind;
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 List<ImportSedimentLoadLSValue> values;
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 private SedimentLoadLS peer;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
45
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
46 public ImportSedimentLoadLS(String description) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
47 this.values = new ArrayList<ImportSedimentLoadLSValue>();
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
48 this.description = description;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
49 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
50
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
51 public void setTimeInterval(ImportTimeInterval timeInterval) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
52 this.timeInterval = timeInterval;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
53 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
54
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
55 public void setSQTimeInterval(ImportTimeInterval sqTimeInterval) {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
56 this.sqTimeInterval = sqTimeInterval;
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
57 }
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
58
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
59 public void setUnit(ImportUnit unit) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
60 this.unit = unit;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
61 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
62
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
63 public void setGrainFraction(ImportGrainFraction grainFraction) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
64 this.grainFraction = grainFraction;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
65 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
66
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
67 public void setKind(Integer kind) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
68 this.kind = kind;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
69 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
70
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
71 public void addValue(ImportSedimentLoadLSValue value) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
72 this.values.add(value);
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
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
75 public void storeDependencies(River river) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
76 log.debug("store dependencies");
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 SedimentLoadLS peer = getPeer(river);
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
79
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
80 if (peer != null) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
81 int i = 0;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
82
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
83 for (ImportSedimentLoadLSValue value : values) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
84 value.storeDependencies(peer);
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
85 i++;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
86 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
87
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
88 log.info("stored " + i + " sediment load values.");
8031
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 }
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 public SedimentLoadLS getPeer(River river) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
93 log.debug("get peer");
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
94
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
95 GrainFraction gf = grainFraction != null ? grainFraction.getPeer()
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
96 : 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 Unit u = unit != null ? unit.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 TimeInterval ti = timeInterval != null ? timeInterval.getPeer() : null;
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
101 TimeInterval sqti = sqTimeInterval != null
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
102 ? sqTimeInterval.getPeer()
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
103 : null;
8031
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 (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
106 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
107 return null;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
108 }
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 if (peer == null) {
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
111 Session session = ImporterSession.getInstance()
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
112 .getDatabaseSession();
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
113
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
114 String sqtquery = sqTimeInterval == null ?
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
115 "sq_time_interval_id is null" :
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
116 "sqTimeInterval = :sqTimeInterval";
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
117 Query query = session.createQuery("from SedimentLoadLS where "
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
118 + " river=:river and "
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
119 + " grainFraction=:grainFraction and "
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
120 + " unit=:unit and "
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
121 + " timeInterval=:timeInterval and "
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
122 + " description=:description and "
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
123 + " kind = :kind and " +
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
124 sqtquery);
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
125
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
126 query.setParameter("river", river);
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
127 query.setParameter("grainFraction", gf);
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
128 query.setParameter("unit", u);
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
129 query.setParameter("timeInterval", ti);
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
130 if (sqti != null) {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
131 query.setParameter("sqTimeInterval", sqti);
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
132 }
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
133 query.setParameter("description", description);
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
134 query.setParameter("kind", kind);
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
135
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
136 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
137 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
138 log.debug("create new SedimentLoadLS");
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
139
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
140 peer = new SedimentLoadLS(river, u, ti, sqti, gf, description);
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
141 peer.setKind(this.kind);
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
142 session.save(peer);
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
143 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
144 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
145 peer = loads.get(0);
8031
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
146 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
147 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
148
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
149 return peer;
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
150 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
151 }
6954ac9b7591 Renamed ImportSedimentYield to ImportSedimentLoadLS.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
152 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org