annotate backend/src/main/java/org/dive4elements/river/model/BedHeight.java @ 9038:4c5eeaff554c

Database column "comment" renamed to "notes" (restrictions in Oracle)
author mschaefer
date Wed, 02 May 2018 06:56:21 +0200
parents a0a0a7f912ab
children 766890addcb2
rev   line source
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5992
4c3ccf2b0304 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5844
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5992
4c3ccf2b0304 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5844
diff changeset
6 * documentation coming with Dive4Elements River for details.
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5829
18619c1e7c2a Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5828
diff changeset
9 package org.dive4elements.river.model;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.io.Serializable;
2875
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
12 import java.util.ArrayList;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import java.util.List;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
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: 8942
diff changeset
15 import javax.persistence.Column;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import javax.persistence.Entity;
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: 8942
diff changeset
17 import javax.persistence.GeneratedValue;
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: 8942
diff changeset
18 import javax.persistence.GenerationType;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import javax.persistence.Id;
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: 8942
diff changeset
20 import javax.persistence.JoinColumn;
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: 8942
diff changeset
21 import javax.persistence.OneToMany;
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: 8942
diff changeset
22 import javax.persistence.OneToOne;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import javax.persistence.SequenceGenerator;
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: 8942
diff changeset
24 import javax.persistence.Table;
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
25
5829
18619c1e7c2a Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5828
diff changeset
26 import org.dive4elements.river.backend.SessionHolder;
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: 8942
diff changeset
27 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: 8942
diff changeset
28 import org.hibernate.Session;
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
29
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 @Entity
8560
6fcf4717605f Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
"Tom Gottfried <tom@intevation.de>"
parents: 5992
diff changeset
32 @Table(name = "bed_height")
6fcf4717605f Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
"Tom Gottfried <tom@intevation.de>"
parents: 5992
diff changeset
33 public class BedHeight implements Serializable {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 private Integer id;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 private Integer year;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 private String evaluationBy;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 private String description;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 private River river;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 private BedHeightType type;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 private LocationSystem locationSystem;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 private ElevationModel curElevationModel;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 private ElevationModel oldElevationModel;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 private Range range;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
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: 8942
diff changeset
53 private String sounding_width_info;
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
54 private String 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: 8942
diff changeset
55
8560
6fcf4717605f Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
"Tom Gottfried <tom@intevation.de>"
parents: 5992
diff changeset
56 private List<BedHeightValue> values;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
8560
6fcf4717605f Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
"Tom Gottfried <tom@intevation.de>"
parents: 5992
diff changeset
59 public BedHeight() {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
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: 8942
diff changeset
63 public BedHeight(final River river, final Integer year, final BedHeightType type, final 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: 8942
diff changeset
64 final ElevationModel curElevationModel,
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: 8942
diff changeset
65 final 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: 8942
diff changeset
66 this(river, year, type, locationSystem, curElevationModel, null, range, null, null, null, null);
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
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: 8942
diff changeset
70 public BedHeight(final River river, final Integer year, final BedHeightType type, final LocationSystem locationSystem,
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
71 final ElevationModel curElevationModel, final ElevationModel oldElevationModel, final Range range, final String evaluationBy,
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
72 final String description, final String sounding_width_info, final String notes) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 this.river = river;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 this.year = year;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 this.type = type;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 this.locationSystem = locationSystem;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 this.curElevationModel = curElevationModel;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 this.oldElevationModel = oldElevationModel;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 this.range = range;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 this.evaluationBy = evaluationBy;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 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: 8942
diff changeset
82 this.sounding_width_info = sounding_width_info;
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
83 this.notes = notes;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 @Id
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: 8942
diff changeset
88 @SequenceGenerator(name = "SEQUENCE_BED_HEIGHT_ID_SEQ", sequenceName = "BED_HEIGHT_ID_SEQ", allocationSize = 1)
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: 8942
diff changeset
89 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQUENCE_BED_HEIGHT_ID_SEQ")
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 @Column(name = "id")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 public Integer getId() {
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: 8942
diff changeset
92 return this.id;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
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: 8942
diff changeset
95 public void setId(final Integer id) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 this.id = id;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 @OneToOne
8842
ff27548d078c Whitespace cosmetics.
Tom Gottfried <tom@intevation.de>
parents: 8560
diff changeset
100 @JoinColumn(name = "river_id")
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 public River getRiver() {
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: 8942
diff changeset
102 return this.river;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
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: 8942
diff changeset
105 public void setRiver(final River river) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 this.river = river;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 @Column(name = "year")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 public Integer getYear() {
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: 8942
diff changeset
111 return this.year;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
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: 8942
diff changeset
114 public void setYear(final Integer year) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 this.year = year;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 @OneToOne
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 @JoinColumn(name = "type_id")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 public BedHeightType getType() {
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: 8942
diff changeset
121 return this.type;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@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: 8942
diff changeset
124 public void setType(final BedHeightType type) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 this.type = type;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 @OneToOne
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 @JoinColumn(name = "location_system_id")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 public LocationSystem getLocationSystem() {
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: 8942
diff changeset
131 return this.locationSystem;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
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: 8942
diff changeset
134 public void setLocationSystem(final LocationSystem locationSystem) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 this.locationSystem = locationSystem;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 @OneToOne
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 @JoinColumn(name = "cur_elevation_model_id")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 public ElevationModel getCurElevationModel() {
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: 8942
diff changeset
141 return this.curElevationModel;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@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: 8942
diff changeset
144 public void setCurElevationModel(final ElevationModel curElevationModel) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 this.curElevationModel = curElevationModel;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 @OneToOne
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 @JoinColumn(name = "old_elevation_model_id")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 public ElevationModel getOldElevationModel() {
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: 8942
diff changeset
151 return this.oldElevationModel;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153
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: 8942
diff changeset
154 public void setOldElevationModel(final ElevationModel oldElevationModel) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 this.oldElevationModel = oldElevationModel;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 @OneToOne
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 @JoinColumn(name = "range_id")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 public Range getRange() {
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: 8942
diff changeset
161 return this.range;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163
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: 8942
diff changeset
164 public void setRange(final Range range) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 this.range = range;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 @Column(name = "evaluation_by")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 public String getEvaluationBy() {
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: 8942
diff changeset
170 return this.evaluationBy;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172
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: 8942
diff changeset
173 public void setEvaluationBy(final String evaluationBy) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 this.evaluationBy = evaluationBy;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 @Column(name = "description")
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 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: 8942
diff changeset
179 return this.description;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181
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: 8942
diff changeset
182 public void setDescription(final String description) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 this.description = description;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185
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: 8942
diff changeset
186 @Column(name = "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: 8942
diff changeset
187 public String getSoundingWidthInfo() {
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: 8942
diff changeset
188 return this.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: 8942
diff changeset
189 }
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: 8942
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: 8942
diff changeset
191 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: 8942
diff changeset
192 this.sounding_width_info = 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: 8942
diff changeset
193 }
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: 8942
diff changeset
194
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
195 @Column(name = "notes")
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
196 public String getNotes() {
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
197 return 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: 8942
diff changeset
198 }
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: 8942
diff changeset
199
9038
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
200 public void setNotes(final String notes) {
4c5eeaff554c Database column "comment" renamed to "notes" (restrictions in Oracle)
mschaefer
parents: 8975
diff changeset
201 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: 8942
diff changeset
202 }
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: 8942
diff changeset
203
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 @OneToMany
8560
6fcf4717605f Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
"Tom Gottfried <tom@intevation.de>"
parents: 5992
diff changeset
205 @JoinColumn(name = "bed_height_id")
6fcf4717605f Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
"Tom Gottfried <tom@intevation.de>"
parents: 5992
diff changeset
206 public List<BedHeightValue> getValues() {
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: 8942
diff changeset
207 return this.values;
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 }
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209
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: 8942
diff changeset
210 public void setValues(final List<BedHeightValue> values) {
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 this.values = values;
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 }
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
213
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
214
8560
6fcf4717605f Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
"Tom Gottfried <tom@intevation.de>"
parents: 5992
diff changeset
215 public static List<BedHeight> getBedHeights(
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: 8942
diff changeset
216 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: 8942
diff changeset
217 final double kmLo,
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: 8942
diff changeset
218 final double kmHi
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: 8942
diff changeset
219 ) {
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: 8942
diff changeset
220 final Session session = SessionHolder.HOLDER.get();
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
221
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: 8942
diff changeset
222 final Query query = session.createQuery(
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: 8942
diff changeset
223 "from BedHeight where river=:river");
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
224
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
225 query.setParameter("river", river);
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
226
2875
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
227 // TODO Do km range filtering in SQL statement
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
228
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: 8942
diff changeset
229 final List<BedHeight> singles = 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: 8942
diff changeset
230 final List<BedHeight> good = new ArrayList<>();
2875
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
231
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: 8942
diff changeset
232 for (final BedHeight s: singles) {
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: 8942
diff changeset
233 for (final BedHeightValue value: s.getValues()) {
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: 8942
diff changeset
234 final double station = value.getStation().doubleValue();
2875
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
235
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
236 if (station >= kmLo && station <= kmHi) {
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
237 good.add(s);
3952
5d8db3349b77 Backend: Code simplification. Removed trailing whietspace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3799
diff changeset
238 break;
2875
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
239 }
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
240 }
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
241 }
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
242
444e52222941 Added lower and upper km to functions that return bed height singles and epochs for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2872
diff changeset
243 return good;
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
244 }
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
245
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
246
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: 8942
diff changeset
247 public static BedHeight getBedHeightById(final int id) {
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: 8942
diff changeset
248 final Session session = SessionHolder.HOLDER.get();
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
249
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: 8942
diff changeset
250 final Query query = session.createQuery(
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: 8942
diff changeset
251 "from BedHeight where id=:id");
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
252
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
253 query.setParameter("id", id);
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
254
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: 8942
diff changeset
255 final List<BedHeight> singles = query.list();
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
256
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
257 return singles != null ? singles.get(0) : null;
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2809
diff changeset
258 }
8942
11bf13cf0463 Minor changes to tkh calculation. Loading default bed heights form config file.
gernotbelger
parents: 8842
diff changeset
259
11bf13cf0463 Minor changes to tkh calculation. Loading default bed heights form config file.
gernotbelger
parents: 8842
diff changeset
260 public static BedHeight getBedHeightByDescription(final String 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: 8942
diff changeset
261
8942
11bf13cf0463 Minor changes to tkh calculation. Loading default bed heights form config file.
gernotbelger
parents: 8842
diff changeset
262 final Session session = SessionHolder.HOLDER.get();
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: 8942
diff changeset
263
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: 8942
diff changeset
264 final Query query = session.createQuery("FROM BedHeight WHERE (trim(description)=:description)");
8942
11bf13cf0463 Minor changes to tkh calculation. Loading default bed heights form config file.
gernotbelger
parents: 8842
diff changeset
265 query.setParameter("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: 8942
diff changeset
266
8942
11bf13cf0463 Minor changes to tkh calculation. Loading default bed heights form config file.
gernotbelger
parents: 8842
diff changeset
267 final List<BedHeight> singles = query.list();
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: 8942
diff changeset
268
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: 8942
diff changeset
269 return singles != null ? singles.get(0) : null;
8942
11bf13cf0463 Minor changes to tkh calculation. Loading default bed heights form config file.
gernotbelger
parents: 8842
diff changeset
270 }
2809
f283212966e8 Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271 }
8942
11bf13cf0463 Minor changes to tkh calculation. Loading default bed heights form config file.
gernotbelger
parents: 8842
diff changeset
272 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org