annotate flys-backend/src/main/java/de/intevation/flys/model/BedHeightEpoch.java @ 4837:9e25c7523485

Fixed calculation of effective width in MINFO SQ relation. * Get all (including empty datasets) from db. * Filter empty datasets when processing data of the same date. * Added debug outputs.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 23 Jan 2013 11:14:41 +0100
parents b9a99fcc78c3
children
rev   line source
2810
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.model;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.ArrayList;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.util.List;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import javax.persistence.Entity;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import javax.persistence.Id;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import javax.persistence.Table;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import javax.persistence.GeneratedValue;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import javax.persistence.Column;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import javax.persistence.SequenceGenerator;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import javax.persistence.GenerationType;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import javax.persistence.JoinColumn;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import javax.persistence.OneToOne;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import javax.persistence.OneToMany;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
19 import org.hibernate.Session;
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
20 import org.hibernate.Query;
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
21
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
22 import de.intevation.flys.backend.SessionHolder;
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
23
2810
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 @Entity
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 @Table(name = "bed_height_epoch")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public class BedHeightEpoch implements Serializable {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 private Integer id;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 private River river;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 private TimeInterval timeInterval;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 private ElevationModel curElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 private ElevationModel oldElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 private Range range;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 private String evaluationBy;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 private String description;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 private List<BedHeightEpochValue> values;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 public BedHeightEpoch() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 public BedHeightEpoch(
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 River river,
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 TimeInterval timeInterval,
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 Range range,
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 ElevationModel curElevationModel,
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 ElevationModel oldElevationModel,
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 String evaluationBy,
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 String description
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 ) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 this.river = river;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 this.timeInterval = timeInterval;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 this.range = range;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 this.curElevationModel = curElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 this.oldElevationModel = oldElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 this.evaluationBy = evaluationBy;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 this.description = description;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 this.values = new ArrayList<BedHeightEpochValue>();
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 @Id
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 @SequenceGenerator(
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 name = "SEQUENCE_BED_HEIGHT_EPOCH_ID_SEQ",
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 sequenceName = "BED_HEIGHT_EPOCH_ID_SEQ",
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 allocationSize = 1)
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 @GeneratedValue(
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 strategy = GenerationType.SEQUENCE,
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 generator = "SEQUENCE_BED_HEIGHT_EPOCH_ID_SEQ")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 @Column(name = "id")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 public Integer getId() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 return id;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 public void setId(Integer id) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 this.id = id;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 @OneToOne
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 @JoinColumn(name = "river_id" )
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 public River getRiver() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 return river;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 public void setRiver(River river) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 this.river = river;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 @OneToOne
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 @JoinColumn(name = "time_interval_id")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 public TimeInterval getTimeInterval() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 return timeInterval;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 public void setTimeInterval(TimeInterval timeInterval) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 this.timeInterval = timeInterval;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 @OneToOne
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 @JoinColumn(name = "cur_elevation_model_id")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 public ElevationModel getCurElevationModel() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 return curElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 public void setCurElevationModel(ElevationModel curElevationModel) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 this.curElevationModel = curElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 @OneToOne
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 @JoinColumn(name = "old_elevation_model_id")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 public ElevationModel getOldElevationModel() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 return oldElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 public void setOldElevationModel(ElevationModel oldElevationModel) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 this.oldElevationModel = oldElevationModel;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 @OneToOne
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 @JoinColumn(name = "range_id")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 public Range getRange() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 return range;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 public void setRange(Range range) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 this.range = range;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 @Column(name = "evaluation_by")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 public String getEvaluationBy() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 return evaluationBy;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 public void setEvaluationBy(String evaluationBy) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 this.evaluationBy = evaluationBy;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 @Column(name = "description")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 public String getDescription() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 return description;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 public void setDescription(String description) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 this.description = description;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 @OneToMany
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 @JoinColumn(name = "bed_height_epoch_id")
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 public List<BedHeightEpochValue> getValues() {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 return values;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 public void setValues(List<BedHeightEpochValue> values) {
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 this.values = values;
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 }
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
164
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
165
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
166 public static List<BedHeightEpoch> getBedHeightEpochs(
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
167 River river,
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
168 double kmLo,
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
169 double 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
170 ) {
2872
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
171 Session session = SessionHolder.HOLDER.get();
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
172
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
173 Query query = session.createQuery(
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
174 "from BedHeightEpoch where 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: 2810
diff changeset
175
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
176 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: 2810
diff changeset
177
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
178 // 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
179
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
180 List<BedHeightEpoch> epochs = query.list();
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
181 List<BedHeightEpoch> good = new ArrayList<BedHeightEpoch>();
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
182
3799
b9a99fcc78c3 Fixed broken loops to find the bed height epochs and singles for a given river and km range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2875
diff changeset
183 OUTER: for (BedHeightEpoch e: epochs) {
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
184 for (BedHeightEpochValue value: e.getValues()) {
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
185 double station = value.getStation().doubleValue();
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
186
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
187 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
188 good.add(e);
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
189 continue OUTER;
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
190 }
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
191 }
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
192 }
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
193
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
194 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: 2810
diff changeset
195 }
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
196
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
197
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
198 public static BedHeightEpoch getBedHeightEpochById(int id) {
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
199 Session session = SessionHolder.HOLDER.get();
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
200
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
201 Query query = session.createQuery(
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
202 "from BedHeightEpoch where 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: 2810
diff changeset
203
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
204 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: 2810
diff changeset
205
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
206 List<BedHeightEpoch> singles = query.list();
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
207
bcfdaa3a5bfc Added functions to BedHeightSingle and BedHeightEpoch to get instances from db by id or river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2810
diff changeset
208 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: 2810
diff changeset
209 }
2810
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 }
04eeb45df27b Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org