Mercurial > dive4elements > river
view backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/InfrastructureSeriesImport.java @ 9657:a79881a892c9
Importer (s/u-info) extensions: depth-evolution: corrected directory name Bezug_aktueller_GlW,
detecting and logging of wrong units, then cancelling,
various checks of the plausibility of the meta data year values and cancelling in case of errors,
detecting and logging missing change values, skipping those lines
author | mschaefer |
---|---|
date | Mon, 23 Mar 2020 15:26:50 +0100 |
parents | cedcee24a21a |
children | 75bd347147ad |
line wrap: on
line source
/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * 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.sinfo.importitem; import java.util.List; import org.apache.log4j.Logger; import org.dive4elements.river.importer.ImportAnnotationType; import org.dive4elements.river.importer.common.AbstractSeriesImport; import org.dive4elements.river.model.River; import org.dive4elements.river.model.sinfo.Infrastructure; import org.dive4elements.river.model.sinfo.InfrastructureValue; import org.hibernate.Query; import org.hibernate.Session; /** * Imported infrastructure data series of a river and a type * * @author Matthias Schäfer * */ public class InfrastructureSeriesImport extends AbstractSeriesImport<Infrastructure, InfrastructureValue, InfrastructureKmLineImport> { /***** FIELDS *****/ private static Logger log = Logger.getLogger(InfrastructureSeriesImport.class); private ImportAnnotationType type; private ImportAnnotationType group; private String provider; private String evaluation_by; private int year; /***** CONSTRUCTORS *****/ public InfrastructureSeriesImport(final String filename) { super(filename); } /***** METHODS *****/ public void setType(final ImportAnnotationType type) { this.type = type; } public void setGroup(final ImportAnnotationType group) { this.group = group; } public void setProvider(final String provider) { this.provider = provider; } public void setEvaluation_by(final String evaluation_by) { this.evaluation_by = evaluation_by; } public void setYear(final int year) { this.year = year; } @Override public Logger getLog() { return log; } @Override public List<Infrastructure> querySeriesItem(final Session session, final River river) { final Query query = session.createQuery("FROM Infrastructure WHERE river=:river AND lower(filename)=:filename"); query.setParameter("river", river); query.setParameter("filename", this.filename.toLowerCase()); return query.list(); } @Override public Infrastructure createSeriesItem(final River river) { return new Infrastructure(river, this.filename, this.kmrange_info, this.notes, this.type.getPeer(), this.group.getPeer(), this.year, this.provider, this.evaluation_by); } }