annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/FixingsOverview.java @ 9801:1d7a72a50183 3.2.x tip

Assume Compose V2, consistently
author Tom Gottfried <tom@intevation.de>
date Thu, 23 Nov 2023 10:14:13 +0100
parents 0a5239a1e46e
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5804
diff changeset
9 package org.dive4elements.river.artifacts.model;
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
10
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.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
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 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
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 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
16 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
17 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
18 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
19 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
20
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 6999
diff changeset
21 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 6999
diff changeset
22 import org.apache.logging.log4j.LogManager;
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
23
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 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
25 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
26
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 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
28
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 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
30 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
31
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
32 import org.dive4elements.river.utils.BatchLoader;
5343
61f4d4164a30 Doc, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5335
diff changeset
33
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
34
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
35 /** Generate Fixings Table overview data structure to be stored in cache. */
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
36 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
37 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
38 {
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 6999
diff changeset
39 private static Logger log = LogManager.getLogger(FixingsOverview.class);
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
40
3430
278b5508567e FixA: fixed aggregation bug in calculation of range spreads.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3421
diff changeset
41 public static final double EPSILON = 1e-2;
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
42
2632
7d163c2c6e6d Improve XSL transformation for fixings overview output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2613
diff changeset
43 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
44
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
45 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
46 "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
47 " 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
48 " 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
49 "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
50 "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
51 " 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
52
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
53 /** All kind-2 wsts from given river. */
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
54 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
55 "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
56 " 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
57 " 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
58 "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
59 "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
60 " 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
61
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
62 public static final String SQL_FIXING_COLUMNS_BATCH =
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
63 "SELECT " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
64 "wc.wst_id AS wst_id," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
65 "wc.id AS wst_column_id," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
66 "ti.start_time AS start_time," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
67 "wc.name AS name " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
68 "FROM wst_columns wc " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
69 "JOIN time_intervals ti ON wc.time_interval_id = ti.id " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
70 "WHERE " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
71 "wc.wst_id IN ($IDS) " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
72 "ORDER BY wc.wst_id, position";
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
73
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
74 public static final String SQL_FIXING_COLUMN_Q_RANGES_BATCH =
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
75 "SELECT " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
76 "wcqr.wst_column_id AS wst_column_id," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
77 "wqr.q AS q," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
78 "r.a AS start_km," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
79 "r.b AS stop_km " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
80 "FROM wst_column_q_ranges wcqr " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
81 "JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
82 "JOIN ranges r ON wqr.range_id = r.id " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
83 "WHERE " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
84 "wcqr.wst_column_id IN ($IDS) " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
85 "ORDER BY wcqr.wst_column_id, r.a";
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
86
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
87 public static final String SQL_FIXING_COLUMN_KM_RANGE_BATCH =
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
88 "SELECT " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
89 "wst_column_id," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
90 "MIN(position) AS start_km," +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
91 "MAX(position) AS stop_km " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
92 "FROM " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
93 "wst_column_values " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
94 "WHERE " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
95 "wst_column_id IN ($IDS) " +
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
96 "GROUP BY wst_column_id";
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
97
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
98 public static final class KMRangeLoader extends BatchLoader<double []> {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
99
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
100 public KMRangeLoader(List<Integer> columns, Session session) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
101 super(columns, session, SQL_FIXING_COLUMN_KM_RANGE_BATCH);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
102 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
103
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
104 @Override
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
105 protected void fill(SQLQuery query) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
106 query
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
107 .addScalar("wst_column_id", StandardBasicTypes.INTEGER)
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
108 .addScalar("start_km", StandardBasicTypes.DOUBLE)
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
109 .addScalar("stop_km", StandardBasicTypes.DOUBLE);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
110
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
111 List<Object []> ranges = query.list();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
112 for (Object [] r: ranges) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
113 Integer cid = (Integer)r[0];
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
114 double [] vs = new double [] { (Double)r[1], (Double)r[2] };
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
115 cache(cid, vs);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
116 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
117 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
118 } // class KMRangeLoader
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
119
6864
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
120 public static final class ColumnQRangeLoader
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
121 extends BatchLoader<List<double []>>
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
122 {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
123 public ColumnQRangeLoader(List<Integer> columns, Session session) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
124 super(columns, session, SQL_FIXING_COLUMN_Q_RANGES_BATCH);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
125 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
126
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
127 @Override
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
128 protected void fill(SQLQuery query) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
129 query
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
130 .addScalar("wst_column_id", StandardBasicTypes.INTEGER)
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
131 .addScalar("q", StandardBasicTypes.DOUBLE)
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
132 .addScalar("start_km", StandardBasicTypes.DOUBLE)
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
133 .addScalar("stop_km", StandardBasicTypes.DOUBLE);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
134
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
135 int lastId = Integer.MIN_VALUE;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
136 List<double []> column = new ArrayList<double []>();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
137
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
138 List<Object []> ranges = query.list();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
139 for (Object [] r: ranges) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
140 int cid = (Integer)r[0];
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
141
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
142 if (cid != lastId && !column.isEmpty()) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
143 cache(lastId, column);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
144 column = new ArrayList<double []>();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
145 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
146 column.add(new double [] {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
147 (Double)r[1],
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
148 (Double)r[2],
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
149 (Double)r[3]
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
150 });
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
151
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
152 lastId = cid;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
153 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
154
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
155 if (!column.isEmpty()) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
156 cache(lastId, column);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
157 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
158 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
159 } // class ColumnQRangeLoader
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
160
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
161 /** Helper class to store data from batching fixing columns. */
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
162 private static final class FixColumn {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
163 int columnId;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
164 Date startTime;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
165 String name;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
166
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
167 FixColumn(int columnId, Date startTime, String name) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
168 this.columnId = columnId;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
169 this.startTime = startTime;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
170 this.name = name;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
171 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
172 } // class FixColumn
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
173
6864
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
174 public static final class FixColumnLoader
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
175 extends BatchLoader<List<FixColumn>>
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
176 {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
177 public FixColumnLoader(List<Integer> columns, Session session) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
178 super(columns, session, SQL_FIXING_COLUMNS_BATCH);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
179 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
180
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
181 @Override
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
182 protected void fill(SQLQuery query) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
183 query
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
184 .addScalar("wst_id", StandardBasicTypes.INTEGER)
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
185 .addScalar("wst_column_id", StandardBasicTypes.INTEGER)
6872
c5ce9812388b FixA overview: Fetch dates in higher resolution from database.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6864
diff changeset
186 .addScalar("start_time", StandardBasicTypes.TIMESTAMP)
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
187 .addScalar("name", StandardBasicTypes.STRING);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
188
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
189 int lastId = Integer.MIN_VALUE;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
190 List<FixColumn> cols = new ArrayList<FixColumn>();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
191
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
192 List<Object []> columns = query.list();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
193 for (Object [] c: columns) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
194 int wid = (Integer)c[0];
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
195
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
196 if (wid != lastId && !cols.isEmpty()) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
197 cache(lastId, cols);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
198 cols = new ArrayList<FixColumn>();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
199 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
200 cols.add(new FixColumn(
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
201 (Integer)c[1],
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
202 (Date) c[2],
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
203 (String) c[3]));
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
204
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
205 lastId = wid;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
206 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
207 if (!cols.isEmpty()) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
208 cache(lastId, cols);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
209 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
210 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
211 } // class FixColumnLoader
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
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 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
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 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
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 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
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
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
220 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
221 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
222 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
223 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
224 } // 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
225
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 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
227
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 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
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 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
231 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
232
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
233 public SectorRange(SectorRange other) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
234 start = other.start;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
235 end = other.end;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
236 sector = other.sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
237 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
238
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
239 public SectorRange(Range range) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
240 super(range);
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
241 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
242
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
243 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
244 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
245 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
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
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
248 public int getSector() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
249 return sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
250 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
251
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
252 public void setSector(int sector) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
253 this.sector = sector;
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
254 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
255
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
256 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
257 if (sector == other.sector
3430
278b5508567e FixA: fixed aggregation bug in calculation of range spreads.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3421
diff changeset
258 && Math.abs(end-other.start) < FixingsOverview.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
259 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
260 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
261 }
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 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
263 }
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 } // 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
265
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 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
267
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 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
269 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
270 @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
271 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
272 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
273 }
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 };
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
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
276 public interface Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
277
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
278 boolean accept(Column column);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
279
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
280 } // interface Filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
281
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
282 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
283
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 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
285 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
286 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
287
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
288 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
289
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
290 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
291 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
293 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
294 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
295 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
296 this.name = name;
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
297
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
298 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
299 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
300
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
301 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
302 return columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
303 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
304
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
305 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
306 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
307 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
308
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
309 public Date getStartTime() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
310 return startTime;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
311 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
312
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
313 public String getName() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
314 return name;
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
2707
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
317 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
318 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
319 }
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
320
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
321 public List<SectorRange> getSectors() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
322 return sectors;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
323 }
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
324
5804
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
325 public boolean hasSectorsInRange(Range range) {
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
326 for (SectorRange sector: sectors) {
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
327 if (sector.intersects(range)) {
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
328 return true;
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
329 }
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
330 }
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
331 return false;
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
332 }
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
333
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
334 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
335
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
336 List<SectorRange> result =
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
337 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
338
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
339 for (SectorRange src: sectors) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
340 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
341 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
342 result.add(dst);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
343 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
344 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
345
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
346 return result;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
347 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
348
3002
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
349 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
350 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
351 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
352 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
353 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
354 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
355 return -1;
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
356 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
357
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
358 public void buildSectors(
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
359 GaugeFinder gaugeFinder,
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
360 List<QRange> qRanges
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
361 ) {
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
362 for (QRange qRange: qRanges) {
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
363 for (GaugeRange gRange: gaugeFinder.getGauges()) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
364 SectorRange sector = new SectorRange(qRange);
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
365 if (!sector.clip(gRange)) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
366 continue;
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
367 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
368 sector.setSector(gRange.classify(qRange.q));
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
369
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
370 if (sectors.isEmpty()
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
371 || !sectors.get(sectors.size()-1).enlarge(sector)) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
372 sectors.add(sector);
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
373 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
374 } // for all gauges
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
375 } // for all Q ranges
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
376 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
377
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
378 public void loadKmRange(KMRangeLoader loader) {
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
379
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
380 double [] range = loader.get(columnId);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
381
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
382 if (range == 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
383 log.warn("No km range for column " + columnId + ".");
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
384 return;
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
385 }
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
386 start = range[0];
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
387 end = range[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
388 }
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
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
390 public void loadQRanges(
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
391 ColumnQRangeLoader loader,
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
392 GaugeFinder gaugeFinder
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
393 ) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
394 List<double []> qrs = loader.get(columnId);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
395 if (qrs == null) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
396 log.warn("No q ranges found for column " + columnId);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
397 return;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
398 }
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
399
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
400 List<QRange> qRanges = new ArrayList<QRange>(qrs.size());
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
401
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
402 for (double [] qr: qrs) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
403 double q = qr[0];
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
404 double start = qr[1];
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
405 double end = qr[2];
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
406
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
407 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
408 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
409 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
410 }
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 }
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
412
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
413 buildSectors(gaugeFinder, 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
414 }
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 } // 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
416
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
417 protected int wstId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
418 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
419 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
420
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 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
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
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
424 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
425 return wstId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
426 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
427
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
428 public String getDescription() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
429 return description;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
430 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
431
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
432 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
433 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
434 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
435 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
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
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
438 public void allColumnIds(List<Integer> cIds) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
439 for (Column column: columns) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
440 cIds.add(column.columnId);
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
441 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
442 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
443
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
444 public void loadColumns(FixColumnLoader loader) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
445 List<FixColumn> fcs = loader.get(wstId);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
446 if (fcs == null) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
447 log.warn("No columns for wst " + wstId);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
448 return;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
449 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
450 for (FixColumn fc: fcs) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
451 columns.add(new Column(fc.columnId, fc.startTime, fc.name));
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
452 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
453 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
454
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
455 public void loadColumnsKmRange(KMRangeLoader loader) {
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
456 for (Column column: columns) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
457 column.loadKmRange(loader);
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
458 }
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
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
461 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
462 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
463 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
464 }
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
465 }
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
466
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
467 public void loadColumnsQRanges(
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
468 ColumnQRangeLoader loader,
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
469 GaugeFinder gaugeFinder
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
470 ) {
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
471 for (Column column: columns) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
472 column.loadQRanges(loader, 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
473 }
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
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
476 /**
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
477 * @param allColumns[out] Columns will be put here.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
478 * @param range can be null.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
479 * @param filter filter to apply.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
480 */
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
481 public void addAllColumns(
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
482 List<Column> allColumns,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
483 Range range,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
484 Filter filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
485 ) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
486 for (Column column: columns) {
5804
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
487 if ((range == null || column.hasSectorsInRange(range))
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
488 && (filter == null || filter.accept(column))) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
489 allColumns.add(column);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
490 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
491 }
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
492 }
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 } // 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
494
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
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
496 protected String riverName;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
497 protected int riverId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
498 protected boolean isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
499 protected List<Fixing> fixings;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
500 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
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 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
503 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
504 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
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
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
507 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
508 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
509 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
510 }
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
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 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
513 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
514 .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
515 .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
516
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
517 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
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 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
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 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
522 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
523 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
524 }
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 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
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 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
529 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
530
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 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
532 }
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 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
535 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
536 .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
537 .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
538
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 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
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 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
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 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
544 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
545 // 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
546 }
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
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 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
549 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
550 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
551 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
552 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
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 }
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
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 protected void loadFixingsColumns(Session session) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
557
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
558 FixColumnLoader loader = new FixColumnLoader(
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
559 allFixingIds(),
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
560 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
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 for (Fixing fixing: fixings) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
563 fixing.loadColumns(loader);
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
564 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
565 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
566
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
567 protected List<Integer> allFixingIds() {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
568 List<Integer> ids = new ArrayList<Integer>(fixings.size());
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
569 for (Fixing fixing: fixings) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
570 ids.add(fixing.getId());
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
571 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
572 return ids;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
573 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
574
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
575 protected List<Integer> allColumnIds() {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
576 List<Integer> cIds = new ArrayList<Integer>();
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
577 for (Fixing fixing: fixings) {
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
578 fixing.allColumnIds(cIds);
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
579 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
580 return cIds;
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
581 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
582
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
583 protected void loadFixingsColumnsKmRange(Session session) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
584
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
585 KMRangeLoader loader = new KMRangeLoader(
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
586 allColumnIds(),
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
587 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
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 for (Fixing fixing: fixings) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
590 fixing.loadColumnsKmRange(loader);
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 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
592 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
593
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
594 protected void loadFixingsColumnsQRanges(
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
595 Session session,
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
596 GaugeFinder gaugeFinder
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
597 ) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
598
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
599 ColumnQRangeLoader loader = new ColumnQRangeLoader(
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
600 allColumnIds(),
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
601 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
602
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
603 for (Fixing fixing: fixings) {
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
604 fixing.loadColumnsQRanges(loader, 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
605 }
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
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
608 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
609 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
610 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
611 }
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
612 }
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
613
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
614 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
615
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
616 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
617 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
618 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
619
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3142
diff changeset
620 GaugeFinderFactory gff = GaugeFinderFactory.getInstance();
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
621
3143
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3142
diff changeset
622 GaugeFinder gaugeFinder = gff.getGaugeFinder(riverId, isKmUp);
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3142
diff changeset
623
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3142
diff changeset
624 if (gaugeFinder == 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
625 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
626 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
627
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
628 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
629 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
630 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
631
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
632 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
633
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
634 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
635
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
636 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
637 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
638
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
639 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
640 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
641
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
642 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
643 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
644 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
645 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
646 }
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
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
649 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
650 protected Fixing.Filter child;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
651
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
652 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
653 this.child = child;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
654 }
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 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
657 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
658 return !child.accept(column);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
659 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
660 } // class NotFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
661
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
662 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
663 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
664
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
665 public ComponentFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
666 children = new ArrayList<Fixing.Filter>();
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
667 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
668
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
669 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
670 this.children = children;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
671 }
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
672
3121
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
673 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
674 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
675 return this;
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
676 }
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
677 } // class ComponentFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
678
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
679 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
680
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
681 public OrFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
682 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
683
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
684 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
685 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
686 }
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 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
689 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
690 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
691 if (child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
692 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
693 }
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 return false;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
696 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
697 } // class OrFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
698
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
699 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
700
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
701 public AndFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
702 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
703
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
704 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
705 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
706 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
707
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
708 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
709 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
710 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
711 if (!child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
712 return false;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
713 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
714 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
715 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
716 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
717 } // class AndFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
718
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
719 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
720
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
721 protected int columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
722
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
723 public IdFilter(int columnId) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
724 this.columnId = columnId;
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
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
727 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
728 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
729 return column.getId() == columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
730 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
731 } // class IdFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
732
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
733 /** Accept Fixing columns whose id is in id list. */
3121
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
734 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
735
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
736 protected int [] columnIds;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
737
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
738 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
739 this.columnIds = columnIds;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
740 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
741
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
742 @Override
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
743 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
744 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
745 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
746 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
747 return true;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
748 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
749 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
750 return false;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
751 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
752 } // class IdFilter
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
753
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
754 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
755
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
756 protected Date date;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
757
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
758 public DateFilter(Date date) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
759 this.date = date;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
760 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
761
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
762 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
763 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
764 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
765 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
766 } // class DateFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
767
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
768 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
769
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
770 protected Date start;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
771 protected Date end;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
772
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
773 public DateRangeFilter(Date start, Date end) {
6999
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
774 if (start.before(end)) {
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
775 this.start = start;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
776 this.end = end;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
777 }
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
778 else {
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
779 this.start = end;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
780 this.end = start;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
781 }
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
782 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
783
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
784 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
785 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
786 Date date = column.getStartTime();
6999
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
787 // start <= date <= end
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
788 return !(date.before(start) || date.after(end));
2563
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 } // class DateRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
791
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
792 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
793
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
794 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
795
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
796 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
797 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
798 }
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
799
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
800 @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
801 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
802 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
803 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
804 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
805 }
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
806 }
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
807 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
808 }
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
809 } // 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
810
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
811 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
812
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
813 protected int min;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
814 protected int max;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
815
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
816 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
817 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
818 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
819 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
820
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
821 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
822 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
823 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
824 int v = s.getSector();
5153
658dc517fd7b workaround for flys/issue1139: filter columns by all sectors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3430
diff changeset
825 if (v < min || v > max) {
658dc517fd7b workaround for flys/issue1139: filter columns by all sectors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3430
diff changeset
826 return false;
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
827 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
828 }
5153
658dc517fd7b workaround for flys/issue1139: filter columns by all sectors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3430
diff changeset
829 return true;
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
830 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
831 } // class SectorRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
832
3006
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
833 public static class KmFilter implements Fixing.Filter {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
834
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
835 protected double km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
836
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
837 public KmFilter(double km) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
838 this.km = km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
839 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
840
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
841 @Override
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
842 public boolean accept(Fixing.Column column) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
843 for (SectorRange s: column.getSectors()) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
844 if (s.inside(km)) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
845 return true;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
846 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
847 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
848 return false;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
849 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
850 } // class KmFilter
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
851
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
852 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
853 generateOverview(document, FULL_EXTENT, ACCEPT);
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
854 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
855
5996
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
856 /**
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
857 * @param range can be null.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
858 */
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
859 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
860 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
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 (Fixing fixing: fixings) {
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
863 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
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
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 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
867
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
868 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
869 }
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
870
3421
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
871 protected static Range realRange(List<Fixing.Column> columns) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
872 Range range = null;
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
873 for (Fixing.Column column: columns) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
874 if (range == null) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
875 range = new Range(column);
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
876 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
877 else {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
878 range.extend(column);
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
879 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
880 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
881 return range;
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
882 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
883
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
884 protected Element intersectingGauges(Document document, Range range) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
885 Element gauges = document.createElement("gauges");
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
886
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
887 if (range == null) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
888 return gauges;
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
889 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
890
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
891 GaugeFinderFactory gff = GaugeFinderFactory.getInstance();
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
892
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
893 GaugeFinder gf = gff.getGaugeFinder(riverId, isKmUp);
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
894
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
895 if (gf == null) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
896 return gauges;
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
897 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
898
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
899 for (GaugeRange gr: gf.getGauges()) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
900 if (gr.intersects(range)) {
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
901 Element gauge = document.createElement("gauge");
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
902 gauge.setAttribute("from", String.valueOf(gr.getStart()));
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
903 gauge.setAttribute("to", String.valueOf(gr.getEnd()));
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
904 gauge.setAttribute("name", gr.getName());
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
905 gauges.appendChild(gauge);
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
906 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
907 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
908
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
909 return gauges;
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
910 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
911
5335
05eeedc5b156 Doc, cosmetic and TODO fixes, renamed field in WQTimeRange.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5153
diff changeset
912 /** Populate document with fixings, filtered by range and filter. */
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
913 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
914 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
915 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
916 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
917 ) {
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
918 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
919
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
920 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
921
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
922 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
923
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
924 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
925 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
926 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
927 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
928
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
929 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
930
3421
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
931 fixingsElement.appendChild(
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
932 intersectingGauges(
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
933 document,
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
934 realRange(allColumns)));
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
935
2564
3f038d54bc87 FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2563
diff changeset
936 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
937
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
938 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
939
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
940 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
941
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
942 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
943
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
944 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
945 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
946 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
947 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
948 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
949 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
950
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
951 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
952 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
953
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
954 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
955 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
956 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
957
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
958 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
959 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
960
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
961 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
962 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
963 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
964
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
965 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
966
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
967 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
968 }
6059
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
969
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
970 public Range getExtent() {
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
971 return extent;
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
972 }
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
973 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
974 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org