Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java @ 5416:4ee97d914501
Morpho-Importer: Do not mask database exceptions as broken files
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Tue, 26 Mar 2013 09:39:34 +0100 |
parents | dba703edfff1 |
children | 473edafe4cb1 |
comparison
equal
deleted
inserted
replaced
5415:5bac3e75f59c | 5416:4ee97d914501 |
---|---|
1235 | 1235 |
1236 String desc = single.getDescription(); | 1236 String desc = single.getDescription(); |
1237 | 1237 |
1238 log.debug("name: " + desc); | 1238 log.debug("name: " + desc); |
1239 | 1239 |
1240 try { | 1240 single.storeDependencies(river); |
1241 single.storeDependencies(river); | 1241 |
1242 } | |
1243 catch (SQLException sqle) { | |
1244 log.error("File '" + desc + "' is broken!"); | |
1245 } | |
1246 catch (ConstraintViolationException cve) { | |
1247 log.error("File '" + desc + "' is broken!"); | |
1248 } | |
1249 } | 1242 } |
1250 } | 1243 } |
1251 else { | 1244 else { |
1252 log.info("No single bed heights to store."); | 1245 log.info("No single bed heights to store."); |
1253 } | 1246 } |
1263 | 1256 |
1264 String desc = epoch.getDescription(); | 1257 String desc = epoch.getDescription(); |
1265 | 1258 |
1266 log.debug("name: " + desc); | 1259 log.debug("name: " + desc); |
1267 | 1260 |
1268 try { | 1261 epoch.storeDependencies(river); |
1269 epoch.storeDependencies(river); | 1262 |
1270 } | |
1271 catch (SQLException sqle) { | |
1272 log.error("File '" + desc + "' is broken!"); | |
1273 } | |
1274 catch (ConstraintViolationException cve) { | |
1275 log.error("File '" + desc + "' is broken!"); | |
1276 } | |
1277 } | 1263 } |
1278 } | 1264 } |
1279 else { | 1265 else { |
1280 log.info("No epoch bed heights to store."); | 1266 log.info("No epoch bed heights to store."); |
1281 } | 1267 } |
1290 for (ImportSedimentDensity density: sedimentDensities) { | 1276 for (ImportSedimentDensity density: sedimentDensities) { |
1291 String desc = density.getDescription(); | 1277 String desc = density.getDescription(); |
1292 | 1278 |
1293 log.debug("name: " + desc); | 1279 log.debug("name: " + desc); |
1294 | 1280 |
1295 try { | 1281 density.storeDependencies(river); |
1296 density.storeDependencies(river); | 1282 |
1297 } | |
1298 catch (SQLException sqle) { | |
1299 log.error("File '" + desc + "' is broken!"); | |
1300 } | |
1301 catch (ConstraintViolationException cve) { | |
1302 log.error("File '" + desc + "' is broken!"); | |
1303 } | |
1304 } | 1283 } |
1305 } | 1284 } |
1306 } | 1285 } |
1307 | 1286 |
1308 public void storeMorphologicalWidth() { | 1287 public void storeMorphologicalWidth() { |
1310 log.info("store morphological width"); | 1289 log.info("store morphological width"); |
1311 | 1290 |
1312 River river = getPeer(); | 1291 River river = getPeer(); |
1313 | 1292 |
1314 for (ImportMorphWidth width: morphologicalWidths) { | 1293 for (ImportMorphWidth width: morphologicalWidths) { |
1315 try { | 1294 |
1316 width.storeDependencies(river); | 1295 width.storeDependencies(river); |
1317 } | 1296 |
1318 catch (SQLException sqle) { | |
1319 log.error("Error while parsing file for morph. width.", sqle); | |
1320 } | |
1321 catch (ConstraintViolationException cve) { | |
1322 log.error("Error while parsing file for morph. width.", cve); | |
1323 } | |
1324 } | 1297 } |
1325 } | 1298 } |
1326 } | 1299 } |
1327 | 1300 |
1328 public void storeFlowVelocity() { | 1301 public void storeFlowVelocity() { |
1330 log.info("store flow velocity"); | 1303 log.info("store flow velocity"); |
1331 | 1304 |
1332 River river = getPeer(); | 1305 River river = getPeer(); |
1333 | 1306 |
1334 for (ImportFlowVelocityModel flowVelocityModel: flowVelocityModels){ | 1307 for (ImportFlowVelocityModel flowVelocityModel: flowVelocityModels){ |
1335 try { | 1308 |
1336 flowVelocityModel.storeDependencies(river); | 1309 flowVelocityModel.storeDependencies(river); |
1337 } | 1310 |
1338 catch (SQLException sqle) { | |
1339 log.error("Error while storing flow velocity model.", sqle); | |
1340 } | |
1341 catch (ConstraintViolationException cve) { | |
1342 log.error("Error while storing flow velocity model.", cve); | |
1343 } | |
1344 } | 1311 } |
1345 | 1312 |
1346 for (ImportFlowVelocityMeasurement m: flowVelocityMeasurements) { | 1313 for (ImportFlowVelocityMeasurement m: flowVelocityMeasurements) { |
1347 try { | 1314 |
1348 m.storeDependencies(river); | 1315 m.storeDependencies(river); |
1349 } | 1316 |
1350 catch (SQLException sqle) { | |
1351 log.error("Error while storing flow velocity measurement.", sqle); | |
1352 } | |
1353 catch (ConstraintViolationException cve) { | |
1354 log.error("Error while storing flow velocity measurement.", cve); | |
1355 } | |
1356 } | 1317 } |
1357 } | 1318 } |
1358 } | 1319 } |
1359 | 1320 |
1360 | 1321 |
1363 log.info("store sediment yield data"); | 1324 log.info("store sediment yield data"); |
1364 | 1325 |
1365 River river = getPeer(); | 1326 River river = getPeer(); |
1366 | 1327 |
1367 for (ImportSedimentYield sedimentYield: sedimentYields) { | 1328 for (ImportSedimentYield sedimentYield: sedimentYields) { |
1368 try { | 1329 |
1369 sedimentYield.storeDependencies(river); | 1330 sedimentYield.storeDependencies(river); |
1370 } | 1331 |
1371 catch (SQLException sqle) { | |
1372 log.error("Error while storing sediment yield.", sqle); | |
1373 } | |
1374 catch (ConstraintViolationException cve) { | |
1375 log.error("Error while storing sediment yield.", cve); | |
1376 } | |
1377 } | 1332 } |
1378 } | 1333 } |
1379 } | 1334 } |
1380 | 1335 |
1381 | 1336 |
1386 River river = getPeer(); | 1341 River river = getPeer(); |
1387 | 1342 |
1388 int count = 0; | 1343 int count = 0; |
1389 | 1344 |
1390 for (ImportMeasurementStation station: measurementStations) { | 1345 for (ImportMeasurementStation station: measurementStations) { |
1391 try { | 1346 |
1392 boolean success = station.storeDependencies(river); | 1347 boolean success = station.storeDependencies(river); |
1393 if (success) { | 1348 if (success) { |
1394 count++; | 1349 count++; |
1395 } | 1350 } |
1396 } | 1351 |
1397 catch (SQLException sqle) { | |
1398 log.error("Error while storing measurement station.", sqle); | |
1399 } | |
1400 catch (ConstraintViolationException cve) { | |
1401 log.error("Error while storing measurement station.", cve); | |
1402 } | |
1403 } | 1352 } |
1404 | 1353 |
1405 log.info("stored " + count + " measurement stations."); | 1354 log.info("stored " + count + " measurement stations."); |
1406 } | 1355 } |
1407 } | 1356 } |
1414 River river = getPeer(); | 1363 River river = getPeer(); |
1415 | 1364 |
1416 int count = 0; | 1365 int count = 0; |
1417 | 1366 |
1418 for (ImportSQRelation sqRelation: sqRelations) { | 1367 for (ImportSQRelation sqRelation: sqRelations) { |
1419 try { | 1368 |
1420 sqRelation.storeDependencies(river); | 1369 sqRelation.storeDependencies(river); |
1421 count++; | 1370 count++; |
1422 } | 1371 |
1423 catch (SQLException sqle) { | |
1424 log.error("Error while storing sq relation.", sqle); | |
1425 } | |
1426 catch (ConstraintViolationException cve) { | |
1427 log.error("Error while storing sq relation.", cve); | |
1428 } | |
1429 } | 1372 } |
1430 | 1373 |
1431 log.info("stored " + count + " sq relations."); | 1374 log.info("stored " + count + " sq relations."); |
1432 } | 1375 } |
1433 } | 1376 } |