Mercurial > dive4elements > river
view flys-aft/src/main/java/de/intevation/aft/River.java @ 4084:9178beeb7b05
Moved DIPS gauge number -> DIPS gauge index.
flys-aft/trunk@3514 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 21 Dec 2011 15:16:58 +0000 |
parents | 44dc38ca8492 |
children | 067341e86375 |
line wrap: on
line source
package de.intevation.aft; import java.util.Map; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.log4j.Logger; import de.intevation.db.ConnectedStatements; public class River extends IdPair { private static Logger log = Logger.getLogger(River.class); protected String name; public River() { } public River(int id1, int id2, String name) { super(id1, id2); this.name = name; } public String getName() { return name; } public void sync(SyncContext context) throws SQLException { log.info("sync river: " + this); Map<Long, DIPSGauge> dipsGauges = context.getDIPSGauges(); ConnectedStatements flysStatements = context.getFlysStatements(); ConnectedStatements aftStatements = context.getAftStatements(); ResultSet messstellenRs = aftStatements .getStatement("select.messstelle") .clearParameters() .setInt("GEWAESSER_NR", id2).executeQuery(); while (messstellenRs.next()) { String name = messstellenRs.getString("NAME"); String num = messstellenRs.getString("MESSSTELLE_NR"); Long number = SyncContext.numberToLong(num); if (number == null) { log.warn("Invalid MESSSTELLE_NR for MESSSTELLE '"+name+"'"); continue; } DIPSGauge dipsGauge = dipsGauges.get(number); if (dipsGauges == null) { log.warn("MESSSTELLE '" + name + "' not found in DIPS."); continue; } } messstellenRs.close(); ResultSet gaugesRs = flysStatements .getStatement("select.gauges") .clearParameters() .setInt("river_id", id1).executeQuery(); while (gaugesRs.next()) { int gaugeId = gaugesRs.getInt("id"); String name = gaugesRs.getString("name"); } gaugesRs.close(); } public String toString() { return "[River: name=" + name + ", " + super.toString() + "]"; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :