annotate backend/src/main/java/org/dive4elements/river/importer/ImportBedHeight.java @ 9038:4c5eeaff554c

Database column "comment" renamed to "notes" (restrictions in Oracle)
author mschaefer
date Wed, 02 May 2018 06:56:21 +0200
parents 392bbcd8a88b
children
rev   line source
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
2 * Software engineering by Intevation GmbH
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
3 *
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
7 */
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
8
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
9 package org.dive4elements.river.importer;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
10
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
11 import java.util.ArrayList;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
12 import java.util.List;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
13
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
14 import org.apache.log4j.Logger;
8986
392bbcd8a88b Database inserts accelerated by suppressing unnecessary database queries for new data series
mschaefer
parents: 8975
diff changeset
15 import org.dive4elements.river.importer.common.StoreMode;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
16 import org.dive4elements.river.model.BedHeight;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
17 import org.dive4elements.river.model.BedHeightType;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
18 import org.dive4elements.river.model.ElevationModel;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
19 import org.dive4elements.river.model.Range;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
20 import org.dive4elements.river.model.River;
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
21 import org.hibernate.Query;
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
22 import org.hibernate.Session;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
23
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
24
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
25 public class ImportBedHeight
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
26 {
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
27 private static Logger log = Logger.getLogger(ImportBedHeight.class);
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
28
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
29 protected Integer year;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
30
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
31 protected String evaluationBy;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
32 protected String description;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
33
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
34 protected ImportRange range;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
35 protected ImportBedHeightType type;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
36 protected ImportLocationSystem locationSystem;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
37 protected ImportElevationModel curElevationModel;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
38 protected ImportElevationModel oldElevationModel;
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
39 protected String sounding_width_info;
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8986
diff changeset
40 protected String notes;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
41
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
42 protected List<ImportBedHeightValue> values;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
43
8986
392bbcd8a88b Database inserts accelerated by suppressing unnecessary database queries for new data series
mschaefer
parents: 8975
diff changeset
44 protected StoreMode storeMode;
392bbcd8a88b Database inserts accelerated by suppressing unnecessary database queries for new data series
mschaefer
parents: 8975
diff changeset
45
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
46 protected BedHeight peer;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
47
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
48
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
49 public ImportBedHeight(final String description) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
50 this.description = description;
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
51 this.values = new ArrayList<>();
8986
392bbcd8a88b Database inserts accelerated by suppressing unnecessary database queries for new data series
mschaefer
parents: 8975
diff changeset
52 this.storeMode = StoreMode.NONE;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
53 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
54
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
55
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
56 public String getDescription() {
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
57 return this.description;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
58 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
59
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
60 public int getValueCount() {
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
61 return this.values.size();
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
62 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
63
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
64
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
65 public void setYear(final int year) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
66 this.year = year;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
67 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
68
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
69 public void setTimeInterval(final ImportTimeInterval timeInterval) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
70 // do nothing
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
71 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
72
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
73 public void setEvaluationBy(final String evaluationBy) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
74 this.evaluationBy = evaluationBy;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
75 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
76
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
77 public void setDescription(final String description) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
78 this.description = description;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
79 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
80
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
81 public void setRange(final ImportRange range) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
82 this.range = range;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
83 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
84
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
85 public void setType(final ImportBedHeightType type) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
86 this.type = type;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
87 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
88
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
89 public void setLocationSystem(final ImportLocationSystem locationSystem) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
90 this.locationSystem = locationSystem;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
91 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
92
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
93 public void setCurElevationModel(final ImportElevationModel curElevationModel) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
94 this.curElevationModel = curElevationModel;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
95 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
96
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
97 public void setOldElevationModel(final ImportElevationModel oldElevationModel) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
98 this.oldElevationModel = oldElevationModel;
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
99 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
100
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
101 public void setSoundingWidthInfo(final String sounding_width_info) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
102 this.sounding_width_info = sounding_width_info;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
103 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
104
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8986
diff changeset
105 public void setNotes(final String notes) {
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8986
diff changeset
106 this.notes = notes;
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
107 }
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
108
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
109 public void addValue(final ImportBedHeightValue value) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
110 this.values.add(value);
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
111 }
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
112
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
113 public void storeDependencies(final River river) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
114 log.info("Store dependencies for single: '" + getDescription() + "'");
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
115
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
116 if (this.type != null) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
117 this.type.storeDependencies();
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
118 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
119
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
120 if (this.locationSystem != null) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
121 this.locationSystem.storeDependencies();
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
122 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
123
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
124 if (this.curElevationModel != null) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
125 this.curElevationModel.storeDependencies();
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
126 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
127
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
128 if (this.oldElevationModel != null) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
129 this.oldElevationModel.storeDependencies();
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
130 }
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
131
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
132 final BedHeight peer = getPeer(river);
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
133
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
134 if (peer != null) {
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
135 for (final ImportBedHeightValue value: this.values) {
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
136 value.storeDependencies(peer);
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
137 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
138 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
139
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
140 final Session session = ImporterSession.getInstance().getDatabaseSession();
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
141 session.flush();
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
142 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
143
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
144 public BedHeight getPeer(final River river) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
145 if (this.peer != null)
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
146 return null;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
147
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
148 final BedHeightType theType = this.type != null ? this.type.getPeer() : null;
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
149 final ElevationModel theCurModel = this.curElevationModel.getPeer();
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
150 final Range theRange = (this.range != null) ? this.range.getPeer(river) : null;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
151
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
152 if (theType == null) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
153 log.warn("BHS: No bed height type given. Skip file '" + this.description + "'");
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
154 return null;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
155 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
156
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
157 if (theCurModel == null) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
158 log.warn("BHS: No elevation model given. Skip file '" + this.description + "'");
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
159 return null;
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
160 }
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
161
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
162 if (theRange == null) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
163 log.warn("BHS: No km-range given: '" + this.description + "'");
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
164 }
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
165
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
166 final Session session = ImporterSession.getInstance().getDatabaseSession();
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
167
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
168 final Query query = session.createQuery("FROM BedHeight WHERE (river=:river) AND (year=:year)"
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
169 + " AND (type=:type) AND (locationSystem=:locationSystem)"
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
170 + " AND (curElevationModel=:curElevationModel) AND (range=:range)");
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
171 query.setParameter("river", river);
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
172 query.setParameter("year", this.year);
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
173 query.setParameter("type", theType);
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
174 query.setParameter("locationSystem", this.locationSystem.getPeer());
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
175 query.setParameter("curElevationModel", theCurModel);
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
176 query.setParameter("range", this.range.getPeer(river));
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
177
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
178 final List<BedHeight> bedHeights = query.list();
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
179 if (bedHeights.isEmpty()) {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
180 log.info("Create new BedHeight DB instance.");
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
181 this.peer = new BedHeight(river, this.year, theType, this.locationSystem.getPeer(), theCurModel,
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
182 (this.oldElevationModel != null) ? this.oldElevationModel.getPeer() : null, this.range.getPeer(river),
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8986
diff changeset
183 this.evaluationBy, this.description, this.sounding_width_info, this.notes);
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
184 session.save(this.peer);
8986
392bbcd8a88b Database inserts accelerated by suppressing unnecessary database queries for new data series
mschaefer
parents: 8975
diff changeset
185 this.storeMode = StoreMode.INSERT;
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
186 }
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
187 else {
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
188 this.peer = bedHeights.get(0);
8986
392bbcd8a88b Database inserts accelerated by suppressing unnecessary database queries for new data series
mschaefer
parents: 8975
diff changeset
189 this.storeMode = StoreMode.UPDATE;
8975
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
190 }
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
191
a0a0a7f912ab Added new columns bed_height.comment and sounding_width_info; extended the bed height parser for the new meta data and the min/max_height columns
mschaefer
parents: 8856
diff changeset
192 return this.peer;
8559
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
193 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
194 }
6d8d7425a6b5 Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
diff changeset
195 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org