[PATCH 03 of 12] Importer (s/u-info) extensions: cancelling bed-mobility import if wrong mobility keywords
Wald Commits
scm-commit at wald.intevation.org
Mon Mar 23 16:38:42 CET 2020
# HG changeset patch
# User mschaefer
# Date 1584972191 -3600
# Mon Mar 23 15:03:11 2020 +0100
# Node ID dd93bb84561d33cf33501c39544cf247f5c12b04
# Parent eb3dfe900d8ce726331ef11561515ad393222ce2
Importer (s/u-info) extensions: cancelling bed-mobility import if wrong mobility keywords
diff -r eb3dfe900d8c -r dd93bb84561d backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/BedMobilitySeriesImport.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/BedMobilitySeriesImport.java Mon Mar 23 15:00:04 2020 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/BedMobilitySeriesImport.java Mon Mar 23 15:03:11 2020 +0100
@@ -48,7 +48,7 @@
}
@Override
- public List<BedMobility> querySeriesItem(final Session session, final River river) {
+ public List<BedMobility> querySeriesItem(final Session session, final River river, final boolean doQueryParent) {
final Query query = session.createQuery("FROM BedMobility WHERE river=:river");
query.setParameter("river", river);
return query.list();
diff -r eb3dfe900d8c -r dd93bb84561d backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/BedMobilityParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/BedMobilityParser.java Mon Mar 23 15:00:04 2020 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/BedMobilityParser.java Mon Mar 23 15:03:11 2020 +0100
@@ -18,6 +18,7 @@
import org.dive4elements.river.importer.Config;
import org.dive4elements.river.importer.ImportRiver;
import org.dive4elements.river.importer.common.AbstractParser;
+import org.dive4elements.river.importer.common.ParsingState;
import org.dive4elements.river.importer.sinfo.importitem.BedMobilityKmLineImport;
import org.dive4elements.river.importer.sinfo.importitem.BedMobilitySeriesImport;
import org.dive4elements.river.model.sinfo.BedMobility;
@@ -37,6 +38,8 @@
private static final String MOBILE_KEYWORD = "mobil";
+ private static final String STARR_KEYWORD = "starr";
+
private static final String IMPORT_FILENAME = "Einteilung_der_Gewaessersohle.csv";
@@ -79,7 +82,13 @@
@Override
protected BedMobilityKmLineImport createKmLineImport(final Double km, final String[] values) {
- return new BedMobilityKmLineImport(km, values[1].equalsIgnoreCase(MOBILE_KEYWORD));
+ if (values[1].equalsIgnoreCase(STARR_KEYWORD))
+ return new BedMobilityKmLineImport(km, false);
+ else if (values[1].equalsIgnoreCase(MOBILE_KEYWORD))
+ return new BedMobilityKmLineImport(km, values[1].equalsIgnoreCase(MOBILE_KEYWORD));
+ logLineError("Invalid Gewässersohle value");
+ this.headerParsingState = ParsingState.STOP;
+ return null;
}
@Override
More information about the Dive4Elements-commits
mailing list