Mercurial > lada > lada-server
annotate src/main/java/de/intevation/lada/data/importer/LAFParser.java @ 366:567ce7697fc7 0.5
Code documentation.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 10 Sep 2013 15:55:54 +0200 |
parents | d39d3886b97d |
children | c63281230bc3 |
rev | line source |
---|---|
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.lada.data.importer; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
4 import java.util.HashMap; |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
6 import java.util.Map; |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 import javax.inject.Inject; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import javax.inject.Named; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
11 import de.intevation.lada.auth.AuthenticationResponse; |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
13 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
14 * This parser is used to read data in LAF based key-value pair structure. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
15 * |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
16 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
17 */ |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 public class LAFParser { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 private static final String PROBE_NEXT = "\n%PROBE%"; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 private boolean dryRun; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
321
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
24 @Inject |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
25 @Named("lafproducer") |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 private Producer producer; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
28 @Inject |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
29 @Named("lafwriter") |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
30 private Writer writer; |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
32 private Map<String, List<ReportData>> warnings; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
33 private Map<String, List<ReportData>> errors; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
34 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
35 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
36 * Default constructor. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
37 */ |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 public LAFParser() { |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
39 this.warnings = new HashMap<String, List<ReportData>>(); |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
40 this.errors = new HashMap<String, List<ReportData>>(); |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 this.setDryRun(false); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
44 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
45 * Read and parse the data and write the objects to the database. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
46 * |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
47 * @param auth Authentication information |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
48 * @param laf The LAF formated data. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
49 * @return success |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
50 * @throws LAFParserException |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
51 */ |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
52 public boolean parse(AuthenticationResponse auth, String laf) |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 throws LAFParserException |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 { |
316
2adf28ac7fe0
Stop parsing as soon as posible if laf content is not valid.
Raimund Renkert <rrenkert@intevation.de>
parents:
310
diff
changeset
|
55 if (!laf.startsWith("%PROBE%\n")) { |
2adf28ac7fe0
Stop parsing as soon as posible if laf content is not valid.
Raimund Renkert <rrenkert@intevation.de>
parents:
310
diff
changeset
|
56 throw new LAFParserException("No %PROBE% at the begining."); |
2adf28ac7fe0
Stop parsing as soon as posible if laf content is not valid.
Raimund Renkert <rrenkert@intevation.de>
parents:
310
diff
changeset
|
57 } |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 boolean parsed = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 while (laf.startsWith("%PROBE%\n")) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 parsed = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 int nextPos = laf.indexOf(PROBE_NEXT); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 String single = ""; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 if (nextPos > 0) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 single = laf.substring(0, nextPos + 1); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 laf = laf.substring(nextPos + 1); |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
66 try { |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
67 readAll(single); |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
68 this.warnings.putAll(producer.getWarnings()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
69 this.errors.putAll(producer.getErrors()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
70 writeAll(auth); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
71 this.producer.reset(); |
356
3f03e954c04d
Fixed reset for errors and warnings.
Raimund Renkert <rrenkert@intevation.de>
parents:
337
diff
changeset
|
72 this.writer.reset(); |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
73 } |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
74 catch (LAFParserException lpe) { |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
75 Map<String, List<ReportData>> pErr = producer.getErrors(); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
76 if (pErr.isEmpty()) { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
77 List<ReportData> err = new ArrayList<ReportData>(); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
78 err.add(new ReportData("parser", lpe.getMessage(), 673)); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
79 this.errors.put("parser", err); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
80 this.warnings.put("parser", new ArrayList<ReportData>()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
81 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
82 else { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
83 this.errors.putAll(pErr); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
84 this.warnings.putAll(producer.getWarnings()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
85 } |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
86 this.producer.reset(); |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
87 continue; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
88 } |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
90 else { |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
91 try { |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
92 readAll(laf); |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
93 this.warnings.putAll(producer.getWarnings()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
94 this.errors.putAll(producer.getErrors()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
95 writeAll(auth); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
96 this.producer.reset(); |
356
3f03e954c04d
Fixed reset for errors and warnings.
Raimund Renkert <rrenkert@intevation.de>
parents:
337
diff
changeset
|
97 this.writer.reset(); |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
98 laf = ""; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
99 } |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
100 catch (LAFParserException lpe) { |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
101 Map<String, List<ReportData>> pErr = producer.getErrors(); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
102 if (pErr.isEmpty()) { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
103 List<ReportData> err = new ArrayList<ReportData>(); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
104 err.add(new ReportData("parser", lpe.getMessage(), 673)); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
105 this.errors.put("parser", err); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
106 this.warnings.put("parser", new ArrayList<ReportData>()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
107 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
108 else { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
109 this.errors.putAll(pErr); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
110 this.warnings.putAll(producer.getWarnings()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
111 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
112 this.producer.reset(); |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
113 laf = ""; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
114 continue; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
115 } |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
116 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
117 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
118 return parsed; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
119 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
120 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
121 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
122 * Write all created objects to the database. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
123 * |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
124 * @param auth The authentication information. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
125 */ |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
126 private void writeAll(AuthenticationResponse auth) { |
356
3f03e954c04d
Fixed reset for errors and warnings.
Raimund Renkert <rrenkert@intevation.de>
parents:
337
diff
changeset
|
127 String probeId = producer.getProbe().getProbeId() == null ? "probeId" : producer.getProbe().getProbeId(); |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
128 boolean p = writer.writeProbe(auth, producer.getProbe()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
129 if (!p) { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
130 this.errors.put(probeId, writer.getErrors()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
131 this.warnings.put(probeId, writer.getWarnings()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
132 return; |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
133 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
134 writer.writeProbenKommentare(auth, producer.getProbenKommentare()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
135 boolean m = writer.writeMessungen(auth, producer.getMessungen()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
136 if (!m) { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
137 return; |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
138 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
139 writer.writeOrte(auth, producer.getOrte()); |
364
d39d3886b97d
Use the new ort creator to produce ort and lort objects from laf attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
356
diff
changeset
|
140 writer.writeLOrte(auth, producer.getLOrte()); |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
141 writer.writeMessungKommentare(auth, producer.getMessungsKommentare()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
142 writer.writeMesswerte(auth, producer.getMesswerte()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
143 List<ReportData> err = this.errors.get(probeId); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
144 if (err == null) { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
145 this.errors.put(probeId, writer.getErrors()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
146 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
147 else { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
148 err.addAll(writer.getErrors()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
149 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
150 List<ReportData> warn = this.warnings.get(probeId); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
151 if (warn == null) { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
152 this.warnings.put(probeId, writer.getWarnings()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
153 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
154 else { |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
155 warn.addAll(writer.getWarnings()); |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
156 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
157 } |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
158 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
159 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
160 * Read all attributes from a single probe block and create entity objects. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
161 * |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
162 * @param content Single probe block enclosed by %PROBE% |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
163 * @throws LAFParserException |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
164 */ |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
165 private void readAll(String content) |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
166 throws LAFParserException |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
167 { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
168 boolean key = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
169 boolean value = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
170 boolean header = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
171 boolean white = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
172 boolean string = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
173 boolean multiValue = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
174 String keyString = ""; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
175 String valueString = ""; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
176 String headerString = ""; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
177 for (int i = 0; i < content.length(); i++) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
178 char current = content.charAt(i); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
179 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
180 if ((current == '"' || (current == ' ' && !string)) && |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
181 value && |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
182 i < content.length() - 1 && |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
183 (content.charAt(i + 1) != '\n' && |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
184 content.charAt(i + 1) != '\r')) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
185 multiValue = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
186 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
187 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
188 if (current == '"' && !string) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
189 string = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
190 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
191 else if (current == '"' && string) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
192 string = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
193 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
194 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
195 if (current == ' ' && !value) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
196 key = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
197 white = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
198 continue; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
199 } |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
200 else if (current != ' ' && |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
201 current != '\n' && |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
202 current != '\r' && |
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
203 white) { |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
204 value = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
205 white = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
206 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
207 else if (current == '%' && !header && !value) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
208 headerString = ""; |
364
d39d3886b97d
Use the new ort creator to produce ort and lort objects from laf attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
356
diff
changeset
|
209 producer.finishOrt(); |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
210 key = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
211 header = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
212 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
213 else if ((current == '\n' || current == '\r') && header) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
214 header = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
215 key = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
216 if (!dryRun) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
217 if (headerString.contains("MESSUNG")) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
218 producer.newMessung(); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
219 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
220 if (headerString.contains("ORT")) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
221 producer.newOrt(); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
222 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
223 } |
321
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
224 if (headerString.contains("%ENDE%")) { |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
225 if (!dryRun) { |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
226 this.producer.newMessung(); |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
227 this.producer.newOrt(); |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
228 } |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
229 return; |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
230 } |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
231 continue; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
232 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
233 else if (current == '"' && !value) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
234 value = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
235 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
236 else if ((current == '\n' || current == '\r') && value && !string) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
237 if (!multiValue && valueString.startsWith("\"")) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
238 valueString = |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
239 valueString.substring(1, valueString.length() - 1); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
240 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
241 value = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
242 multiValue = false; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
243 key = true; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
244 if (!this.dryRun) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
245 producer.addData(keyString, valueString); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
246 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
247 keyString = ""; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
248 valueString = ""; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
249 continue; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
250 } |
337
cb47c33b119d
Imporved error/warning handling and fixed some bugs in the importer module.
Raimund Renkert <rrenkert@intevation.de>
parents:
331
diff
changeset
|
251 if ((current == '\n' || current == '\r') && (key || white)) { |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
252 throw new LAFParserException("No value for key: " + keyString); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
253 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
254 |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
255 if (key) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
256 keyString += current; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
257 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
258 else if (value) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
259 valueString += current; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
260 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
261 else if (header) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
262 headerString += current; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
263 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
264 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
265 if (!dryRun) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
266 this.producer.newMessung(); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
267 this.producer.newOrt(); |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
268 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
269 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
270 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
271 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
272 * @return if objects are or not. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
273 */ |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
274 public boolean isDryRun() { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
275 return dryRun; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
276 } |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
277 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
278 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
279 * If set to true, no objects will be created and written to database. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
280 * |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
281 * @param dryRun |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
282 */ |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
283 public void setDryRun(boolean dryRun) { |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
284 this.dryRun = dryRun; |
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
285 } |
321
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
286 |
5844d7457dde
Completed importer for LAF format. Ort objects still need some attention.
Raimund Renkert <rrenkert@intevation.de>
parents:
316
diff
changeset
|
287 /** |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
288 * @return the warnings |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
289 */ |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
290 public Map<String, List<ReportData>> getWarnings() { |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
291 return warnings; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
292 } |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
293 |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
294 /** |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
295 * @return the errors |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
296 */ |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
297 public Map<String, List<ReportData>> getErrors() { |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
298 return errors; |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
299 } |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
300 |
366
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
301 /** |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
302 * Reset errors and warnings. |
567ce7697fc7
Code documentation.
Raimund Renkert <rrenkert@intevation.de>
parents:
364
diff
changeset
|
303 */ |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
304 public void reset() { |
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
305 producer.reset(); |
356
3f03e954c04d
Fixed reset for errors and warnings.
Raimund Renkert <rrenkert@intevation.de>
parents:
337
diff
changeset
|
306 this.errors = new HashMap<String, List<ReportData>>(); |
3f03e954c04d
Fixed reset for errors and warnings.
Raimund Renkert <rrenkert@intevation.de>
parents:
337
diff
changeset
|
307 this.warnings = new HashMap<String, List<ReportData>>(); |
331
5d11428e6a09
Made the importer a little more robust and introduced a better warning/error reporting.
Raimund Renkert <rrenkert@intevation.de>
parents:
321
diff
changeset
|
308 } |
310
821557a17e5e
First version of the LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
309 } |