# HG changeset patch # User Sascha L. Teichmann # Date 1325876040 0 # Node ID 9215253ad0be34e797a2214316665b2c78c65ea6 # Parent 83c72bc075916da7215d519e3aca56f35d4f1a59 Do the FLYS/AFT description pairing of discharge tables in case a gauge needs updates. flys-aft/trunk@3619 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 83c72bc07591 -r 9215253ad0be flys-aft/ChangeLog --- a/flys-aft/ChangeLog Fri Jan 06 18:32:08 2012 +0000 +++ b/flys-aft/ChangeLog Fri Jan 06 18:54:00 2012 +0000 @@ -1,3 +1,10 @@ +2012-01-06 Sascha L. Teichmann + + * src/main/java/de/intevation/aft/River.java: Do the pairing + of discharge table of a gauge that needs updates. TODO: + Build the W/Q difference of found FLYS/AFT matches and + create the discharge tables in FLYS that are found in AFT. + 2012-01-06 Sascha L. Teichmann * src/main/resources/sql/flys-common.properties: Added statement diff -r 83c72bc07591 -r 9215253ad0be flys-aft/src/main/java/de/intevation/aft/River.java --- a/flys-aft/src/main/java/de/intevation/aft/River.java Fri Jan 06 18:32:08 2012 +0000 +++ b/flys-aft/src/main/java/de/intevation/aft/River.java Fri Jan 06 18:54:00 2012 +0000 @@ -152,7 +152,43 @@ DischargeTable.loadAftDischargeTables( context, gauge.getOfficialNumber()); - // TODO: Do pairing + Map desc2FlysDT = + new HashMap(); + + for (DischargeTable dt: flysDTs) { + String description = dt.getDescription(); + if (description == null) { + log.warn("FLYS: discharge table " + dt.getId() + + " has no description. Ignored."); + continue; + } + desc2FlysDT.put(description, dt); + } + + List createDTs = new ArrayList(); + + for (DischargeTable dt: aftDTs) { + String description = dt.getDescription(); + DischargeTable flysDT = desc2FlysDT.remove(description); + if (flysDT != null) { + // Found in AFT and FLYS. + log.info("FLYS: Discharge table '" + description + + "' found in AFT and FLYS. -> update"); + // TODO: Create the W/Q diff. + } + else { + log.info("FLYS: Discharge table '" + description + + "' not found in FLYS. -> create"); + createDTs.add(dt); + } + } + + for (String description: desc2FlysDT.keySet()) { + log.info("FLYS: Discharge table '" + description + + "' found in FLYS but not in AFT. -> ignore"); + } + + // TODO: Create the new discharge tables. return modified; }