Mercurial > dive4elements > river
changeset 8977:bf8a9df86f32
Two fixes for the tkh and selected additionals import
author | mschaefer |
---|---|
date | Tue, 03 Apr 2018 17:23:51 +0200 |
parents | e541938dd3ab |
children | b5600453bb8f |
files | backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/TkhKmLineImport.java backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/SelectedAdditionalParser.java backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhColumnParser.java |
diffstat | 3 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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);
--- 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