comparison flys-aft/src/main/java/de/intevation/aft/River.java @ 5188:2b7f44c80857

Stations are now filtered by DiPS not AFT.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 07 Mar 2013 12:46:37 +0100
parents d9f1202cef78
children da1e897c7224
comparison
equal deleted inserted replaced
5187:eec78b9f73b8 5188:2b7f44c80857
63 } 63 }
64 64
65 public boolean sync(SyncContext context) throws SQLException { 65 public boolean sync(SyncContext context) throws SQLException {
66 log.info("sync river: " + this); 66 log.info("sync river: " + this);
67 67
68 Map<Long, DIPSGauge> dipsGauges = context.getDIPSGauges(); 68 // Only take relevant gauges into account.
69 Map<Long, DIPSGauge> dipsGauges = context.getDIPSGauges(name, from, to);
69 70
70 ConnectedStatements flysStatements = context.getFlysStatements(); 71 ConnectedStatements flysStatements = context.getFlysStatements();
71 ConnectedStatements aftStatements = context.getAftStatements(); 72 ConnectedStatements aftStatements = context.getAftStatements();
72 73
73 String riverName = getName(); 74 String riverName = getName();
76 77
77 ResultSet messstellenRs = aftStatements 78 ResultSet messstellenRs = aftStatements
78 .getStatement("select.messstelle") 79 .getStatement("select.messstelle")
79 .clearParameters() 80 .clearParameters()
80 .setInt("GEWAESSER_NR", id2) 81 .setInt("GEWAESSER_NR", id2)
81 .setDouble("START_KM", from)
82 .setDouble("END_KM", to)
83 .executeQuery(); 82 .executeQuery();
84 83
85 try { 84 try {
86 while (messstellenRs.next()) { 85 while (messstellenRs.next()) {
87 String name = messstellenRs.getString("NAME"); 86 String name = messstellenRs.getString("NAME");
88 String num = messstellenRs.getString("MESSSTELLE_NR"); 87 String num = messstellenRs.getString("MESSSTELLE_NR");
88 double station = messstellenRs.getDouble("STATIONIERUNG");
89
90 if (!messstellenRs.wasNull() && station < from && station > to) {
91 log.warn("Station found in AFT but in range: " + station);
92 continue;
93 }
89 94
90 Long number = SyncContext.numberToLong(num); 95 Long number = SyncContext.numberToLong(num);
91 if (number == null) { 96 if (number == null) {
92 log.warn("AFT: Invalid MESSSTELLE_NR for MESSSTELLE '"+name+"'"); 97 log.warn("AFT: Invalid MESSSTELLE_NR for MESSSTELLE '"+name+"'");
93 continue; 98 continue;

http://dive4elements.wald.intevation.org