comparison 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
comparison
equal deleted inserted replaced
2809:f283212966e8 2810:04eeb45df27b
220 } 220 }
221 } 221 }
222 222
223 223
224 public void parseBedHeight() throws IOException { 224 public void parseBedHeight() throws IOException {
225 if (Config.INSTANCE.skipBedHeight()) {
226 log.info("skip parsing bed height.");
227 return;
228 }
229
230 log.info("Parse bed height."); 225 log.info("Parse bed height.");
231 226
232 File minfoDir = getMinfoDir(); 227 File minfoDir = getMinfoDir();
233 File bedHeightDir = new File(minfoDir, BED_HEIGHT_DIR); 228 File bedHeightDir = new File(minfoDir, BED_HEIGHT_DIR);
234 File singlesDir = new File(bedHeightDir, BED_HEIGHT_SINGLE_DIR); 229 File singlesDir = new File(bedHeightDir, BED_HEIGHT_SINGLE_DIR);
235 File epochDir = new File(bedHeightDir, BED_HEIGHT_EPOCH_DIR); 230 File epochDir = new File(bedHeightDir, BED_HEIGHT_EPOCH_DIR);
236 231
237 parseBedHeightSingles(singlesDir); 232 if (Config.INSTANCE.skipBedHeightSingle()) {
238 //parseBedHeightEpochs(epochDir); 233 log.info("skip parsing bed height single.");
234 }
235 else {
236 parseBedHeightSingles(singlesDir);
237 }
238
239 if (Config.INSTANCE.skipBedHeightEpoch()) {
240 log.info("skip parsing bed height epochs.");
241 }
242 else {
243 parseBedHeightEpochs(epochDir);
244 }
239 245
240 log.info("Finished parsing bed heights."); 246 log.info("Finished parsing bed heights.");
241 } 247 }
242 248
243 249
699 } 705 }
700 } 706 }
701 707
702 708
703 public void storeBedHeight() { 709 public void storeBedHeight() {
704 if (!Config.INSTANCE.skipBedHeight()) { 710 if (!Config.INSTANCE.skipBedHeightSingle()) {
705 log.info("store bed heights"); 711 log.info("store bed heights single");
706 River river = getPeer(); 712 storeBedHeightSingle();
707 713 }
708 if (bedHeightSingles != null) { 714
709 for (ImportBedHeightSingle single: bedHeightSingles) { 715 if (!Config.INSTANCE.skipBedHeightEpoch()) {
710 String desc = single.getDescription(); 716 log.info("store bed height epoch.");
711 717 storeBedHeightEpoch();
712 log.debug("name: " + desc); 718 }
713 719 }
714 try { 720
715 single.storeDependencies(river); 721
716 } 722 private void storeBedHeightSingle() {
717 catch (SQLException sqle) { 723 River river = getPeer();
718 log.error("File '" + desc + "' is broken!"); 724
719 } 725 if (bedHeightSingles != null) {
720 catch (ConstraintViolationException cve) { 726 for (ImportBedHeightSingle single: bedHeightSingles) {
721 log.error("File '" + desc + "' is broken!"); 727 String desc = single.getDescription();
722 } 728
729 log.debug("name: " + desc);
730
731 try {
732 single.storeDependencies(river);
723 } 733 }
724 } 734 catch (SQLException sqle) {
725 else { 735 log.error("File '" + desc + "' is broken!");
726 log.info("No single bed heights to store."); 736 }
727 } 737 catch (ConstraintViolationException cve) {
728 738 log.error("File '" + desc + "' is broken!");
729 if (bedHeightEpochs != null) { 739 }
730 for (ImportBedHeightEpoch epoch: bedHeightEpochs) { 740 }
731 log.debug("name: " + epoch.getDescription()); 741 }
742 else {
743 log.info("No single bed heights to store.");
744 }
745 }
746
747
748 private void storeBedHeightEpoch() {
749 River river = getPeer();
750
751 if (bedHeightEpochs != null) {
752 for (ImportBedHeightEpoch epoch: bedHeightEpochs) {
753 String desc = epoch.getDescription();
754
755 log.debug("name: " + desc);
756
757 try {
732 epoch.storeDependencies(river); 758 epoch.storeDependencies(river);
733 } 759 }
734 } 760 catch (SQLException sqle) {
735 else { 761 log.error("File '" + desc + "' is broken!");
736 log.info("No epoch bed heights to store."); 762 }
737 } 763 catch (ConstraintViolationException cve) {
764 log.error("File '" + desc + "' is broken!");
765 }
766 }
767 }
768 else {
769 log.info("No epoch bed heights to store.");
738 } 770 }
739 } 771 }
740 772
741 public void storeAnnotations() { 773 public void storeAnnotations() {
742 if (!Config.INSTANCE.skipAnnotations()) { 774 if (!Config.INSTANCE.skipAnnotations()) {

http://dive4elements.wald.intevation.org