annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java @ 3141:3582e87e9171

FixA: Made GaugeRange a top level class. flys-artifacts/trunk@4749 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 21 Jun 2012 15:39:34 +0000
parents 9c147bbffc36
children 9aed2e4de3ca
rev   line source
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import java.text.SimpleDateFormat;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 import java.util.ArrayList;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import java.util.Collections;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import java.util.Comparator;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 import java.util.Date;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 import java.util.List;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 import org.hibernate.SQLQuery;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 import org.hibernate.Session;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 import org.hibernate.type.StandardBasicTypes;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Document;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 import org.w3c.dom.Element;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 public class FixingsOverview
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 implements Serializable
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 private static Logger log = Logger.getLogger(FixingsOverview.class);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
3141
3582e87e9171 FixA: Made GaugeRange a top level class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3138
diff changeset
28 public static final double EPSILON = 1e-1;
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29
2632
7d163c2c6e6d Improve XSL transformation for fixings overview output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2613
diff changeset
30 public static final String DATE_FORMAT = "dd.MM.yyyy";
2564
3f038d54bc87 FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2563
diff changeset
31
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 public static final String SQL_RIVER_ID =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 "SELECT" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 " id AS river_id," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 " km_up " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 "FROM rivers " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 "WHERE" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 " name = :name";
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 public static final String SQL_GAUGES =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 "SELECT" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 " g.id AS gauge_id," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 " r.a AS a," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 " r.b AS b " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 "FROM gauges g" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 " JOIN ranges r ON g.range_id = r.id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 "WHERE" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 " g.river_id = :river_id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 "ORDER BY r.a";
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 public static final String SQL_DISCHARGE_SECTORS =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 "SELECT" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 " g.id AS gauge_id," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 " nmv.name AS name," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 " CAST(mv.value AS NUMERIC(38,2)) AS value " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 "FROM gauges g" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 " JOIN main_values mv ON g.id = mv.gauge_id" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 " JOIN named_main_values nmv ON nmv.id = mv.named_value_id" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 " JOIN main_value_types mvt ON nmv.type_id = mvt.id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 "WHERE" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 " mvt.name = 'Q' AND (" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 " nmv.name = 'MNQ' OR" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 " nmv.name LIKE 'MNQ(%' OR" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 " nmv.name = 'MQ' OR" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 " nmv.name LIKE 'MQ(%' OR" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 " nmv.name = 'MHQ' OR" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 " nmv.name LIKE 'MHQ(%' OR" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 " nmv.name = 'HQ5' OR" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 " nmv.name LIKE 'HQ5(%') AND" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 " g.river_id = :river_id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 "ORDER BY" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 " g.id";
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 public static final String SQL_FIXINGS =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 "SELECT" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 " id AS wst_id," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 " description " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 "FROM wsts " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 "WHERE" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 " river_id = :river_id AND kind = 2";
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 public static final String SQL_FIXING_COLUMNS =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 "SELECT" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 " wc.id AS wst_column_id," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 " ti.start_time AS start_time," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 " wc.name AS name " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 "FROM wst_columns wc" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 " JOIN time_intervals ti ON wc.time_interval_id = ti.id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 "WHERE" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 " wc.wst_id = :wst_id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 "ORDER BY position";
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 public static final String SQL_FIXING_COLUMN_Q_RANGES =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 "SELECT" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 " wqr.q AS q," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 " r.a AS start_km," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 " r.b AS stop_km " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 "FROM wst_column_q_ranges wcqr" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 " JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 " JOIN ranges r ON wqr.range_id = r.id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 "WHERE" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 " wcqr.wst_column_id = :column_id " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 "ORDER BY r.a";
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 public static final String SQL_FIXING_COLUMN_KM_RANGE =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 "SELECT" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 " MIN(position) AS start_km," +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 " MAX(position) AS stop_km " +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 "FROM" +
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 " wst_column_values " +
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
111 "WHERE" +
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 " wst_column_id = :column_id";
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
115 public static class GaugeFinder {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
116
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
117 protected List<GaugeRange> gauges;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
118 protected boolean isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
119
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
120 public GaugeFinder(List<GaugeRange> gauges) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
121 this(gauges, true);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
122 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
123
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
124 public GaugeFinder(
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
125 List<GaugeRange> gauges,
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
126 boolean isKmUp
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
127 ) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
128 this.gauges = gauges;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
129 this.isKmUp = isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
130 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
131
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
132 public boolean getIsKmUp() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
133 return isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
134 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
135
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
136 public void setIsKmUp(boolean isKmUp) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
137 this.isKmUp = isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
138 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
139
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
140 public GaugeRange find(Range range) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
141 double km = isKmUp ? range.start : range.end;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
142 for (GaugeRange gauge: gauges) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
143 if (gauge.inside(km)) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
144 return gauge;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
145 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
146 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
147 return null;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
148 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
149
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
150 public GaugeRange find(int gaugeId) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
151 for (GaugeRange gauge: gauges) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
152 if (gauge.gaugeId == gaugeId) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
153 return gauge;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
154 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
155 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
156 return null;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
157 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
158
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
159 public boolean loadDischargeSectors(Session session, int riverId) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
160
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
161 SQLQuery query = session.createSQLQuery(SQL_DISCHARGE_SECTORS)
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
162 .addScalar("gauge_id", StandardBasicTypes.INTEGER)
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
163 .addScalar("name", StandardBasicTypes.STRING)
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
164 .addScalar("value", StandardBasicTypes.DOUBLE);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
165
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
166 query.setInteger("river_id", riverId);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
167
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
168 List<Object []> list = query.list();
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
169
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
170 if (list.isEmpty()) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
171 log.warn("River " + riverId + " has no discharge sectors.");
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
172 return false;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
173 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
174
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
175 GaugeRange gauge = null;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
176
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
177 for (Object [] row: list) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
178 int gaugeId = (Integer)row[0];
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
179 String label = (String) row[1];
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
180 Double value = (Double) row[2];
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
181
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
182 if (gauge == null || gauge.gaugeId != gaugeId) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
183 if ((gauge = find(gaugeId)) == null) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
184 log.warn("Cannot find gauge for id " + gaugeId + ".");
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
185 continue;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
186 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
187 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
188
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
189 gauge.addMainValue(label, value);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
190 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
191
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
192 for (GaugeRange g: gauges) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
193 g.buildClasses();
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
194 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
195
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
196 return true;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
197 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
198 } // class GaugeFinder
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
199
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
200 public static class QRange extends Range {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202 protected double q;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
204 public QRange() {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
205 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
207 public QRange(double start, double end, double q) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208 super(start, end);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209 this.q = q;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211 } // class QRange
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
213 public static class SectorRange extends Range {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
214
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
215 protected int sector;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
216
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
217 public SectorRange() {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
218 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
219
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
220 public SectorRange(SectorRange other) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
221 start = other.start;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
222 end = other.end;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
223 sector = other.sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
224 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
225
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
226 public SectorRange(double start, double end, int sector) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
227 super(start, end);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
228 this.sector = sector;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
229 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
230
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
231 public int getSector() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
232 return sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
233 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
234
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
235 public boolean enlarge(SectorRange other) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
236 if (sector == other.sector
3141
3582e87e9171 FixA: Made GaugeRange a top level class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3138
diff changeset
237 && Math.abs(end-other.start) < EPSILON) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
238 end = other.end;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
239 return true;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
240 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
241 return false;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
242 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
243 } // class SectorRange
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
244
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
245 public static class Fixing implements Serializable {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
246
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
247 public static final Comparator<Column> DATE_CMP =
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
248 new Comparator<Column>() {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
249 @Override
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
250 public int compare(Column a, Column b) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
251 return a.startTime.compareTo(b.startTime);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
252 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
253 };
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
254
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
255 public interface Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
256
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
257 boolean accept(Column column);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
258
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
259 } // interface Filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
260
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
261 public class Column extends Range {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
262
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 protected int columnId;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
264 protected Date startTime;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 protected String name;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
266
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
267 protected List<SectorRange> sectors;
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
268
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
269 public Column() {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
270 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
271
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272 public Column(int columnId, Date startTime, String name) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273 this.columnId = columnId;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
274 this.startTime = startTime;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
275 this.name = name;
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
276
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
277 sectors = new ArrayList<SectorRange>();
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
278 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
279
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
280 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
281 return columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
282 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
283
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
284 public Fixing getFixing() {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
285 return Fixing.this;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
286 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
288 public Date getStartTime() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
289 return startTime;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
290 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
291
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
292 public String getName() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
293 return name;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
294 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
295
2707
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
296 public String getDescription() {
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
297 return Fixing.this.description + "/" + name;
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
298 }
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
299
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
300 public List<SectorRange> getSectors() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
301 return sectors;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
302 }
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
303
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
304 public List<SectorRange> getSectors(Range range) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
305
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
306 List<SectorRange> result =
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
307 new ArrayList<SectorRange>(sectors.size());
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
308
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
309 for (SectorRange src: sectors) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
310 SectorRange dst = new SectorRange(src);
2613
2e129754d450 Fixed NPE bug in filter builder for fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2608
diff changeset
311 if (range == null || dst.clip(range)) {
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
312 result.add(dst);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
313 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
314 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
315
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
316 return result;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
317 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
318
3002
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
319 public int findQSector(double km) {
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
320 for (SectorRange sector: sectors) {
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
321 if (sector.inside(km)) {
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
322 return sector.getSector();
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
323 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
324 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
325 return -1;
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
326 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
327
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
328 public void buildSectors(GaugeRange gauge, List<QRange> qRanges) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
329
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
330 for (QRange qRange: qRanges) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
331 SectorRange sector = new SectorRange(
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
332 qRange.start, qRange.end,
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
333 gauge.classify(qRange.q));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
334 if (sectors.isEmpty()
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
335 || !sectors.get(sectors.size()-1).enlarge(sector)) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
336 sectors.add(sector);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
337 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
338 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
339 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
340
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
341 public void loadKmRange(SQLQuery query) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
342 query.setInteger("column_id", columnId);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
343
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
344 List<Object []> kms = query.list();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
345
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
346 if (kms.isEmpty()) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
347 log.warn("No km range for column " + columnId + ".");
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
348 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
349 else {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
350 Object [] obj = kms.get(0);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
351 start = (Double)obj[0];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
352 end = (Double)obj[1];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
353 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
354 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
355
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
356 public void loadQRanges(
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
357 SQLQuery query,
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
358 GaugeFinder gaugeFinder
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
359 ) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
360 query.setInteger("column_id", columnId);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
361 List<Object []> list = query.list();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
362
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
363 List<QRange> qRanges = new ArrayList<QRange>(list.size());
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
364
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
365 for (Object [] row: list) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
366 double q = (Double)row[0];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
367 double start = (Double)row[1];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
368 double end = (Double)row[2];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
369 QRange qRange = new QRange(start, end, q);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
370 if (qRange.clip(this)) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
371 qRanges.add(qRange);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
372 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
373 }
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
374
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
375 GaugeRange gauge = gaugeFinder.find(this);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
376
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
377 if (gauge != null) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
378 buildSectors(gauge, qRanges);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
379 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
380 else {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
381 log.warn("No gauge found for column " + columnId + ".");
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
382 }
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
383 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
384 } // class Column
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
385
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
386 protected int wstId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
387 protected String description;
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
388 protected List<Column> columns;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
389
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
390 public Fixing() {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
391 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
392
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
393 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
394 return wstId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
395 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
396
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
397 public String getDescription() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
398 return description;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
399 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
400
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
401 public Fixing(int wstId, String description) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
402 this.wstId = wstId;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
403 this.description = description;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
404 columns = new ArrayList<Column>();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
405 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
406
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
407 public void loadColumns(SQLQuery query) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
408 query.setInteger("wst_id", wstId);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
409 List<Object []> list = query.list();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
410 for (Object [] row: list) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
411 int columnId = (Integer)row[0];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
412 Date startTime = (Date) row[1];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
413 String name = (String) row[2];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
414 columns.add(new Column(columnId, startTime, name));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
415 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
416 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
417
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
418 public void loadColumnsKmRange(SQLQuery query) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
419 for (Column column: columns) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
420 column.loadKmRange(query);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
421 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
422 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
423
2565
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
424 public void adjustExtent(Range extent) {
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
425 for (Column column: columns) {
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
426 extent.extend(column);
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
427 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
428 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
429
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
430 public void loadColumnsQRanges(
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
431 SQLQuery query,
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
432 GaugeFinder gaugeFinder
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
433 ) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
434 for (Column column: columns) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
435 column.loadQRanges(query, gaugeFinder);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
436 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
437 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
438
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
439 public void addAllColumns(
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
440 List<Column> allColumns,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
441 Range range,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
442 Filter filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
443 ) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
444 for (Column column: columns) {
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
445 if ((range == null || column.intersects(range))
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
446 && (filter == null || filter.accept(column))) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
447 allColumns.add(column);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
448 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
449 }
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
450 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
451 } // class Fixing
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
452
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
453
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
454 protected String riverName;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
455 protected int riverId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
456 protected boolean isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
457 protected List<Fixing> fixings;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
458 protected Range extent;
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
459
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
460 public FixingsOverview() {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
461 fixings = new ArrayList<Fixing>();
2565
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
462 extent = new Range(Double.MAX_VALUE, -Double.MAX_VALUE);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
463 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
464
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
465 public FixingsOverview(String riverName) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
466 this();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
467 this.riverName = riverName;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
468 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
469
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
470 protected boolean loadRiver(Session session) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
471 SQLQuery query = session.createSQLQuery(SQL_RIVER_ID)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
472 .addScalar("river_id", StandardBasicTypes.INTEGER)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
473 .addScalar("km_up", StandardBasicTypes.BOOLEAN);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
474
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
475 query.setString("name", riverName);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
476
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
477 List<Object []> list = query.list();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
478
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
479 if (list.isEmpty()) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
480 log.warn("No river '" + riverName + "' found.");
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
481 return false;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
482 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
483
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
484 Object [] row = list.get(0);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
485
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
486 riverId = (Integer)row[0];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
487 isKmUp = (Boolean)row[1];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
488
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
489 return true;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
490 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
491
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
492 protected GaugeFinder loadGauges(Session session) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
493 SQLQuery query = session.createSQLQuery(SQL_GAUGES)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
494 .addScalar("gauge_id", StandardBasicTypes.INTEGER)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
495 .addScalar("a", StandardBasicTypes.DOUBLE)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
496 .addScalar("b", StandardBasicTypes.DOUBLE);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
497
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
498 query.setInteger("river_id", riverId);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
499
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
500 List<Object []> list = query.list();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
501
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
502 if (list.isEmpty()) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
503 log.warn("River " + riverId + " has no gauges.");
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
504 return null;
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
505 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
506
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
507 List<GaugeRange> gauges = new ArrayList<GaugeRange>();
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
508
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
509 for (Object [] row: list) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
510 int gaugeId = (Integer)row[0];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
511 double start = (Double) row[1];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
512 double end = (Double) row[2];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
513 GaugeRange gauge = new GaugeRange(start, end, gaugeId);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
514 gauges.add(gauge);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
515 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
516
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
517 return new GaugeFinder(gauges, isKmUp);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
518 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
519
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
520
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
521 protected void loadFixings(Session session) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
522 SQLQuery query = session.createSQLQuery(SQL_FIXINGS)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
523 .addScalar("wst_id", StandardBasicTypes.INTEGER)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
524 .addScalar("description", StandardBasicTypes.STRING);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
525
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
526 query.setInteger("river_id", riverId);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
527
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
528 List<Object []> list = query.list();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
529
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
530 if (list.isEmpty()) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
531 log.warn("River " + riverId + " has no fixings.");
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
532 // Its pretty fine to have no fixings.
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
533 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
534
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
535 for (Object [] row: list) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
536 int wstId = (Integer)row[0];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
537 String description = (String) row[1];
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
538 Fixing fixing = new Fixing(wstId, description);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
539 fixings.add(fixing);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
540 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
541 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
542
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
543 protected void loadFixingsColumns(Session session) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
544 SQLQuery query = session.createSQLQuery(SQL_FIXING_COLUMNS)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
545 .addScalar("wst_column_id", StandardBasicTypes.INTEGER)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
546 .addScalar("start_time", StandardBasicTypes.DATE)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
547 .addScalar("name", StandardBasicTypes.STRING);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
548
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
549 for (Fixing fixing: fixings) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
550 fixing.loadColumns(query);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
551 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
552 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
553
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
554 protected void loadFixingsColumnsKmRange(Session session) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
555 SQLQuery query = session.createSQLQuery(SQL_FIXING_COLUMN_KM_RANGE)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
556 .addScalar("start_km", StandardBasicTypes.DOUBLE)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
557 .addScalar("stop_km", StandardBasicTypes.DOUBLE);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
558
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
559 for (Fixing fixing: fixings) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
560 fixing.loadColumnsKmRange(query);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
561 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
562 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
563
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
564 protected void loadFixingsColumnsQRanges(
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
565 Session session,
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
566 GaugeFinder gaugeFinder
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
567 ) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
568 SQLQuery query = session.createSQLQuery(SQL_FIXING_COLUMN_Q_RANGES)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
569 .addScalar("q", StandardBasicTypes.DOUBLE)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
570 .addScalar("start_km", StandardBasicTypes.DOUBLE)
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
571 .addScalar("stop_km", StandardBasicTypes.DOUBLE);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
572
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
573 for (Fixing fixing: fixings) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
574 fixing.loadColumnsQRanges(query, gaugeFinder);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
575 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
576 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
577
2565
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
578 protected void adjustExtent() {
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
579 for (Fixing fixing: fixings) {
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
580 fixing.adjustExtent(extent);
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
581 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
582 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
583
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
584 public boolean load(Session session) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
585
2565
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
586 if (!loadRiver(session)) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
587 return false;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
588 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
589
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
590 GaugeFinder gaugeFinder = loadGauges(session);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
591
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
592 if (gaugeFinder == null
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
593 || !gaugeFinder.loadDischargeSectors(session, riverId)) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
594 return false;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
595 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
596
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
597 loadFixings(session);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
598 loadFixingsColumns(session);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
599 loadFixingsColumnsKmRange(session);
2565
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
600
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
601 adjustExtent();
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
602
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
603 loadFixingsColumnsQRanges(session, gaugeFinder);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
604
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
605 return true;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
606 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
607
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
608 public static final Range FULL_EXTENT =
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
609 new Range(-Double.MAX_VALUE, Double.MAX_VALUE);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
610
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
611 public static final Fixing.Filter ACCEPT = new Fixing.Filter() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
612 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
613 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
614 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
615 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
616 };
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
617
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
618 public static class NotFilter implements Fixing.Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
619 protected Fixing.Filter child;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
620
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
621 public NotFilter(Fixing.Filter child) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
622 this.child = child;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
623 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
624
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
625 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
626 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
627 return !child.accept(column);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
628 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
629 } // class NotFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
630
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
631 public static abstract class ComponentFilter implements Fixing.Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
632 protected List<Fixing.Filter> children;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
633
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
634 public ComponentFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
635 children = new ArrayList<Fixing.Filter>();
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
636 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
637
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
638 public ComponentFilter(List<Fixing.Filter> children) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
639 this.children = children;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
640 }
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
641
3121
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
642 public ComponentFilter add(Fixing.Filter filter) {
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
643 children.add(filter);
3121
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
644 return this;
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
645 }
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
646 } // class ComponentFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
647
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
648 public static class OrFilter extends ComponentFilter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
649
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
650 public OrFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
651 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
652
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
653 public OrFilter(List<Fixing.Filter> children) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
654 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
655 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
656
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
657 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
658 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
659 for (Fixing.Filter child: children) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
660 if (child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
661 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
662 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
663 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
664 return false;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
665 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
666 } // class OrFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
667
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
668 public static class AndFilter extends ComponentFilter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
669
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
670 public AndFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
671 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
672
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
673 public AndFilter(List<Fixing.Filter> children) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
674 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
675 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
676
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
677 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
678 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
679 for (Fixing.Filter child: children) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
680 if (!child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
681 return false;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
682 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
683 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
684 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
685 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
686 } // class AndFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
687
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
688 public static class IdFilter implements Fixing.Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
689
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
690 protected int columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
691
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
692 public IdFilter(int columnId) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
693 this.columnId = columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
694 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
695
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
696 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
697 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
698 return column.getId() == columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
699 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
700 } // class IdFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
701
3121
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
702 public static class IdsFilter implements Fixing.Filter {
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
703
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
704 protected int [] columnIds;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
705
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
706 public IdsFilter(int [] columnIds) {
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
707 this.columnIds = columnIds;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
708 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
709
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
710 @Override
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
711 public boolean accept(Fixing.Column column) {
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
712 int cid = column.getId();
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
713 for (int i = columnIds.length-1; i >= 0; --i) {
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
714 if (columnIds[i] == cid) {
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
715 return true;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
716 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
717 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
718 return false;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
719 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
720 } // class IdFilter
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
721
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
722 public static class DateFilter implements Fixing.Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
723
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
724 protected Date date;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
725
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
726 public DateFilter(Date date) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
727 this.date = date;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
728 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
729
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
730 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
731 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
732 return date.equals(column.getStartTime());
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
733 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
734 } // class DateFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
735
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
736 public static class DateRangeFilter implements Fixing.Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
737
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
738 protected Date start;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
739 protected Date end;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
740
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
741 public DateRangeFilter(Date start, Date end) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
742 this.start = start;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
743 this.end = end;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
744 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
745
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
746 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
747 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
748 Date date = column.getStartTime();
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
749 return start.compareTo(date) <= 0 && end.compareTo(date) >= 0;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
750 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
751 } // class DateRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
752
3008
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
753 public static class SectorFilter implements Fixing.Filter {
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
754
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
755 protected int sector;
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
756
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
757 public SectorFilter(int sector) {
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
758 this.sector = sector;
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
759 }
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
760
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
761 @Override
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
762 public boolean accept(Fixing.Column column) {
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
763 for (SectorRange s: column.getSectors()) {
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
764 if (s.getSector() == sector) {
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
765 return true;
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
766 }
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
767 }
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
768 return false;
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
769 }
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
770 } // class SectorFilter
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
771
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
772 public static class SectorRangeFilter implements Fixing.Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
773
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
774 protected int min;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
775 protected int max;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
776
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
777 public SectorRangeFilter(int min, int max) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
778 this.min = Math.min(min, max);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
779 this.max = Math.max(min, max);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
780 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
781
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
782 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
783 public boolean accept(Fixing.Column column) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
784 for (SectorRange s: column.getSectors()) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
785 int v = s.getSector();
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
786 if (v >= min && v <= max) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
787 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
788 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
789 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
790 return false;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
791 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
792 } // class SectorRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
793
3006
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
794 public static class KmFilter implements Fixing.Filter {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
795
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
796 protected double km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
797
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
798 public KmFilter(double km) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
799 this.km = km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
800 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
801
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
802 @Override
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
803 public boolean accept(Fixing.Column column) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
804 for (SectorRange s: column.getSectors()) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
805 if (s.inside(km)) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
806 return true;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
807 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
808 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
809 return false;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
810 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
811 } // class KmFilter
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
812
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
813 public void generateOverview(Document document) {
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
814 generateOverview(document, FULL_EXTENT, ACCEPT);
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
815 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
816
2608
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
817 public List<Fixing.Column> filter(Range range, Fixing.Filter filter) {
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
818 List<Fixing.Column> allColumns = new ArrayList<Fixing.Column>();
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
819
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
820 for (Fixing fixing: fixings) {
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
821 fixing.addAllColumns(allColumns, range, filter);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
822 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
823
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
824 Collections.sort(allColumns, Fixing.DATE_CMP);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
825
2608
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
826 return allColumns;
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
827 }
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
828
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
829 public void generateOverview(
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
830 Document document,
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
831 Range range,
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
832 Fixing.Filter filter
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
833 ) {
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
834 List<Fixing.Column> allColumns = filter(range, filter);
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
835
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
836 Element fixingsElement = document.createElement("fixings");
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
837
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
838 Element riverElement = document.createElement("river");
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
839
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
840 riverElement.setAttribute("from", String.valueOf(extent.start));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
841 riverElement.setAttribute("to", String.valueOf(extent.end));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
842 riverElement.setAttribute("rid", String.valueOf(riverId));
2565
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
843 riverElement.setAttribute("name", riverName);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
844
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
845 fixingsElement.appendChild(riverElement);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
846
2564
3f038d54bc87 FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2563
diff changeset
847 SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
848
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
849 Element esE = document.createElement("events");
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
850
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
851 for (Fixing.Column column: allColumns) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
852
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
853 List<SectorRange> sectors = column.getSectors(range);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
854
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
855 if (!sectors.isEmpty()) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
856 Element eE = document.createElement("event");
2707
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
857 eE.setAttribute("description",
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
858 String.valueOf(column.getDescription()));
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
859 eE.setAttribute("cid", String.valueOf(column.columnId));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
860 eE.setAttribute("date", df.format(column.startTime));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
861
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
862 for (SectorRange sector: sectors) {
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
863 Element sE = document.createElement("sector");
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
864
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
865 sE.setAttribute("from", String.valueOf(sector.start));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
866 sE.setAttribute("to", String.valueOf(sector.end));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
867 sE.setAttribute("class", String.valueOf(sector.sector));
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
868
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
869 eE.appendChild(sE);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
870 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
871
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
872 esE.appendChild(eE);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
873 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
874 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
875
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
876 fixingsElement.appendChild(esE);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
877
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
878 document.appendChild(fixingsElement);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
879 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
880 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
881 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org