Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/DepthEvolutionSeriesImport.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 | 1f63e9d3b0ec |
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.DepthEvolution; | |
19 import org.dive4elements.river.model.sinfo.DepthEvolutionValue; | |
20 import org.hibernate.SQLQuery; | |
21 import org.hibernate.Session; | |
22 | |
23 /** | |
24 * Imported depth evolution data series of a river | |
25 * | |
26 * @author Matthias Schäfer | |
27 * | |
28 */ | |
29 public class DepthEvolutionSeriesImport extends AbstractSeriesImport<DepthEvolution, DepthEvolutionValue, DepthEvolutionKmLineImport> { | |
30 | |
31 /***** FIELDS *****/ | |
32 | |
33 private static Logger log = Logger.getLogger(DepthEvolutionSeriesImport.class); | |
34 | |
35 private Integer start_year; | |
36 | |
37 private Integer reference_year; | |
38 | |
39 private String curr_sounding; | |
40 | |
41 private String old_sounding; | |
42 | |
43 private String curr_glw; | |
44 | |
45 private String old_glw; | |
46 | |
47 | |
48 /***** CONSTRUCTORS *****/ | |
49 | |
50 public DepthEvolutionSeriesImport(final String filename) { | |
51 super(filename); | |
52 } | |
53 | |
54 | |
55 /***** METHODS *****/ | |
56 | |
57 public void setStart_year(final Integer start_year) { | |
58 this.start_year = start_year; | |
59 } | |
60 | |
61 public void setReference_year(final Integer reference_year) { | |
62 this.reference_year = reference_year; | |
63 } | |
64 | |
65 public void setCurr_sounding(final String curr_sounding) { | |
66 this.curr_sounding = curr_sounding; | |
67 } | |
68 | |
69 public void setOld_sounding(final String old_sounding) { | |
70 this.old_sounding = old_sounding; | |
71 } | |
72 | |
73 public void setCurr_glw(final String curr_glw) { | |
74 this.curr_glw = curr_glw; | |
75 } | |
76 | |
77 public void setOld_glw(final String old_glw) { | |
78 this.old_glw = old_glw; | |
79 } | |
80 | |
81 @Override | |
82 public Logger getLog() { | |
83 return log; | |
84 } | |
85 | |
86 @Override | |
87 public List<DepthEvolution> querySeriesItem(final Session session, final River river) { | |
88 /* | |
89 * final Query query = session.createQuery("FROM DepthEvolution WHERE river=:river AND lower(filename)=:filename"); | |
90 * query.setParameter("river", river); | |
91 * query.setParameter("filename", this.filename.toLowerCase()); | |
92 */ | |
93 final SQLQuery query = session.createSQLQuery("SELECT * FROM depth_evolution WHERE (river_id=:river) AND (lower(filename)=:filename)"); | |
94 query.setParameter("river", river.getId()); | |
95 query.setParameter("filename", getFilename().toLowerCase()); | |
96 return query.list(); | |
97 } | |
98 | |
99 | |
100 @Override | |
101 public DepthEvolution createSeriesItem(final River river) { | |
102 return new DepthEvolution(river, this.filename, this.kmrange_info, this.comment, this.start_year, this.reference_year, this.curr_sounding, | |
103 this.old_sounding, this.curr_glw, this.old_glw); | |
104 } | |
105 } |