comparison flys-aft/src/main/java/de/intevation/aft/River.java @ 4098:9215253ad0be

Do the FLYS/AFT description pairing of discharge tables in case a gauge needs updates. flys-aft/trunk@3619 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 06 Jan 2012 18:54:00 +0000
parents 83c72bc07591
children 006e99437fb9
comparison
equal deleted inserted replaced
4097:83c72bc07591 4098:9215253ad0be
150 150
151 List<DischargeTable> aftDTs = 151 List<DischargeTable> aftDTs =
152 DischargeTable.loadAftDischargeTables( 152 DischargeTable.loadAftDischargeTables(
153 context, gauge.getOfficialNumber()); 153 context, gauge.getOfficialNumber());
154 154
155 // TODO: Do pairing 155 Map<String, DischargeTable> desc2FlysDT =
156 new HashMap<String, DischargeTable>();
157
158 for (DischargeTable dt: flysDTs) {
159 String description = dt.getDescription();
160 if (description == null) {
161 log.warn("FLYS: discharge table " + dt.getId()
162 + " has no description. Ignored.");
163 continue;
164 }
165 desc2FlysDT.put(description, dt);
166 }
167
168 List<DischargeTable> createDTs = new ArrayList<DischargeTable>();
169
170 for (DischargeTable dt: aftDTs) {
171 String description = dt.getDescription();
172 DischargeTable flysDT = desc2FlysDT.remove(description);
173 if (flysDT != null) {
174 // Found in AFT and FLYS.
175 log.info("FLYS: Discharge table '" + description
176 + "' found in AFT and FLYS. -> update");
177 // TODO: Create the W/Q diff.
178 }
179 else {
180 log.info("FLYS: Discharge table '" + description
181 + "' not found in FLYS. -> create");
182 createDTs.add(dt);
183 }
184 }
185
186 for (String description: desc2FlysDT.keySet()) {
187 log.info("FLYS: Discharge table '" + description
188 + "' found in FLYS but not in AFT. -> ignore");
189 }
190
191 // TODO: Create the new discharge tables.
156 192
157 return modified; 193 return modified;
158 } 194 }
159 195
160 protected boolean createGauges( 196 protected boolean createGauges(

http://dive4elements.wald.intevation.org