comparison backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java @ 6337:224d7c4b5291

Backend: Create ImportWsts for official lines expicitly. They are going to be somewhat special. Removed some cruft from the WstParser.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 14 Jun 2013 16:11:49 +0200
parents 53d08f33d094
children 55a2f9e0d6ab 7664ab97b4c7
comparison
equal deleted inserted replaced
6336:c4fbd85a33ee 6337:224d7c4b5291
67 protected ImportRange lastRange; 67 protected ImportRange lastRange;
68 68
69 public WstParser() { 69 public WstParser() {
70 } 70 }
71 71
72 public WstParser(ImportWst wst) {
73 this.wst = wst;
74 }
75
72 public ImportWst getWst() { 76 public ImportWst getWst() {
73 return wst; 77 return wst;
74 } 78 }
75 79
76 public void setWst(ImportWst wst) { 80 public void setWst(ImportWst wst) {
93 97
94 log.info("Parsing WST file '" + file + "'"); 98 log.info("Parsing WST file '" + file + "'");
95 99
96 wst = new ImportWst(file.getName()); 100 wst = new ImportWst(file.getName());
97 101
98 LineNumberReader in = null; 102 LineNumberReader in =
103 new LineNumberReader(
104 new InputStreamReader(
105 new FileInputStream(file), ENCODING));
99 try { 106 try {
100 in =
101 new LineNumberReader(
102 new InputStreamReader(
103 new FileInputStream(file), ENCODING));
104
105 String input; 107 String input;
106 boolean first = true; 108 boolean first = true;
107 int columnCount = 0; 109 int columnCount = 0;
108 110
109 String [] lsBezeichner = null; 111 String [] lsBezeichner = null;
110 String [] langBezeichner = null; 112 String [] langBezeichner = null;
111 int [] colNaWidths = null; 113 int [] colNaWidths = null;
112 String [] quellen = null; 114 // String [] quellen = null;
113 String [] daten = null; 115 String [] daten = null;
114 116
115 BigDecimal [] aktAbfluesse = null; 117 BigDecimal [] aktAbfluesse = null;
116 BigDecimal [] firstAbfluesse = null; 118 BigDecimal [] firstAbfluesse = null;
117 119
211 } 213 }
212 else if (spezial.startsWith(COLUMN_QUELLE)) { 214 else if (spezial.startsWith(COLUMN_QUELLE)) {
213 if (spezial.length() == 0) { 215 if (spezial.length() == 0) {
214 continue; 216 continue;
215 } 217 }
216 quellen = StringUtil.splitQuoted(spezial, '"'); 218 // quellen = StringUtil.splitQuoted(spezial, '"');
217 } 219 }
218 else if (spezial.startsWith(COLUMN_DATUM)) { 220 else if (spezial.startsWith(COLUMN_DATUM)) {
219 spezial = spezial.substring(COLUMN_DATUM.length()).trim(); 221 spezial = spezial.substring(COLUMN_DATUM.length()).trim();
220 if (spezial.length() == 0) { 222 if (spezial.length() == 0) {
221 continue; 223 continue;
354 addInterval(minKm, maxKm, aktAbfluesse); 356 addInterval(minKm, maxKm, aktAbfluesse);
355 357
356 fixRangesOrder(); 358 fixRangesOrder();
357 } 359 }
358 finally { 360 finally {
359 if (in != null) { 361 in.close();
360 in.close();
361 }
362 } 362 }
363 } 363 }
364 364
365 protected void fixRangesOrder() { 365 protected void fixRangesOrder() {
366 wst.fixRangesOrder(); 366 wst.fixRangesOrder();

http://dive4elements.wald.intevation.org