annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/FixingsOverview.java @ 8870:c26fb37899ca

Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui. Also using now the localization info from the server instead of localizing the modules again on the client side.
author gernotbelger
date Wed, 07 Feb 2018 11:59:13 +0100
parents 3e93f29281bc
children 0a5239a1e46e
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
6864
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
119 public static final class ColumnQRangeLoader
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
120 extends BatchLoader<List<double []>>
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
121 {
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
122 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
123 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
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
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 @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
127 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
128 query
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
129 .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
130 .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
131 .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
132 .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
133
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
135 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
136
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
138 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
139 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
140
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
142 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
143 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
144 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
146 (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
147 (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
148 (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
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
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
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
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
155 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
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 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 } // 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
159
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 /** 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
161 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
162 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
163 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
164 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
165
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
167 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
168 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
169 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
170 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 } // 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
172
6864
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
173 public static final class FixColumnLoader
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
174 extends BatchLoader<List<FixColumn>>
b55111e13acd Break long lines.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6847
diff changeset
175 {
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
176 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
177 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
178 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
179
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
180 @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
181 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
182 query
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
183 .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
184 .addScalar("wst_column_id", StandardBasicTypes.INTEGER)
6872
c5ce9812388b FixA overview: Fetch dates in higher resolution from database.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6864
diff changeset
185 .addScalar("start_time", StandardBasicTypes.TIMESTAMP)
6847
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
186 .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
187
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
189 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
190
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
192 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
193 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
194
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
196 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
197 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
198 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
200 (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
201 (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
202 (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
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 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
205 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
207 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
208 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
209 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
210 } // 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
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 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
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 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
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 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
217 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
218
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
219 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
220 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
221 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
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 } // 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
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 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
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 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
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 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
230 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
231
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
232 public SectorRange(SectorRange other) {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
233 start = other.start;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
234 end = other.end;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
235 sector = other.sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
236 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
237
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
238 public SectorRange(Range range) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
239 super(range);
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
240 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
241
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
242 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
243 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
244 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
245 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
246
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
247 public int getSector() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
248 return sector;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
249 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
250
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
251 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
252 this.sector = sector;
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
253 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
254
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
255 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
256 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
257 && 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
258 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
259 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
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 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
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 } // 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
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 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
266
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 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
268 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
269 @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
270 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
271 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
272 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273 };
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
274
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
275 public interface Filter {
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 boolean accept(Column column);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
278
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
279 } // interface Filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
280
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
281 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
282
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 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
284 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
285 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
286
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
287 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
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 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
290 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
291
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 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
293 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
294 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
295 this.name = name;
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
296
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
297 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
298 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
299
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
300 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
301 return columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
302 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
303
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
304 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
305 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
306 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
307
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
308 public Date getStartTime() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
309 return startTime;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
310 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
311
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
312 public String getName() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
313 return name;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
314 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
315
2707
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
316 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
317 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
318 }
d6e32ae72da6 Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2632
diff changeset
319
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
320 public List<SectorRange> getSectors() {
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
321 return sectors;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
322 }
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
323
5804
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
324 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
325 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
326 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
327 return true;
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
328 }
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 return false;
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
331 }
948d07aa988a FixA: Fixes flys/issue1138 (Ausgel. WSPL: Streckenintelligenz bei Generierung Balkendiagramm)
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5725
diff changeset
332
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
333 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
334
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
335 List<SectorRange> result =
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
336 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
337
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
338 for (SectorRange src: sectors) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
339 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
340 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
341 result.add(dst);
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 }
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 return result;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
346 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
347
3002
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
348 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
349 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
350 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
351 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
352 }
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 return -1;
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
355 }
e54dd69d306f FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2744
diff changeset
356
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
357 public void buildSectors(
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
358 GaugeFinder gaugeFinder,
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
359 List<QRange> qRanges
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
360 ) {
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
361 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
362 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
363 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
364 if (!sector.clip(gRange)) {
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
365 continue;
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 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
368
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
369 if (sectors.isEmpty()
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
370 || !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
371 sectors.add(sector);
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
372 }
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
373 } // for all gauges
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
374 } // 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
375 }
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 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
378
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
379 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
380
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
382 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
383 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
384 }
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
385 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
386 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
387 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
388
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
389 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
390 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
391 GaugeFinder gaugeFinder
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
392 ) {
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
393 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
394 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
395 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
396 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
397 }
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
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 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
400
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
401 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
402 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
403 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
404 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
405
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
406 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
407 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
408 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
409 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
410 }
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
411
3401
086326be721c FixA: Overview: classify Q ranges by intersecting gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3143
diff changeset
412 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
413 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
414 } // 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
415
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
416 protected int wstId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
417 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
418 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
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 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
421 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
422
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
423 public int getId() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
424 return wstId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
425 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
426
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
427 public String getDescription() {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
428 return description;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
429 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
430
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
431 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
432 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
433 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
434 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
435 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
436
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
437 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
438 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
439 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
440 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
441 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
442
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
443 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
444 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
445 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
446 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
447 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
448 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
450 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
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 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
453
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
454 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
455 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
456 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
457 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
458 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
459
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
460 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
461 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
462 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
463 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
464 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
465
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
466 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
467 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
468 GaugeFinder gaugeFinder
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
469 ) {
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 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
471 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
472 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
473 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
474
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
475 /**
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
476 * @param allColumns[out] Columns will be put here.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
477 * @param range can be null.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
478 * @param filter filter to apply.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
479 */
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
480 public void addAllColumns(
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
481 List<Column> allColumns,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
482 Range range,
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
483 Filter filter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
484 ) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
485 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
486 if ((range == null || column.hasSectorsInRange(range))
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3008
diff changeset
487 && (filter == null || filter.accept(column))) {
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
488 allColumns.add(column);
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
489 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
490 }
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
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 } // 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
493
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
494
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
495 protected String riverName;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
496 protected int riverId;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
497 protected boolean isKmUp;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
498 protected List<Fixing> fixings;
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
499 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
500
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
501 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
502 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
503 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
504 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
505
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
506 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
507 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
508 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
509 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
510
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
511 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
512 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
513 .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
514 .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
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 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
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 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
519
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
520 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
521 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
522 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
523 }
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 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
526
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 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
528 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
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 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
531 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
532
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
533 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
534 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
535 .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
536 .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
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 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
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 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
541
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
542 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
543 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
544 // 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
545 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
546
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
547 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
548 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
549 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
550 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
551 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
552 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
553 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
554
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
555 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
556
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
558 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
559 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
560
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 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
562 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
563 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
564 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
565
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
566 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
567 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
568 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
569 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
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 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
572 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
573
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance of the generation of the overview data. The data is now prefetched in batches.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6059
diff changeset
574 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
575 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
576 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
577 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
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 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
580 }
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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
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
582 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
583
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
585 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
586 session);
2561
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
587
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 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
589 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
590 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
591 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
592
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
593 protected void loadFixingsColumnsQRanges(
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
594 Session session,
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
595 GaugeFinder gaugeFinder
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
596 ) {
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
597
b0c88ac9f63b Fixing Analysis: Significantly (8-10x) improved the performance 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 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
599 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
600 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
601
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 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
603 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
604 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
605 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
606
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
607 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
608 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
609 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
610 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
611 }
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
612
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
613 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
614
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
615 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
616 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
617 }
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 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
620
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
621 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
622
29022c93027d FixA: Create a cached GaugeFinderFactory to access the gauge along a river
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3142
diff changeset
623 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
624 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
625 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
626
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
627 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
628 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
629 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
630
72f77b2210c2 FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2564
diff changeset
631 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
632
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
633 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
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 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
636 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
637
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
638 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
639 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
640
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
641 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
642 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
643 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
644 return true;
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 };
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
647
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
648 public static class NotFilter implements Fixing.Filter {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
649 protected Fixing.Filter child;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
650
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
651 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
652 this.child = child;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
653 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
654
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
655 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
656 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
657 return !child.accept(column);
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 } // class NotFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
660
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
661 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
662 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
663
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
664 public ComponentFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
665 children = new ArrayList<Fixing.Filter>();
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
666 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
667
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
668 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
669 this.children = children;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
670 }
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
671
3121
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
672 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
673 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
674 return this;
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
675 }
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
676 } // class ComponentFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
677
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
678 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
679
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
680 public OrFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
681 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
682
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
683 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
684 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
685 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
686
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
687 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
688 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
689 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
690 if (child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
691 return true;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
692 }
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 return false;
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 } // class OrFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
697
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
698 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
699
2744
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
700 public AndFilter() {
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
701 }
c1f2e792704a FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2707
diff changeset
702
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
703 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
704 super(children);
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
705 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
706
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
707 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
708 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
709 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
710 if (!child.accept(column)) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
711 return false;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
712 }
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 return true;
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 } // class AndFilter
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 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
719
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
720 protected int columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
721
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
722 public IdFilter(int columnId) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
723 this.columnId = columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
724 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
725
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
726 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
727 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
728 return column.getId() == columnId;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
729 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
730 } // class IdFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
731
5725
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5343
diff changeset
732 /** 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
733 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
734
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
735 protected int [] columnIds;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
736
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
737 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
738 this.columnIds = columnIds;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
739 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
740
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
741 @Override
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
742 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
743 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
744 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
745 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
746 return true;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
747 }
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 return false;
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
750 }
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
751 } // class IdFilter
0b86b005bb9a FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
752
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
753 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
754
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
755 protected Date date;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
756
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
757 public DateFilter(Date date) {
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
758 this.date = date;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
759 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
760
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
761 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
762 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
763 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
764 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
765 } // class DateFilter
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 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
768
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
769 protected Date start;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
770 protected Date end;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
771
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
772 public DateRangeFilter(Date start, Date end) {
6999
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
773 if (start.before(end)) {
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
774 this.start = start;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
775 this.end = end;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
776 }
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
777 else {
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
778 this.start = end;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
779 this.end = start;
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
780 }
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
781 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
782
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
783 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
784 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
785 Date date = column.getStartTime();
6999
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
786 // start <= date <= end
3e93f29281bc Fix for flys/issue1479: The indices of the dates of the analysis periods where re-mapped wrong.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6872
diff changeset
787 return !(date.before(start) || date.after(end));
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
788 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
789 } // class DateRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
790
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
791 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
792
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 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
794
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 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
796 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
797 }
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 @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
800 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
801 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
802 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
803 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
804 }
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
805 }
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
806 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
807 }
9e0500d64524 FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3006
diff changeset
808 } // 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
809
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
810 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
811
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
812 protected int min;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
813 protected int max;
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
814
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
815 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
816 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
817 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
818 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
819
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
820 @Override
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
821 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
822 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
823 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
824 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
825 return false;
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
826 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
827 }
5153
658dc517fd7b workaround for flys/issue1139: filter columns by all sectors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3430
diff changeset
828 return true;
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
829 }
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
830 } // class SectorRangeFilter
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
831
3006
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
832 public static class KmFilter implements Fixing.Filter {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
833
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
834 protected double km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
835
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
836 public KmFilter(double km) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
837 this.km = km;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
838 }
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 @Override
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
841 public boolean accept(Fixing.Column column) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
842 for (SectorRange s: column.getSectors()) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
843 if (s.inside(km)) {
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
844 return true;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
845 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
846 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
847 return false;
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
848 }
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
849 } // class KmFilter
1b1af1597401 FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3002
diff changeset
850
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
851 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
852 generateOverview(document, FULL_EXTENT, ACCEPT);
2562
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
853 }
ba35dfb7c09a FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2561
diff changeset
854
5996
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
855 /**
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
856 * @param range can be null.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
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 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
859 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
860
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
861 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
862 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
863 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
864
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
865 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
866
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
867 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
868 }
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
869
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
870 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
871 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
872 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
873 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
874 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
875 }
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 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
877 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
878 }
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 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
881 }
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 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
884 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
885
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 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
887 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
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
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 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
891
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 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
893
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 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
895 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
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 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
899 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
900 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
901 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
902 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
903 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
904 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
905 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
906 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
907
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
908 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
909 }
c44ff50f4970 FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3401
diff changeset
910
5335
05eeedc5b156 Doc, cosmetic and TODO fixes, renamed field in WQTimeRange.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5153
diff changeset
911 /** 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
912 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
913 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
914 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
915 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
916 ) {
938e2f6c0c9a Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2565
diff changeset
917 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
918
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
919 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
920
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
921 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
922
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
923 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
924 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
925 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
926 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
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 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
929
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
930 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
931 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
932 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
933 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
934
2564
3f038d54bc87 FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2563
diff changeset
935 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
936
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
937 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
938
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 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
940
2563
59c920e73d8a FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2562
diff changeset
941 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
942
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 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
944 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
945 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
946 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
947 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
948 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
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 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
951 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
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 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
954 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
955 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
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 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
958 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
959
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
960 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
961 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
962 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
963
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
964 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
965
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
966 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
967 }
6059
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
968
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
969 public Range getExtent() {
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
970 return extent;
5f52a8079625 Get location limits from fixation overview in fixation location selection
Andre Heinecke <aheinecke@intevation.de>
parents: 5996
diff changeset
971 }
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
972 }
b3f6d49cdc80 Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
973 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org