Mercurial > dive4elements > river
comparison flys-aft/src/main/java/de/intevation/aft/River.java @ 4099:006e99437fb9
Store the W/Q differences o existing discharge tables to FLYS database.
flys-aft/trunk@3621 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 08 Jan 2012 09:25:36 +0000 |
parents | 9215253ad0be |
children | 981de0b77c6b |
comparison
equal
deleted
inserted
replaced
4098:9215253ad0be | 4099:006e99437fb9 |
---|---|
165 desc2FlysDT.put(description, dt); | 165 desc2FlysDT.put(description, dt); |
166 } | 166 } |
167 | 167 |
168 List<DischargeTable> createDTs = new ArrayList<DischargeTable>(); | 168 List<DischargeTable> createDTs = new ArrayList<DischargeTable>(); |
169 | 169 |
170 for (DischargeTable dt: aftDTs) { | 170 for (DischargeTable aftDT: aftDTs) { |
171 String description = dt.getDescription(); | 171 String description = aftDT.getDescription(); |
172 DischargeTable flysDT = desc2FlysDT.remove(description); | 172 DischargeTable flysDT = desc2FlysDT.remove(description); |
173 if (flysDT != null) { | 173 if (flysDT != null) { |
174 // Found in AFT and FLYS. | 174 // Found in AFT and FLYS. |
175 log.info("FLYS: Discharge table '" + description | 175 log.info("FLYS: Discharge table '" + description |
176 + "' found in AFT and FLYS. -> update"); | 176 + "' found in AFT and FLYS. -> update"); |
177 // TODO: Create the W/Q diff. | 177 // Create the W/Q diff. |
178 modified |= writeWQChanges(context, flysDT, aftDT); | |
178 } | 179 } |
179 else { | 180 else { |
180 log.info("FLYS: Discharge table '" + description | 181 log.info("FLYS: Discharge table '" + description |
181 + "' not found in FLYS. -> create"); | 182 + "' not found in FLYS. -> create"); |
182 createDTs.add(dt); | 183 createDTs.add(aftDT); |
183 } | 184 } |
184 } | 185 } |
185 | 186 |
186 for (String description: desc2FlysDT.keySet()) { | 187 for (String description: desc2FlysDT.keySet()) { |
187 log.info("FLYS: Discharge table '" + description | 188 log.info("FLYS: Discharge table '" + description |
189 } | 190 } |
190 | 191 |
191 // TODO: Create the new discharge tables. | 192 // TODO: Create the new discharge tables. |
192 | 193 |
193 return modified; | 194 return modified; |
195 } | |
196 | |
197 protected boolean writeWQChanges( | |
198 SyncContext context, | |
199 DischargeTable flysDT, | |
200 DischargeTable aftDT | |
201 ) | |
202 throws SQLException | |
203 { | |
204 flysDT.loadFlysValues(context); | |
205 aftDT.loadAftValues(context); | |
206 WQDiff diff = new WQDiff(flysDT.getValues(), aftDT.getValues()); | |
207 if (diff.hasChanges()) { | |
208 diff.writeChanges(context, flysDT.getId()); | |
209 return true; | |
210 } | |
211 return false; | |
194 } | 212 } |
195 | 213 |
196 protected boolean createGauges( | 214 protected boolean createGauges( |
197 SyncContext context, | 215 SyncContext context, |
198 Map<Long, DIPSGauge> gauges | 216 Map<Long, DIPSGauge> gauges |