comparison flys-aft/src/main/java/de/intevation/aft/River.java @ 4081:7a7b0f0cb653

Check if AFT gauges are in DIPS, too. flys-aft/trunk@3456 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 16 Dec 2011 19:25:31 +0000
parents 42094f01afa6
children d13011e53022
comparison
equal deleted inserted replaced
4080:fd6d0bc84117 4081:7a7b0f0cb653
59 } 59 }
60 60
61 public void sync(SyncContext context) throws SQLException { 61 public void sync(SyncContext context) throws SQLException {
62 log.info("sync river: " + this); 62 log.info("sync river: " + this);
63 63
64 Map<Long, DIPSGauge> dipsGauges = indexByNumber(context.getDips());
65
64 ConnectedStatements flysStatements = context.getFlysStatements(); 66 ConnectedStatements flysStatements = context.getFlysStatements();
65 ConnectedStatements aftStatements = context.getAftStatements(); 67 ConnectedStatements aftStatements = context.getAftStatements();
66 68
67 ResultSet messstellenRs = aftStatements 69 ResultSet messstellenRs = aftStatements
68 .getStatement("select.messstelle") 70 .getStatement("select.messstelle")
70 .setInt("GEWAESSER_NR", id2).executeQuery(); 72 .setInt("GEWAESSER_NR", id2).executeQuery();
71 73
72 while (messstellenRs.next()) { 74 while (messstellenRs.next()) {
73 String name = messstellenRs.getString("NAME"); 75 String name = messstellenRs.getString("NAME");
74 String num = messstellenRs.getString("MESSSTELLE_NR"); 76 String num = messstellenRs.getString("MESSSTELLE_NR");
75 System.err.println(name + ": " + num); 77 Long number = numberToLong(num);
78 if (number == null) {
79 log.warn("Invalid MESSSTELLE_NR for MESSSTELLE '"+name+"'");
80 continue;
81 }
82 DIPSGauge dipsGauge = dipsGauges.get(number);
83 if (dipsGauges == null) {
84 log.warn("MESSSTELLE '" + name + "' not found in DIPS.");
85 continue;
86 }
76 } 87 }
77 88
78 messstellenRs.close(); 89 messstellenRs.close();
79 90
80 ResultSet gaugesRs = flysStatements 91 ResultSet gaugesRs = flysStatements
88 System.err.println(name + ": " + gaugeId); 99 System.err.println(name + ": " + gaugeId);
89 } 100 }
90 101
91 gaugesRs.close(); 102 gaugesRs.close();
92 103
93 Map<Long, DIPSGauge> map = indexByNumber(context.getDips());
94 } 104 }
95 105
96 public String toString() { 106 public String toString() {
97 return "[River: name=" + name + ", " + super.toString() + "]"; 107 return "[River: name=" + name + ", " + super.toString() + "]";
98 } 108 }

http://dive4elements.wald.intevation.org