Mercurial > dive4elements > river
diff flys-aft/src/main/java/de/intevation/aft/River.java @ 4775:d9f1202cef78
Do the pairing of FLYS and AFT discharge tables by the field 'ABFLUSSTAFEL.BFG_ID' in
AFT and 'discharge_table.bfg_id' in FLYS.
TODO: Create new column in discharge_tabel.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sat, 05 Jan 2013 14:52:55 +0100 |
parents | 9dcc32fc5167 |
children | 2b7f44c80857 |
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/River.java Sat Jan 05 13:46:27 2013 +0100 +++ b/flys-aft/src/main/java/de/intevation/aft/River.java Sat Jan 05 14:52:55 2013 +0100 @@ -179,8 +179,8 @@ throws SQLException { log.info("FLYS: Updating gauge '" + gauge.getAftName() + "'."); - // We need to load all discharge tables from both database - // of the gauge and do some pairing based on their descriptions. + // We need to load all discharge tables from both databases + // of the gauge and do some pairing based on their bfg_id. boolean modified = false; @@ -196,40 +196,40 @@ DischargeTable.loadAftDischargeTables( context, gauge.getOfficialNumber()); - Map<String, DischargeTable> desc2FlysDT = + Map<String, DischargeTable> bfgId2FlysDT = new HashMap<String, DischargeTable>(); for (DischargeTable dt: flysDTs) { - String description = dt.getDescription(); - if (description == null) { + String bfgId = dt.getBfgId(); + if (bfgId == null) { log.warn("FLYS: discharge table " + dt.getId() - + " has no description. Ignored."); + + " has no bfg_id. Ignored."); continue; } - desc2FlysDT.put(description, dt); + bfgId2FlysDT.put(bfgId, dt); } List<DischargeTable> createDTs = new ArrayList<DischargeTable>(); for (DischargeTable aftDT: aftDTs) { - String description = aftDT.getDescription(); - DischargeTable flysDT = desc2FlysDT.remove(description); + String bfgId = aftDT.getBfgId(); + DischargeTable flysDT = bfgId2FlysDT.remove(bfgId); if (flysDT != null) { // Found in AFT and FLYS. - log.info("FLYS: Discharge table '" + description + log.info("FLYS: Discharge table '" + bfgId + "' found in AFT and FLYS. -> update"); // Create the W/Q diff. modified |= writeWQChanges(context, flysDT, aftDT); } else { - log.info("FLYS: Discharge table '" + description + log.info("FLYS: Discharge table '" + bfgId + "' not found in FLYS. -> create"); createDTs.add(aftDT); } } - for (String description: desc2FlysDT.keySet()) { - log.info("FLYS: Discharge table '" + description + for (String bfgId: bfgId2FlysDT.keySet()) { + log.info("FLYS: Discharge table '" + bfgId + "' found in FLYS but not in AFT. -> ignore"); }