Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java @ 2810:04eeb45df27b
Implemented model classes and importer classes for bed height epochs.
flys-backend/trunk@4222 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 12 Apr 2012 12:50:49 +0000 |
parents | f283212966e8 |
children | 8926571e47fb |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Thu Apr 12 10:42:46 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Thu Apr 12 12:50:49 2012 +0000 @@ -222,11 +222,6 @@ public void parseBedHeight() throws IOException { - if (Config.INSTANCE.skipBedHeight()) { - log.info("skip parsing bed height."); - return; - } - log.info("Parse bed height."); File minfoDir = getMinfoDir(); @@ -234,8 +229,19 @@ File singlesDir = new File(bedHeightDir, BED_HEIGHT_SINGLE_DIR); File epochDir = new File(bedHeightDir, BED_HEIGHT_EPOCH_DIR); - parseBedHeightSingles(singlesDir); - //parseBedHeightEpochs(epochDir); + if (Config.INSTANCE.skipBedHeightSingle()) { + log.info("skip parsing bed height single."); + } + else { + parseBedHeightSingles(singlesDir); + } + + if (Config.INSTANCE.skipBedHeightEpoch()) { + log.info("skip parsing bed height epochs."); + } + else { + parseBedHeightEpochs(epochDir); + } log.info("Finished parsing bed heights."); } @@ -701,40 +707,66 @@ public void storeBedHeight() { - if (!Config.INSTANCE.skipBedHeight()) { - log.info("store bed heights"); - River river = getPeer(); - - if (bedHeightSingles != null) { - for (ImportBedHeightSingle single: bedHeightSingles) { - String desc = single.getDescription(); + if (!Config.INSTANCE.skipBedHeightSingle()) { + log.info("store bed heights single"); + storeBedHeightSingle(); + } - log.debug("name: " + desc); + if (!Config.INSTANCE.skipBedHeightEpoch()) { + log.info("store bed height epoch."); + storeBedHeightEpoch(); + } + } - try { - single.storeDependencies(river); - } - catch (SQLException sqle) { - log.error("File '" + desc + "' is broken!"); - } - catch (ConstraintViolationException cve) { - log.error("File '" + desc + "' is broken!"); - } + + private void storeBedHeightSingle() { + River river = getPeer(); + + if (bedHeightSingles != null) { + for (ImportBedHeightSingle single: bedHeightSingles) { + String desc = single.getDescription(); + + log.debug("name: " + desc); + + try { + single.storeDependencies(river); + } + catch (SQLException sqle) { + log.error("File '" + desc + "' is broken!"); + } + catch (ConstraintViolationException cve) { + log.error("File '" + desc + "' is broken!"); } } - else { - log.info("No single bed heights to store."); - } + } + else { + log.info("No single bed heights to store."); + } + } - if (bedHeightEpochs != null) { - for (ImportBedHeightEpoch epoch: bedHeightEpochs) { - log.debug("name: " + epoch.getDescription()); + + private void storeBedHeightEpoch() { + River river = getPeer(); + + if (bedHeightEpochs != null) { + for (ImportBedHeightEpoch epoch: bedHeightEpochs) { + String desc = epoch.getDescription(); + + log.debug("name: " + desc); + + try { epoch.storeDependencies(river); } + catch (SQLException sqle) { + log.error("File '" + desc + "' is broken!"); + } + catch (ConstraintViolationException cve) { + log.error("File '" + desc + "' is broken!"); + } } - else { - log.info("No epoch bed heights to store."); - } + } + else { + log.info("No epoch bed heights to store."); } }