[Dive4elements-commits] [PATCH 6 of 8] ImportRiver: Import WaterlevelDifferences as Wst

Wald Commits scm-commit at wald.intevation.org
Tue Mar 12 09:34:35 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1363011011 -3600
# Node ID 11b2a0c55318abdde0fb6cc287a5ca987ac7c279
# Parent  fb5771196c82e1cf7c11661990fc7cd2309a35a1
ImportRiver: Import WaterlevelDifferences as Wst.

diff -r fb5771196c82 -r 11b2a0c55318 flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Mon Mar 11 15:09:09 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Mon Mar 11 15:10:11 2013 +0100
@@ -147,10 +147,6 @@
 
     protected List<ImportSedimentYield> sedimentYields;
 
-    protected List<ImportWaterlevel> waterlevels;
-
-    protected List<ImportWaterlevelDifference> waterlevelDiffs;
-
     protected List<ImportMeasurementStation> measurementStations;
 
     protected List<ImportSQRelation> sqRelations;
@@ -214,8 +210,6 @@
         flowVelocityModels        = new ArrayList<ImportFlowVelocityModel>();
         flowVelocityMeasurements  = new ArrayList<ImportFlowVelocityMeasurement>();
         sedimentYields            = new ArrayList<ImportSedimentYield>();
-        waterlevels               = new ArrayList<ImportWaterlevel>();
-        waterlevelDiffs           = new ArrayList<ImportWaterlevelDifference>();
         measurementStations       = new ArrayList<ImportMeasurementStation>();
         sqRelations               = new ArrayList<ImportSQRelation>();
     }
@@ -629,7 +623,11 @@
             parser.parse(file);
         }
 
-        waterlevelDiffs = parser.getDifferences();
+        // WaterlevelDifferences become Wsts now.
+        for(ImportWst iw: parser.exportWsts()) {
+            iw.setDescription("CSV/" + iw.getDescription());
+            waterlevelDifferences.add(iw);
+        }
     }
 
 
@@ -1083,7 +1081,6 @@
         storeMorphologicalWidth();
         storeFlowVelocity();
         storeSedimentYield();
-        storeWaterlevels();
         storeWaterlevelDifferences();
         storeMeasurementStations();
         storeSQRelations();
@@ -1130,13 +1127,27 @@
         if (!Config.INSTANCE.skipFixations() || !Config.INSTANCE.skipWaterlevels()) {
             log.info("store fixation wsts and/or csvs");
             River river = getPeer();
-            for (ImportWst wst: fixations) {
-                log.debug("name: " + wst.getDescription());
-                wst.storeDependencies(river);
+            for (ImportWst fwst: fixations) {
+                log.debug("name: " + fwst.getDescription());
+                fwst.storeDependencies(river);
             }
         }
     }
 
+
+    /** Store wsts from waterleveldifference-csv files. */
+    public void storeWaterlevelDifferences() {
+        if (!Config.INSTANCE.skipWaterlevelDifferences())
+        
+        log.info("store waterleveldifferences wsts from csv");
+        River river = getPeer();
+        for (ImportWst dWst: waterlevelDifferences) {
+            log.debug("water.diff.: name " + dWst.getDescription());
+            dWst.storeDependencies(river);
+        }
+    }
+        
+
     public void storeExtraWsts() {
         if (!Config.INSTANCE.skipExtraWsts()) {
             log.info("store extra wsts");
@@ -1348,40 +1359,6 @@
     }
 
 
-    public void storeWaterlevels() {
-        if (!Config.INSTANCE.skipWaterlevels()) {
-            log.info("store waterlevels");
-
-            River river = getPeer();
-
-            for (ImportWaterlevel waterlevel: waterlevels) {
-                waterlevel.storeDependencies(river);
-            }
-        }
-    }
-
-
-    public void storeWaterlevelDifferences() {
-        if (!Config.INSTANCE.skipWaterlevelDifferences()) {
-            log.info("store waterlevel differences");
-
-            River river = getPeer();
-
-            for (ImportWaterlevelDifference diff: waterlevelDiffs) {
-                try {
-                    diff.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("Error while storing waterlevel diff.", sqle);
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("Error while storing waterlevel diff.", cve);
-                }
-            }
-        }
-    }
-
-
     public void storeMeasurementStations() {
         if (!Config.INSTANCE.skipMeasurementStations()) {
             log.info("store measurement stations");


More information about the Dive4elements-commits mailing list