Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/sinfo/importitem/TkhColumnSeriesImport.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 | 1f57381b3bb5 |
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.io.File; | |
14 import java.util.List; | |
15 | |
16 import org.apache.log4j.Logger; | |
17 import org.dive4elements.river.importer.common.AbstractSeriesImport; | |
18 import org.dive4elements.river.model.River; | |
19 import org.dive4elements.river.model.sinfo.TkhColumn; | |
20 import org.dive4elements.river.model.sinfo.TkhValue; | |
21 import org.hibernate.Query; | |
22 import org.hibernate.Session; | |
23 | |
24 /** | |
25 * Imported TKH data series of a river | |
26 * | |
27 * @author Matthias Schäfer | |
28 * | |
29 */ | |
30 public class TkhColumnSeriesImport extends AbstractSeriesImport<TkhColumn, TkhValue, TkhKmLineImport> { | |
31 | |
32 /***** FIELDS *****/ | |
33 | |
34 private static Logger log = Logger.getLogger(TkhColumnSeriesImport.class); | |
35 | |
36 private int year; | |
37 | |
38 private String sounding_info; | |
39 | |
40 private String evaluation_by; | |
41 | |
42 private final TkhSeriesImport parent; | |
43 | |
44 private final String colName; | |
45 | |
46 private final File relativeFilePath; | |
47 | |
48 | |
49 /***** CONSTRUCTORS *****/ | |
50 | |
51 public TkhColumnSeriesImport(final String filename) { | |
52 this(filename, null, null, null); | |
53 } | |
54 | |
55 public TkhColumnSeriesImport(final String filename, final TkhSeriesImport parent, final String colName, final File relativeFilePath) { | |
56 super(filename); | |
57 this.parent = parent; | |
58 this.colName = colName; | |
59 this.relativeFilePath = relativeFilePath; | |
60 } | |
61 | |
62 | |
63 /***** METHODS *****/ | |
64 | |
65 public int getYear() { | |
66 return this.year; | |
67 } | |
68 | |
69 public void setYear(final int year) { | |
70 this.year = year; | |
71 } | |
72 | |
73 public String getSounding_info() { | |
74 return this.sounding_info; | |
75 } | |
76 | |
77 public void setSounding_info(final String sounding_info) { | |
78 this.sounding_info = sounding_info; | |
79 } | |
80 | |
81 public String getEvaluation_by() { | |
82 return this.evaluation_by; | |
83 } | |
84 | |
85 public void setEvaluation_by(final String evaluation_by) { | |
86 this.evaluation_by = evaluation_by; | |
87 } | |
88 | |
89 @Override | |
90 public Logger getLog() { | |
91 return log; | |
92 } | |
93 | |
94 @Override | |
95 public List<TkhColumn> querySeriesItem(final Session session, final River river) { | |
96 final Query query = session.createQuery("FROM TkhColumn WHERE tkh=:parent AND lower(name)=:colname"); | |
97 query.setParameter("parent", this.parent.getPeer(river)); | |
98 query.setParameter("colname", this.colName.toLowerCase()); | |
99 return query.list(); | |
100 } | |
101 | |
102 | |
103 @Override | |
104 public TkhColumn createSeriesItem(final River river) { | |
105 return new TkhColumn(this.parent.getPeer(river), this.colName); | |
106 } | |
107 | |
108 @Override | |
109 protected void logStoreInfo() { | |
110 getLog().info(String.format("Store series column '%s':;'%s'", this.colName, this.relativeFilePath)); | |
111 } | |
112 } |