Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/InfrastructureSeriesImport.java @ 8971:50416a0df385
Importer for the Schifffahrt (S-INFO) and Oekologie (U-INFO) files
author | mschaefer |
---|---|
date | Tue, 03 Apr 2018 10:18:30 +0200 |
parents | |
children | 4c5eeaff554c |
comparison
equal
deleted
inserted
replaced
8970:da5dc7446652 | 8971:50416a0df385 |
---|---|
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 | |
11 package org.dive4elements.river.importer.sinfo.importitem; | |
12 | |
13 import java.util.List; | |
14 | |
15 import org.apache.log4j.Logger; | |
16 import org.dive4elements.river.importer.ImportAnnotationType; | |
17 import org.dive4elements.river.importer.common.AbstractSeriesImport; | |
18 import org.dive4elements.river.model.River; | |
19 import org.dive4elements.river.model.sinfo.Infrastructure; | |
20 import org.dive4elements.river.model.sinfo.InfrastructureValue; | |
21 import org.hibernate.Query; | |
22 import org.hibernate.Session; | |
23 | |
24 /** | |
25 * Imported infrastructure data series of a river and a type | |
26 * | |
27 * @author Matthias Schäfer | |
28 * | |
29 */ | |
30 public class InfrastructureSeriesImport extends AbstractSeriesImport<Infrastructure, InfrastructureValue, InfrastructureKmLineImport> { | |
31 | |
32 /***** FIELDS *****/ | |
33 | |
34 private static Logger log = Logger.getLogger(InfrastructureSeriesImport.class); | |
35 | |
36 private ImportAnnotationType type; | |
37 | |
38 private String provider; | |
39 | |
40 private String evaluation_by; | |
41 | |
42 private int year; | |
43 | |
44 | |
45 /***** CONSTRUCTORS *****/ | |
46 | |
47 public InfrastructureSeriesImport(final String filename) { | |
48 super(filename); | |
49 } | |
50 | |
51 | |
52 /***** METHODS *****/ | |
53 | |
54 public void setType(final ImportAnnotationType type) { | |
55 this.type = type; | |
56 } | |
57 | |
58 public void setProvider(final String provider) { | |
59 this.provider = provider; | |
60 } | |
61 | |
62 public void setEvaluation_by(final String evaluation_by) { | |
63 this.evaluation_by = evaluation_by; | |
64 } | |
65 | |
66 public void setYear(final int year) { | |
67 this.year = year; | |
68 } | |
69 | |
70 @Override | |
71 public Logger getLog() { | |
72 return log; | |
73 } | |
74 | |
75 @Override | |
76 public List<Infrastructure> querySeriesItem(final Session session, final River river) { | |
77 final Query query = session.createQuery("FROM Infrastructure WHERE river=:river AND lower(filename)=:filename"); | |
78 query.setParameter("river", river); | |
79 query.setParameter("filename", this.filename.toLowerCase()); | |
80 return query.list(); | |
81 } | |
82 | |
83 | |
84 @Override | |
85 public Infrastructure createSeriesItem(final River river) { | |
86 return new Infrastructure(river, this.filename, this.kmrange_info, this.comment, this.type.getPeer(), this.year, this.provider, this.evaluation_by); | |
87 } | |
88 } |