[PATCH] Two fixes for the tkh and selected additionals import
Wald Commits
scm-commit at wald.intevation.org
Tue Apr 3 17:24:31 CEST 2018
# HG changeset patch
# User mschaefer
# Date 1522769031 -7200
# Node ID bf8a9df86f321e4b5e931f39e5eeba7b14f50095
# Parent e541938dd3ab01b739eb0b3360442e57d24b68a8
Two fixes for the tkh and selected additionals import
diff -r e541938dd3ab -r bf8a9df86f32 backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/TkhKmLineImport.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/TkhKmLineImport.java Tue Apr 03 10:43:53 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/TkhKmLineImport.java Tue Apr 03 17:23:51 2018 +0200
@@ -15,7 +15,7 @@
import org.dive4elements.river.importer.common.AbstractKmLineImport;
import org.dive4elements.river.model.sinfo.TkhColumn;
import org.dive4elements.river.model.sinfo.TkhValue;
-import org.hibernate.Query;
+import org.hibernate.SQLQuery;
import org.hibernate.Session;
/**
@@ -46,10 +46,15 @@
@Override
protected TkhValue queryValueItem(final Session session, final TkhColumn parent) {
- final Query query = session.createQuery("FROM TkhValue WHERE (tkhcolumn=:parent)"
+ /*
+ * final Query query = session.createQuery("FROM TkhValue WHERE (TkhColumn=:parent)"
+ * + " AND (station BETWEEN (:station-0.0001) AND (:station+0.0001))");
+ * query.setParameter("parent", parent);
+ * query.setParameter("station", this.station);
+ */
+ final SQLQuery query = session.createSQLQuery("SELECT * FROM tkh_values WHERE (tkh_column_id=:parent)"
+ " AND (station BETWEEN (:station-0.0001) AND (:station+0.0001))");
- query.setParameter("parent", parent);
- query.setParameter("station", this.station);
+ query.setParameter("parent", parent.getId()).setParameter("station", this.station);
final List rows = query.list();
if (!rows.isEmpty())
return (TkhValue) rows.get(0);
diff -r e541938dd3ab -r bf8a9df86f32 backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/SelectedAdditionalParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/SelectedAdditionalParser.java Tue Apr 03 10:43:53 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/SelectedAdditionalParser.java Tue Apr 03 17:23:51 2018 +0200
@@ -143,7 +143,7 @@
reset.setParameter("seltype", this.selectionType.getKey());
reset.executeUpdate();
final Query query = session.createQuery("FROM Wst WHERE (river=:river) AND (kind=1) AND (lower(description) LIKE :path)");
- query.setParameter("river", this.river);
+ query.setParameter("river", this.river.getPeer());
int count = 0;
for (final String wstfile : this.links) {
count += updateWst(session, query, this.river.getPeer(), wstfile, this.selectionType);
diff -r e541938dd3ab -r bf8a9df86f32 backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhColumnParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhColumnParser.java Tue Apr 03 10:43:53 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhColumnParser.java Tue Apr 03 17:23:51 2018 +0200
@@ -15,6 +15,7 @@
import org.apache.log4j.Logger;
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.TkhColumnSeriesImport;
import org.dive4elements.river.importer.sinfo.importitem.TkhKmLineImport;
import org.dive4elements.river.importer.sinfo.importitem.TkhSeriesImport;
@@ -65,8 +66,8 @@
@Override
protected boolean handleMetaOther() {
- // Skip any header line
- return true;
+ this.headerParsingState = ParsingState.IGNORE;
+ return false;
}
@Override
More information about the Dive4Elements-commits
mailing list