Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/ChannelSeriesImport.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.common.AbstractSeriesImport; | |
17 import org.dive4elements.river.model.River; | |
18 import org.dive4elements.river.model.sinfo.Channel; | |
19 import org.dive4elements.river.model.sinfo.ChannelValue; | |
20 import org.hibernate.Query; | |
21 import org.hibernate.Session; | |
22 | |
23 /** | |
24 * Imported channel data series of a river | |
25 * | |
26 * @author Matthias Schäfer | |
27 * | |
28 */ | |
29 public class ChannelSeriesImport extends AbstractSeriesImport<Channel, ChannelValue, ChannelKmLineImport> { | |
30 | |
31 /***** FIELDS *****/ | |
32 | |
33 private static Logger log = Logger.getLogger(ChannelSeriesImport.class); | |
34 | |
35 private Integer year_from; | |
36 | |
37 private Integer year_to; | |
38 | |
39 | |
40 /***** CONSTRUCTORS *****/ | |
41 | |
42 public ChannelSeriesImport(final String filename) { | |
43 super(filename); | |
44 } | |
45 | |
46 | |
47 /***** METHODS *****/ | |
48 | |
49 public void setYear_from(final Integer year_from) { | |
50 this.year_from = year_from; | |
51 } | |
52 | |
53 public void setYear_to(final Integer year_to) { | |
54 this.year_to = year_to; | |
55 } | |
56 | |
57 @Override | |
58 public Logger getLog() { | |
59 return log; | |
60 } | |
61 | |
62 @Override | |
63 public List<Channel> querySeriesItem(final Session session, final River river) { | |
64 final Query query = session.createQuery("FROM Channel WHERE river=:river"); | |
65 query.setParameter("river", river); | |
66 return query.list(); | |
67 } | |
68 | |
69 | |
70 @Override | |
71 public Channel createSeriesItem(final River river) { | |
72 return new Channel(river, this.filename, this.kmrange_info, this.comment, this.year_from, this.year_to); | |
73 } | |
74 } |