Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/model/MeasurementStation.java @ 8813:8abe94270f32
Do not filter cross section points for display.
Filtering coordinates outside an extent probably aimed at omitting
outliers from the diagram. This is obsolete and had the side effect of
filtering the important point at x = 0.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 28 Apr 2017 19:03:56 +0200 |
parents | 851ea37d35f3 |
children | 5e38e2924c07 |
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; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
11 import java.util.Iterator; |
6857
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
12 import java.util.List; |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
13 import java.util.ArrayList; |
8418
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
14 import java.util.Collections; |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
15 import java.util.Comparator; |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
16 |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import javax.persistence.Column; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import javax.persistence.Entity; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import javax.persistence.GeneratedValue; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import javax.persistence.GenerationType; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import javax.persistence.Id; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import javax.persistence.JoinColumn; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import javax.persistence.OneToOne; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import javax.persistence.SequenceGenerator; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import javax.persistence.Table; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
6857
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
27 import org.hibernate.Session; |
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
28 import org.hibernate.Query; |
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
29 |
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
30 import org.dive4elements.river.backend.SessionHolder; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
8693
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
32 import org.apache.log4j.Logger; |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
33 |
8418
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
34 import static org.dive4elements.river.backend.utils.EpsilonComparator.CMP; |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
35 |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 @Entity |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 @Table(name = "measurement_station") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public class MeasurementStation { |
8693
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
39 private static final Logger log = Logger.getLogger(MeasurementStation.class); |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 private Integer id; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 private String name; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 private String measurementType; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 private String riverside; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 private String operator; |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
47 private String comment; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 private Range range; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 private Gauge gauge; |
5457
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
52 private String gaugeName; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 private TimeInterval observationTimerange; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
8665
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
56 public static final String MEASUREMENT_TYPE_BEDLOAD = "Geschiebe"; |
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
57 public static final String MEASUREMENT_TYPE_SUSP = "Schwebstoff"; |
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
58 |
8418
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
59 public static final class MeasurementStationComparator |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
60 implements Comparator<MeasurementStation> { |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
61 |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
62 public MeasurementStationComparator() { |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
63 } |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
64 |
8665
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
65 /* Compare MeasurementStations by km and consider MeasurementStations |
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
66 of type "Geschiebe" as smaller if at same km. */ |
8418
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
67 @Override |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
68 public int compare(MeasurementStation m1, MeasurementStation m2) |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
69 throws IllegalArgumentException { |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
70 |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
71 if (m1.getRange().getRiver() != m2.getRange().getRiver()) { |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
72 throw new IllegalArgumentException( |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
73 "Stations not at same river"); |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
74 } |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
75 |
8693
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
76 int cmpStations = CMP.compare(m1.retrieveKm(), m2.retrieveKm()); |
8418
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
77 if (cmpStations == 0) { |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
78 if (m1.getMeasurementType().equals(m2.getMeasurementType())) { |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
79 throw new IllegalArgumentException( |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
80 "Two stations of same type at same km"); |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
81 } |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
82 |
8665
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
83 return m1.getMeasurementType().equals(MEASUREMENT_TYPE_BEDLOAD) |
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
84 ? -1 |
8fbc0649da13
Move static measurement types to their natural home.
Tom Gottfried <tom@intevation.de>
parents:
8602
diff
changeset
|
85 : +1; |
8418
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
86 } |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
87 return cmpStations; |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
88 } |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
89 } |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
90 |
4261
1264fef59bfa
Add default constructor to MeasurementStation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4193
diff
changeset
|
91 public MeasurementStation() { |
1264fef59bfa
Add default constructor to MeasurementStation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4193
diff
changeset
|
92 } |
1264fef59bfa
Add default constructor to MeasurementStation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4193
diff
changeset
|
93 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
94 public MeasurementStation(String name, String measurementType, |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
95 String riverside, Range range, Gauge gauge, |
5457
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
96 String gaugeName, TimeInterval observationTimerange, String operator, |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
97 String comment |
5457
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
98 ) { |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 this.name = name; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 this.measurementType = measurementType; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 this.riverside = riverside; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 this.range = range; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 this.gauge = gauge; |
5457
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
104 this.gaugeName = gaugeName; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 this.observationTimerange = observationTimerange; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 this.operator = operator; |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
107 this.comment = comment; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 @Id |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 @SequenceGenerator(name = "SEQ_MEASUREMENT_STATION_ID_SEQ", sequenceName = "MEASUREMENT_STATION_ID_SEQ", allocationSize = 1) |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_MEASUREMENT_STATION_ID_SEQ") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 @Column(name = "id") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 public Integer getId() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 return id; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 public void setId(Integer id) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 this.id = id; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 @Column(name = "name") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 public String getName() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 return name; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 public void setName(String name) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 this.name = name; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 @Column(name = "measurement_type") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 public String getMeasurementType() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 return measurementType; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 public void setMeasurementType(String measurementType) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 this.measurementType = measurementType; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 @Column(name = "riverside") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 public String getRiverside() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 return riverside; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 public void setRiverside(String riverside) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 this.riverside = riverside; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 @OneToOne |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 @JoinColumn(name = "reference_gauge_id") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 public Gauge getGauge() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 return gauge; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 public void setGauge(Gauge gauge) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 this.gauge = gauge; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 |
5457
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
159 @Column(name = "reference_gauge_name") |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
160 public String getGaugeName() { |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
161 return gaugeName; |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
162 } |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
163 |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
164 public void setGaugeName(String gaugeName) { |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
165 this.gaugeName = gaugeName; |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
166 } |
1b676aefaf3a
Added gauge name to measurement station parser and model.
Raimund Renkert <rrenkert@intevation.de>
parents:
5428
diff
changeset
|
167 |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 @OneToOne |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 @JoinColumn(name = "range_id") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 public Range getRange() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 return range; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 public void setRange(Range range) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 this.range = range; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 @OneToOne |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
179 @JoinColumn(name = "time_interval_id") |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 public TimeInterval getObservationTimerange() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 return observationTimerange; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 public void setObservationTimerange(TimeInterval observationTimerange) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 this.observationTimerange = observationTimerange; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 @Column(name = "operator") |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 public String getOperator() { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 return operator; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 public void setOperator(String operator) { |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 this.operator = operator; |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 |
8415
ffbeffe2d266
SCHEMA CHANGE: 'comment' is not acceptable as column name for Oracle.
Tom Gottfried <tom@intevation.de>
parents:
8412
diff
changeset
|
197 @Column(name = "commentary") |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
198 public String getComment() { |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
199 return comment; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 } |
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
202 public void setComment(String comment) { |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
203 this.comment = comment; |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 } |
6857
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
205 |
8693
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
206 /* Get the actual location of the measurement station at the river */ |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
207 public double retrieveKm() { |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
208 // In case river is km_up, station is at larger value of range |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
209 return getRange().getRiver().getKmUp() && getRange().getB() != null |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
210 ? getRange().getB().doubleValue() |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
211 : getRange().getA().doubleValue(); |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
212 } |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
213 |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
214 /* Get measurement station of other type at the same location */ |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
215 public MeasurementStation findCompanionStation() { |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
216 River river = getRange().getRiver(); |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
217 double km = retrieveKm(); |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
218 List<MeasurementStation> stations = getStationsAtKM(river, km); |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
219 |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
220 for (MeasurementStation station: stations) { |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
221 if (!station.getMeasurementType().equals(getMeasurementType())) { |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
222 return station; |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
223 } |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
224 } |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
225 log.debug("No additional stations found at km " + km + |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
226 " at river " + river); |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
227 return null; |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
228 } |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
229 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
230 public static List<MeasurementStation> getStationsAtRiver(River river) { |
6857
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
231 Session session = SessionHolder.HOLDER.get(); |
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
232 |
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
233 Query query = session.createQuery( |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
234 "from MeasurementStation " + |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
235 "where range.river = :river"); |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
236 query.setParameter("river", river); |
6857
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
237 |
8418
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
238 List<MeasurementStation> result = query.list(); |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
239 Collections.sort(result, new MeasurementStationComparator()); |
536a1c0c8a81
Give ordered list of measurement stations at river.
Tom Gottfried <tom@intevation.de>
parents:
8415
diff
changeset
|
240 return result; |
6857
d5d717effa06
(issue1347) Add measurement station getter for location
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
241 } |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
242 |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
243 public static List<MeasurementStation> getStationsAtKM( |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
244 River river, |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
245 Double river_km |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
246 ) { |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
247 Session session = SessionHolder.HOLDER.get(); |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
248 |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
249 Query query = session.createQuery( |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
250 "from MeasurementStation where range.river = :river"); |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
251 query.setParameter("river", river); |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
252 |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
253 List<MeasurementStation> result = new ArrayList<MeasurementStation>(); |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
254 for (Iterator iter = query.iterate(); iter.hasNext();) { |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
255 MeasurementStation st = (MeasurementStation)iter.next(); |
8693
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
256 if (CMP.compare(st.retrieveKm(), river_km) == 0) { |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
257 result.add(st); |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
258 } |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
259 } |
8693
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
260 |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
261 if (result.size() > 2) { |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
262 // TODO: database schema should prevent this |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
263 log.warn("More than two measurement stations at km " + river_km + |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
264 " at river " + river.getName()); |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
265 } |
851ea37d35f3
(issue1750) New methods for finding the actual location and companion station of a measurement station.
Tom Gottfried <tom@intevation.de>
parents:
8665
diff
changeset
|
266 |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
267 return result; |
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
6857
diff
changeset
|
268 } |
4193
f63b39799d2d
Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 } |