changeset 8556:d115d0ed6624

Importer: Remove obsolete interface for bed heights.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 16 Feb 2015 09:35:06 +0100
parents b5c54a6380e8
children 29ab66ce06aa
files backend/src/main/java/org/dive4elements/river/importer/ImportBedHeight.java backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightSingle.java backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightSingleParser.java
diffstat 5 files changed, 23 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeight.java	Mon Feb 16 09:21:49 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.importer;
-
-
-import java.sql.SQLException;
-
-import org.hibernate.exception.ConstraintViolationException;
-
-import org.dive4elements.river.model.River;
-
-
-public interface ImportBedHeight {
-
-    String getDescription();
-
-    void addValue(ImportBedHeightSingleValue value);
-
-    void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException;
-
-    Object getPeer(River river);
-
-    int getValueCount();
-
-    void setYear(int year);
-
-    void setTimeInterval(ImportTimeInterval timeInterval);
-
-    void setSoundingWidth(int soundingWidth);
-
-    void setDescription(String description);
-
-    void setEvaluationBy(String evaluationBy);
-
-    void setRange(ImportRange range);
-
-    void setType(ImportBedHeightType type);
-
-    void setLocationSystem(ImportLocationSystem locationSystem);
-
-    void setCurElevationModel(ImportElevationModel model);
-
-    void setOldElevationModel(ImportElevationModel model);
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightSingle.java	Mon Feb 16 09:21:49 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightSingle.java	Mon Feb 16 09:35:06 2015 +0100
@@ -23,7 +23,7 @@
 import org.dive4elements.river.model.River;
 
 
-public class ImportBedHeightSingle implements ImportBedHeight
+public class ImportBedHeightSingle
 {
     private static Logger log = Logger.getLogger(ImportBedHeightSingle.class);
 
@@ -99,12 +99,10 @@
         this.oldElevationModel = oldElevationModel;
     }
 
-    @Override
     public void addValue(ImportBedHeightSingleValue value) {
         values.add((ImportBedHeightSingleValue) value);
     }
 
-    @Override
     public void storeDependencies(River river) {
         log.info("Store dependencies for single: '" + getDescription() + "'");
 
@@ -136,7 +134,6 @@
         session.flush();
     }
 
-    @Override
     public BedHeightSingle getPeer(River river) {
         if (peer == null) {
             BedHeightType  theType     = type != null ? type.getPeer() : null;
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Mon Feb 16 09:21:49 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Mon Feb 16 09:35:06 2015 +0100
@@ -164,9 +164,7 @@
     /** Wst-structures from waterlevel-difference-csv files. */
     protected List<ImportWst> waterlevelDifferences;
 
-    protected List<ImportBedHeight> bedHeightSingles;
-
-    protected List<ImportBedHeight> bedHeightEpochs;
+    protected List<ImportBedHeightSingle> bedHeightSingles;
 
     protected List<ImportSedimentDensity> sedimentDensities;
 
@@ -1453,7 +1451,7 @@
         River river = getPeer();
 
         if (bedHeightSingles != null) {
-            for (ImportBedHeight tmp: bedHeightSingles) {
+            for (ImportBedHeightSingle tmp: bedHeightSingles) {
                 ImportBedHeightSingle single = (ImportBedHeightSingle) tmp;
 
                 String desc = single.getDescription();
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java	Mon Feb 16 09:21:49 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java	Mon Feb 16 09:35:06 2015 +0100
@@ -31,7 +31,7 @@
 
 import org.apache.log4j.Logger;
 
-import org.dive4elements.river.importer.ImportBedHeight;
+import org.dive4elements.river.importer.ImportBedHeightSingle;
 import org.dive4elements.river.importer.ImportBedHeightType;
 import org.dive4elements.river.importer.ImportElevationModel;
 import org.dive4elements.river.importer.ImportLocationSystem;
@@ -89,26 +89,26 @@
     protected static NumberFormat nf = NumberFormat.getInstance(DEFAULT_LOCALE);
 
 
-    protected List<ImportBedHeight> bedHeights;
+    protected List<ImportBedHeightSingle> bedHeights;
 
 
-    protected abstract ImportBedHeight newImportBedHeight(String description);
+    protected abstract ImportBedHeightSingle newImportBedHeight(String description);
 
     /** Handle a line of file that contains data (in contrast to comments, meta). */
     protected abstract void handleDataLine(
-        ImportBedHeight importBedHeight,
+        ImportBedHeightSingle importBedHeight,
         String          line
     );
 
     protected TreeSet<Double> kmExists;
 
     public BedHeightParser() {
-        bedHeights = new ArrayList<ImportBedHeight>();
+        bedHeights = new ArrayList<ImportBedHeightSingle>();
         kmExists = new TreeSet<Double>(EpsilonComparator.CMP);
     }
 
 
-    public List<ImportBedHeight> getBedHeights() {
+    public List<ImportBedHeightSingle> getBedHeights() {
         return bedHeights;
     }
 
@@ -116,7 +116,7 @@
     public void parse(File file) throws IOException {
         log.info("Parsing bed height single file '" + file + "'");
 
-        ImportBedHeight obj = newImportBedHeight(file.getName().replaceAll("\\.csv", ""));
+        ImportBedHeightSingle obj = newImportBedHeight(file.getName().replaceAll("\\.csv", ""));
 
         kmExists.clear();
 
@@ -164,7 +164,7 @@
     }
 
 
-    protected void handleMetaLine(ImportBedHeight obj, String line) {
+    protected void handleMetaLine(ImportBedHeightSingle obj, String line) {
         String meta = stripMetaLine(line);
 
         if (handleMetaYear(obj, meta)) {
@@ -203,7 +203,7 @@
     }
 
 
-    protected boolean handleMetaYear(ImportBedHeight obj, String line) {
+    protected boolean handleMetaYear(ImportBedHeightSingle obj, String line) {
         Matcher m = META_YEAR.matcher(line);
 
         if (m.matches()) {
@@ -221,7 +221,7 @@
     }
 
 
-    protected boolean handleMetaTimeInterval(ImportBedHeight obj, String line) {
+    protected boolean handleMetaTimeInterval(ImportBedHeightSingle obj, String line) {
         Matcher m = META_TIMEINTERVAL.matcher(line);
 
         if (m.matches()) {
@@ -250,7 +250,7 @@
     }
 
 
-    protected boolean handleMetaSoundingWidth(ImportBedHeight obj, String line) {
+    protected boolean handleMetaSoundingWidth(ImportBedHeightSingle obj, String line) {
         Matcher m = META_SOUNDING_WIDTH.matcher(line);
 
         if (m.matches()) {
@@ -272,7 +272,7 @@
     }
 
 
-    protected boolean handleMetaComment(ImportBedHeight obj, String line) {
+    protected boolean handleMetaComment(ImportBedHeightSingle obj, String line) {
         Matcher m = META_COMMENTS.matcher(line);
 
         if (m.matches()) {
@@ -288,7 +288,7 @@
 
 
     protected boolean handleMetaEvaluationBy(
-        ImportBedHeight obj,
+        ImportBedHeightSingle obj,
         String                line
     ) {
         Matcher m = META_EVALUATION_BY.matcher(line);
@@ -306,7 +306,7 @@
     }
 
 
-    protected boolean handleMetaRange(ImportBedHeight obj, String line) {
+    protected boolean handleMetaRange(ImportBedHeightSingle obj, String line) {
         Matcher m = META_RANGE.matcher(line);
 
         if (m.matches() && m.groupCount() >= 2) {
@@ -330,7 +330,7 @@
     }
 
 
-    protected boolean handleMetaType(ImportBedHeight obj, String line) {
+    protected boolean handleMetaType(ImportBedHeightSingle obj, String line) {
         Matcher m = META_TYPE.matcher(line);
 
         if (m.matches()) {
@@ -353,7 +353,7 @@
 
 
     protected boolean handleMetaLocationSystem(
-        ImportBedHeight obj,
+        ImportBedHeightSingle obj,
         String          line
     ) {
         Matcher m = META_LOCATION_SYSTEM.matcher(line);
@@ -371,7 +371,7 @@
 
 
     protected boolean handleMetaCurElevationModel(
-        ImportBedHeight obj,
+        ImportBedHeightSingle obj,
         String          line
     ) {
         Matcher m = META_CUR_ELEVATION_SYSTEM.matcher(line);
@@ -394,7 +394,7 @@
 
 
     protected boolean handleMetaOldElevationModel(
-        ImportBedHeight obj,
+        ImportBedHeightSingle obj,
         String          line
     ) {
         Matcher m = META_OLD_ELEVATION_SYSTEM.matcher(line);
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightSingleParser.java	Mon Feb 16 09:21:49 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightSingleParser.java	Mon Feb 16 09:35:06 2015 +0100
@@ -12,7 +12,6 @@
 
 import org.apache.log4j.Logger;
 
-import org.dive4elements.river.importer.ImportBedHeight;
 import org.dive4elements.river.importer.ImportBedHeightSingle;
 import org.dive4elements.river.importer.ImportBedHeightSingleValue;
 
@@ -24,7 +23,7 @@
 
 
     @Override
-    protected ImportBedHeight newImportBedHeight(String description) {
+    protected ImportBedHeightSingle newImportBedHeight(String description) {
         return new ImportBedHeightSingle(description);
     }
 
@@ -34,7 +33,7 @@
      * it to the ImportBedHeight.
      */
     @Override
-    protected void handleDataLine(ImportBedHeight obj, String line) {
+    protected void handleDataLine(ImportBedHeightSingle obj, String line) {
         String[] values = line.split(SEPERATOR_CHAR, -1);
 
         if (values == null) {

http://dive4elements.wald.intevation.org