changeset 5232:11b2a0c55318

ImportRiver: Import WaterlevelDifferences as Wst.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 11 Mar 2013 15:10:11 +0100
parents fb5771196c82
children 37ff7c030ec9
files flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java
diffstat 1 files changed, 22 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- 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");

http://dive4elements.wald.intevation.org