annotate flys-aft/src/main/java/de/intevation/aft/SyncContext.java @ 4089:859b4781554a

Prefetch existing time intervals from FLYS db. flys-aft/trunk@3574 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 03 Jan 2012 12:25:06 +0000
parents 9178beeb7b05
children d556e29592f5
rev   line source
4077
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.aft;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
4084
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
3 import java.util.Map;
4089
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
4 import java.util.Date;
4084
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
5 import java.util.HashMap;
4089
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
6 import java.util.Set;
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
7 import java.util.TreeSet;
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
8
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
9 import java.sql.SQLException;
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
10 import java.sql.ResultSet;
4084
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
11
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
12 import org.w3c.dom.Document;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
13
4077
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 import de.intevation.db.ConnectedStatements;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
4084
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
16 import org.w3c.dom.NodeList;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
17 import org.w3c.dom.Element;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
18
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
19 import org.apache.log4j.Logger;
4077
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 public class SyncContext
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 {
4084
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
23 private static Logger log = Logger.getLogger(SyncContext.class);
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
24
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
25 protected ConnectedStatements aftStatements;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
26 protected ConnectedStatements flysStatements;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
27 protected Document dips;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
28 protected Map<Long, DIPSGauge> numberToGauge;
4089
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
29 protected Set<TimeInterval> flysTimeIntervals;
4077
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 public SyncContext() {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 public SyncContext(
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 ConnectedStatements aftStatements,
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 ConnectedStatements flysStatements,
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 Document dips
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 ) {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 this.aftStatements = aftStatements;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 this.flysStatements = flysStatements;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 this.dips = dips;
4089
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
42 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
43
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
44 public void init() throws SQLException {
4084
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
45 numberToGauge = indexByNumber(dips);
4089
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
46 flysTimeIntervals = loadTimeIntervals();
4077
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 public ConnectedStatements getAftStatements() {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 return aftStatements;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 public void setAftStatements(ConnectedStatements aftStatements) {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 this.aftStatements = aftStatements;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 public ConnectedStatements getFlysStatements() {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 return flysStatements;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 public void setFlysStatements(ConnectedStatements flysStatements) {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 this.flysStatements = flysStatements;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 public Document getDips() {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 return dips;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 public void setDips(Document dips) {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 this.dips = dips;
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 void close() {
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 aftStatements.close();
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 flysStatements.close();
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 }
4084
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
77
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
78 public static Long numberToLong(String s) {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
79 try {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
80 return Long.valueOf(s.trim());
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
81 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
82 catch (NumberFormatException nfe) {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
83 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
84 return null;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
85 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
86
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
87 public Map<Long, DIPSGauge> getDIPSGauges() {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
88 return numberToGauge;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
89 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
90
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
91 protected static Map<Long, DIPSGauge> indexByNumber(Document document) {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
92 Map<Long, DIPSGauge> map = new HashMap<Long, DIPSGauge>();
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
93 NodeList nodes = document.getElementsByTagName("PEGELSTATION");
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
94 for (int i = nodes.getLength()-1; i >= 0; --i) {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
95 Element element = (Element)nodes.item(i);
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
96 String numberString = element.getAttribute("NUMMER");
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
97 Long number = numberToLong(numberString);
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
98 if (number != null) {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
99 DIPSGauge newG = new DIPSGauge(element);
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
100 DIPSGauge oldG = map.put(number, newG);
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
101 if (oldG != null) {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
102 log.warn("DIPS: '" + newG.getName() +
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
103 "' collides with '" + oldG.getName() +
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
104 "' on gauge number " + number + ".");
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
105 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
106 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
107 else {
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
108 log.warn("DIPS: gauge '" + element.getAttribute("NAME") +
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
109 "' has invalid gauge number '" + numberString + "'");
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
110 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
111 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
112 return map;
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
113 }
9178beeb7b05 Moved DIPS gauge number -> DIPS gauge index.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4077
diff changeset
114
4089
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
115 protected Set<TimeInterval> loadTimeIntervals() throws SQLException {
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
116
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
117 boolean debug = log.isDebugEnabled();
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
118
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
119 Set<TimeInterval> intervals = new TreeSet<TimeInterval>();
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
120 ResultSet rs = null;
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
121
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
122 try {
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
123 rs = flysStatements
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
124 .getStatement("select.timeintervals")
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
125 .executeQuery();
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
126
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
127 while (rs.next()) {
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
128 int id = rs.getInt("id");
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
129 Date start = rs.getDate("start_time");
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
130 Date stop = rs.getDate("stop_time");
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
131
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
132 if (debug) {
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
133 log.debug("id: " + id);
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
134 log.debug("start: " + start);
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
135 log.debug("stop: " + stop);
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
136 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
137
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
138 TimeInterval ti = new TimeInterval(id, start, stop);
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
139 intervals.add(ti);
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
140 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
141 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
142 finally {
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
143 if (rs != null) {
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
144 rs.close();
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
145 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
146 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
147
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
148 if (debug) {
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
149 log.debug("loaded time intervals: " + intervals.size());
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
150 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
151
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
152 return intervals;
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
153 }
859b4781554a Prefetch existing time intervals from FLYS db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4084
diff changeset
154
4077
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
155 }
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
156 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
97de7a552b79 Load DIPS XML
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157

http://dive4elements.wald.intevation.org