Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/importer/StaFileParser.java @ 486:8ea09ec7f0c8
Importer: Attach a time interval to a discharge table if we find one during import.
flys-backend/trunk@1813 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 03 May 2011 17:34:52 +0000 |
parents | 8d3533a03e10 |
children | cce054f27dac |
rev | line source |
---|---|
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.importer; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.io.File; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import java.io.IOException; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.io.LineNumberReader; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 import java.io.FileInputStream; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import java.io.InputStreamReader; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import java.math.BigDecimal; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.util.regex.Pattern; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import java.util.regex.Matcher; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import java.util.HashMap; |
195
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
15 import java.util.ArrayList; |
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import org.apache.log4j.Logger; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public class StaFileParser |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 private static Logger log = Logger.getLogger(StaFileParser.class); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public static final String ENCODING = "ISO-8859-1"; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 public static final Pattern QWTD_ = |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 Pattern.compile("\\s*([^\\s]+)\\s+([^\\s]+)\\s+([QWTD-]).*"); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 public StaFileParser() { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 public boolean parse(ImportGauge gauge) throws IOException { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 File file = gauge.getStaFile(); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 log.info("parsing STA file: " + file); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 LineNumberReader in = null; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 try { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 in = |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 new LineNumberReader( |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 new InputStreamReader( |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 new FileInputStream(file), ENCODING)); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 String line = in.readLine(); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 if (line == null) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 log.warn("STA file is empty."); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 return false; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 if (line.length() < 37) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 log.warn("first line in STA file is too short."); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 return false; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 gauge.setName(line.substring(16, 37).trim()); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 String [] values = line.substring(38).trim().split("\\s+", 2); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 if (values.length < 2) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 log.warn("Not enough columns for aeo and datum"); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 try { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 gauge.setAeo(new BigDecimal(values[0].replace(",", "."))); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 gauge.setDatum(new BigDecimal(values[1].replace(",", "."))); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 catch (NumberFormatException nfe) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 log.warn("cannot parse aeo or datum"); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 return false; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 line = in.readLine(); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 if (line == null) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 log.warn("STA file has not enough lines"); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 return false; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 if (line.length() < 36) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 log.warn("second line is too short"); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 return false; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 try { |
192
f1fce41347ea
Added missing ImportGauge.getPeer() method
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
84 gauge.setStation( |
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 new BigDecimal(line.substring(29, 36).trim())); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 catch (NumberFormatException nfe) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 log.warn("parsing of the datum of the gauge failed"); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 return false; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 // overread the next six lines |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 for (int i = 0; i < 6; ++i) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 if ((line = in.readLine()) == null) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 log.warn("STA file is too short"); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 return false; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 HashMap<String, ImportMainValueType> types = |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 new HashMap<String, ImportMainValueType>(); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 |
195
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
103 ArrayList<ImportNamedMainValue> namedMainValues = |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
104 new ArrayList<ImportNamedMainValue>(); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
105 |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
106 ArrayList<ImportMainValue> mainValues = |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
107 new ArrayList<ImportMainValue>(); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
108 |
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 while ((line = in.readLine()) != null) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 Matcher m = QWTD_.matcher(line); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 if (m.matches()) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 BigDecimal value; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 try { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 value = new BigDecimal(m.group(2).replace(",", ".")); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 catch (NumberFormatException nfe) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 log.warn("value not parseable in line " |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 + in.getLineNumber()); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 continue; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 String typeString = m.group(3); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 log.debug("\t type: " + typeString); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 ImportMainValueType type = types.get(typeString); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 if (type == null) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 type = new ImportMainValueType(typeString); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 types.put(typeString, type); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 } |
195
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
128 String name = m.group(1); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
129 ImportNamedMainValue namedMainValue = |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
130 new ImportNamedMainValue(type, name); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
131 namedMainValues.add(namedMainValue); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
132 |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
133 ImportMainValue mainValue = |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
134 new ImportMainValue(gauge, namedMainValue, value); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
135 |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
136 mainValues.add(mainValue); |
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 else { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 // TODO: treat as a comment |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 } |
195
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
142 gauge.setMainValueTypes( |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
143 new ArrayList<ImportMainValueType>(types.values())); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
144 gauge.setNamedMainValues(namedMainValues); |
8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
192
diff
changeset
|
145 gauge.setMainValues(mainValues); |
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 finally { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 if (in != null) { |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 in.close(); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 log.info("finished parsing STA file: " + file); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 return true; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 } |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |