annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/FixingsOverview.java @ 6847:b0c88ac9f63b

Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 17 Aug 2013 20:08:51 +0200
parents 5f52a8079625
children b55111e13acd
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
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 import org.apache.log4j.Logger;
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 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
24 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
25
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 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
27
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 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
29 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
30
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
31 import org.dive4elements.river.utils.BatchLoader;
5343
61f4d4164a30 Doc, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5335
diff changeset
32
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
33
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 /** 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
35 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
36 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
37 {
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 private static Logger log = Logger.getLogger(FixingsOverview.class);
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
3430
278b5508567e FixA: fixed aggregation bug in calculation of range spreads.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3421
diff changeset
40 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
41
2632
7d163c2c6e6d Improve XSL transformation for fixings overview output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2613
diff changeset
42 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
43
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
44 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
45 "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
46 " 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
47 " 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
48 "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
49 "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
50 " 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
51
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
52 /** 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
53 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
54 "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
55 " 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
56 " 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
57 "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
58 "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
59 " 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
60
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
61 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
62 "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
63 "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
64 "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
65 "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
66 "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
67 "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
68 "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
69 "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
70 "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
71 "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
72
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
73 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
74 "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
75 "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
76 "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
77 "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
78 "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
79 "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
80 "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
81 "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
82 "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
83 "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
84 "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
85
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
86 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
87 "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
88 "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
89 "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
90 "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
91 "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
92 "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
93 "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
94 "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
95 "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
96
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
97 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
98
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 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
100 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
101 }
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 @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
104 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
105 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 .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
107 .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
108 .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
109
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 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
111 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
112 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
113 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
114 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
115 }
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 } // 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
118
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 public static final class ColumnQRangeLoader extends BatchLoader<List<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
120
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
121 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
122 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
123 }
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
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 @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
126 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
127 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
128 .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
129 .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
130 .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
131 .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
132
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 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
134 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
135
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<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
137 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
138 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
139
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 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
141 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
142 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
143 }
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.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
145 (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
146 (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
147 (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
148 });
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
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 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
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
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 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
154 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
155 }
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 }
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 } // 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
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 /** 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
160 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
161 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
162 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
163 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
164
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 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
166 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
167 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
168 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
169 }
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 } // 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
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 public static final class FixColumnLoader extends BatchLoader<List<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
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
174 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
175 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
176 }
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
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 @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
179 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
180 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
181 .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
182 .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
183 .addScalar("start_time", StandardBasicTypes.DATE)
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("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
185
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
186 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
187 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
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 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
190 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
191 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
192
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 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
194 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
195 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
196 }
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 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
198 (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
199 (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
200 (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
201
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 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
203 }
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 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
205 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
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 }
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 } // 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
209
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 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
211
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 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
213
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 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
215 }
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(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
218 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
219 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
220 }
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 } // 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
222
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 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
224
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 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
226
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 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
228 }
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
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
230 public SectorRange(SectorRange other) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
231 start = other.start;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
232 end = other.end;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
233 sector = other.sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
234 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
235
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
236 public SectorRange(Range range) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
237 super(range);
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
238 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
239
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
240 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
241 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
242 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
243 }
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
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
245 public int getSector() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
246 return sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
247 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
248
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
249 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
250 this.sector = sector;
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
251 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
252
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
253 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
254 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
255 && 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
256 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
257 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
258 }
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 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
260 }
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 } // 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
262
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 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
264
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 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
266 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
267 @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
268 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
269 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
270 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
271 };
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
273 public interface Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
274
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
275 boolean accept(Column column);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
276
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
277 } // interface Filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
278
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
279 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
280
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
281 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
282 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
283 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
284
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
285 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
286
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287 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
288 }
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(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
291 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
292 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
293 this.name = name;
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
294
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
295 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
296 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
297
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
298 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
299 return columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
300 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
301
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
302 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
303 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
304 }
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
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
306 public Date getStartTime() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
307 return startTime;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
308 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
309
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
310 public String getName() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
311 return name;
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
2707
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
314 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
315 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
316 }
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
317
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
318 public List<SectorRange> getSectors() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
319 return sectors;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
320 }
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
321
5804
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
322 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
323 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
324 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
325 return true;
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
326 }
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
327 }
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
328 return false;
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
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
331 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
332
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
333 List<SectorRange> result =
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
334 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
335
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
336 for (SectorRange src: sectors) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
337 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
338 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
339 result.add(dst);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
340 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
341 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
342
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
343 return result;
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
3002
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
346 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
347 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
348 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
349 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
350 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
351 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
352 return -1;
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
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
355 public void buildSectors(
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
356 GaugeFinder gaugeFinder,
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
357 List<QRange> qRanges
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
358 ) {
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
359 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
360 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
361 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
362 if (!sector.clip(gRange)) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
363 continue;
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
364 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
365 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
366
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
367 if (sectors.isEmpty()
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
368 || !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
369 sectors.add(sector);
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
370 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
371 } // for all gauges
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
372 } // 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
373 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
374
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
375 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
376
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
377 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
378
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
379 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
380 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
381 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
382 }
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
383 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
384 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
385 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
386
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
387 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
388 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
389 GaugeFinder gaugeFinder
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
390 ) {
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 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
392 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
393 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
394 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
395 }
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
396
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
397 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
398
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
399 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
400 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
401 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
402 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
403
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
404 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
405 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
406 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
407 }
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 }
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
409
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
410 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
411 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
412 } // 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
413
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
414 protected int wstId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
415 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
416 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
417
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
418 public 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
419 }
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
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
421 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
422 return wstId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
423 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
424
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
425 public String getDescription() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
426 return description;
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
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
429 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
430 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
431 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
432 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
433 }
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
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
435 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
436 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
437 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
438 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
439 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
440
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
441 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
442 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
443 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
444 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
445 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
446 }
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 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
448 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
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 }
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
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 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
453 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
454 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
455 }
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 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
457
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
458 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
459 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
460 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
461 }
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 }
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
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
464 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
465 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
466 GaugeFinder gaugeFinder
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
467 ) {
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
468 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
469 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
470 }
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 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
472
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
473 /**
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
474 * @param allColumns[out] Columns will be put here.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
475 * @param range can be null.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
476 * @param filter filter to apply.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
477 */
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
478 public void addAllColumns(
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
479 List<Column> allColumns,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
480 Range range,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
481 Filter filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
482 ) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
483 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
484 if ((range == null || column.hasSectorsInRange(range))
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
485 && (filter == null || filter.accept(column))) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
486 allColumns.add(column);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
487 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
488 }
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
489 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
490 } // 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
491
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
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
493 protected String riverName;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
494 protected int riverId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
495 protected boolean isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
496 protected List<Fixing> fixings;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
497 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
498
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
499 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
500 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
501 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
502 }
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
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
504 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
505 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
506 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
507 }
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
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 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
510 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
511 .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
512 .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
513
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 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
515
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
516 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
517
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 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
519 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
520 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
521 }
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
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 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
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 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
526 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
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 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
529 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
530
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 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
532 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
533 .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
534 .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
535
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 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
537
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 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
539
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 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
541 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
542 // 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
543 }
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
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 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
546 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
547 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
548 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
549 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
550 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
551 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
552
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
553 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
554
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
555 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
556 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
557 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
558
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
559 for (Fixing fixing: fixings) {
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
560 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
561 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
562 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
563
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
564 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
565 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
566 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
567 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
568 }
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 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
570 }
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 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
573 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
574 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
575 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
576 }
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 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
578 }
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
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
580 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
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 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
583 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
584 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
585
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
586 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
587 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
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 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
590
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
591 protected void loadFixingsColumnsQRanges(
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
592 Session session,
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
593 GaugeFinder gaugeFinder
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
594 ) {
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
595
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
596 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
597 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
598 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
599
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
600 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
601 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
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 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
604
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
605 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
606 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
607 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
608 }
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 }
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
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
611 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
612
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
613 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
614 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
615 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
616
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
617 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
618
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
619 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
620
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3142
diff changeset
621 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
622 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
623 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
624
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 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
626 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
627 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
628
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
629 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
630
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
631 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
632
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
633 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
634 }
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
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
636 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
637 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
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 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
640 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
641 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
642 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
643 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
644 };
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
645
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
646 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
647 protected Fixing.Filter child;
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 NotFilter(Fixing.Filter child) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
650 this.child = 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
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
653 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
654 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
655 return !child.accept(column);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
656 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
657 } // class NotFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
658
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
659 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
660 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
661
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
662 public ComponentFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
663 children = new ArrayList<Fixing.Filter>();
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
664 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
665
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
666 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
667 this.children = children;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
668 }
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
669
3121
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
670 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
671 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
672 return this;
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
673 }
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
674 } // class ComponentFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
675
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
676 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
677
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
678 public OrFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
679 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
680
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
681 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
682 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
683 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
684
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
685 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
686 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
687 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
688 if (child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
689 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
690 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
691 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
692 return false;
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 } // class OrFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
695
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
696 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
697
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
698 public AndFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
699 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
700
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
701 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
702 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
703 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
704
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
705 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
706 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
707 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
708 if (!child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
709 return false;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
710 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
711 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
712 return true;
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 } // class AndFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
715
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
716 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
717
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
718 protected int columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
719
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
720 public IdFilter(int columnId) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
721 this.columnId = 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
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
724 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
725 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
726 return column.getId() == columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
727 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
728 } // class IdFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
729
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
730 /** 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
731 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
732
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
733 protected int [] columnIds;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
734
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
735 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
736 this.columnIds = 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
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
739 @Override
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
740 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
741 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
742 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
743 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
744 return true;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
745 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
746 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
747 return false;
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 } // class IdFilter
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
750
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
751 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
752
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
753 protected Date date;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
754
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
755 public DateFilter(Date date) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
756 this.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
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
759 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
760 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
761 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
762 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
763 } // class DateFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
764
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
765 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
766
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
767 protected Date start;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
768 protected Date end;
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 public DateRangeFilter(Date start, Date end) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
771 this.start = start;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
772 this.end = end;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
773 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
774
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
775 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
776 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
777 Date date = column.getStartTime();
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
778 return start.compareTo(date) <= 0 && end.compareTo(date) >= 0;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
779 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
780 } // class DateRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
781
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
782 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
783
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
784 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
785
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
786 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
787 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
788 }
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
789
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
790 @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
791 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
792 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
793 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
794 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
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 }
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 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
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 } // 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
800
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
801 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
802
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
803 protected int min;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
804 protected int max;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
805
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
806 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
807 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
808 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
809 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
810
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
811 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
812 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
813 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
814 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
815 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
816 return false;
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
817 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
818 }
5153
658dc517fd7b workaround for flys/issue1139: filter columns by all sectors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3430
diff changeset
819 return true;
2563
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 } // class SectorRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
822
3006
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
823 public static class KmFilter implements Fixing.Filter {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
824
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
825 protected double km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
826
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
827 public KmFilter(double km) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
828 this.km = km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
829 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
830
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
831 @Override
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
832 public boolean accept(Fixing.Column column) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
833 for (SectorRange s: column.getSectors()) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
834 if (s.inside(km)) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
835 return true;
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 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
838 return false;
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 } // class KmFilter
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
841
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
842 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
843 generateOverview(document, FULL_EXTENT, ACCEPT);
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
844 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
845
5996
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
846 /**
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
847 * @param range can be null.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
848 */
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
849 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
850 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
851
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 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
853 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
854 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
855
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
856 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
857
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
858 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
859 }
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
860
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
861 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
862 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
863 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
864 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
865 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
866 }
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
867 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
868 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
869 }
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
870 }
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 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
872 }
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
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 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
875 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
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 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
878 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
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 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
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 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
884
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 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
886 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
887 }
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
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 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
890 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
891 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
892 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
893 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
894 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
895 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
896 }
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 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
900 }
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
5335
05eeedc5b156 Doc, cosmetic and TODO fixes, renamed field in WQTimeRange.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5153
diff changeset
902 /** 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
903 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
904 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
905 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
906 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
907 ) {
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
908 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
909
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
910 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
911
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
912 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
913
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
914 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
915 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
916 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
917 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
918
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
919 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
920
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
921 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
922 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
923 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
924 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
925
2564
3f038d54bc87 FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2563
diff changeset
926 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
927
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 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
929
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 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
931
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
932 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
933
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
934 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
935 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
936 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
937 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
938 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
939 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
940
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 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
942 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
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 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
945 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
946 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
947
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.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
949 }
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 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
952 }
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
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 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
956
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 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
958 }
6059
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
959
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
960 public Range getExtent() {
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
961 return extent;
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
962 }
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
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org