comparison flys-backend/src/main/java/de/intevation/flys/importer/AtFileParser.java @ 492:14de9246b356

Importer: parse historical discharge tables, too. TODO: store them in database. flys-backend/trunk@1840 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 05 May 2011 15:25:16 +0000
parents 8ea09ec7f0c8
children b35c5dc0f8b7
comparison
equal deleted inserted replaced
491:738140fe56fe 492:14de9246b356
37 37
38 public AtFileParser() { 38 public AtFileParser() {
39 } 39 }
40 40
41 41
42 public ImportDischargeTable parse(ImportGauge gauge) throws IOException { 42 public ImportDischargeTable parse(File file) throws IOException {
43 return parse(file, 0);
44 }
43 45
44 File file = gauge.getAtFile(); 46 public ImportDischargeTable parse(File file, int kind) throws IOException {
45 47
46 logger.info("parsing AT file: " + file); 48 logger.info("parsing AT file: " + file);
47 49
48 BufferedReader br = null; 50 BufferedReader br = null;
49 51
50 String line = null; 52 String line = null;
51 53
52 boolean beginning = true; 54 boolean beginning = true;
53 55
54 ImportDischargeTable dischargeTable = new ImportDischargeTable(); 56 ImportDischargeTable dischargeTable = new ImportDischargeTable(kind);
55 57
56 Date from = null; 58 Date from = null;
57 Date to = null; 59 Date to = null;
58 60
59 try { 61 try {
133 br.close(); 135 br.close();
134 } 136 }
135 } 137 }
136 138
137 if (from != null) { 139 if (from != null) {
140 logger.info("from: " + from + " to: " + to);
138 ImportTimeInterval interval = new ImportTimeInterval(from, to); 141 ImportTimeInterval interval = new ImportTimeInterval(from, to);
139 dischargeTable.setTimeInterval(interval); 142 dischargeTable.setTimeInterval(interval);
140 } 143 }
141 144
142 logger.info("Finished parsing AT file: " + file); 145 logger.info("Finished parsing AT file: " + file);

http://dive4elements.wald.intevation.org