Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/exports/ODVExport.java @ 1105:19813e72ec06
Added missing column MESHID for csv export on product 'Horizontales Schnittprofil' (issue284).
gnv-artifacts/trunk@1235 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 28 Jun 2010 17:44:40 +0000 |
parents | 2b4f1c095468 |
children | f953c9a559d8 |
rev | line source |
---|---|
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.exports; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 import java.util.Collection; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 import java.util.HashMap; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 import java.util.Iterator; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 import java.util.Map; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.Logger; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 |
800
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
11 import au.com.bytecode.opencsv.CSVWriter; |
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
12 import de.intevation.gnv.geobackend.base.Result; |
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
13 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
14 import de.intevation.gnv.state.exception.StateException; |
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
15 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 /** |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
17 * This class is used to create a specific export document which is similar to |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
18 * an CSV document. |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 * |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
20 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 */ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 public class ODVExport extends DefaultExport { |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
24 /** |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
25 * Logger used for logging via log4j. |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
26 */ |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 private static Logger log = Logger.getLogger(ODVExport.class); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
28 |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
29 /** |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
30 * Collection of parameters. |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
31 */ |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 private Collection parameters = null; |
835
2423cefe7d39
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
816
diff
changeset
|
33 |
812
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
34 /** |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
35 * The TimeStime which should be integrated in the Export to mark a |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
36 * TimeSeries. |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
37 */ |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
38 private String startTime = null; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
39 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 /** |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 * Constructor |
794
d0967fdee36f
Repaired JavaDoc in Export package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
42 * @param collector DataCollector used to extract the required data. |
d0967fdee36f
Repaired JavaDoc in Export package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
43 * @param parameters A collection of parameters to be displayed in the |
d0967fdee36f
Repaired JavaDoc in Export package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
44 * export. |
835
2423cefe7d39
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
816
diff
changeset
|
45 * @param startTime The TimeStamp which should ne integrated in the export |
2423cefe7d39
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
816
diff
changeset
|
46 * to mark a TimeSeries. If it should not be a TimeSeries this Value must |
812
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
47 * be null. |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 */ |
812
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
49 public ODVExport(DataCollector collector, Collection parameters, String startTime) { |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 super(collector); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 this.parameters = parameters; |
812
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
52 this.startTime = startTime; |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
812
diff
changeset
|
55 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 @Override |
1058
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
57 protected void writeData( |
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
58 Profile profile, Collection result, CSVWriter writer |
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
59 )throws StateException |
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
60 { |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 Iterator<Result> it = result.iterator(); |
1058
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
62 log.debug("Put " + result.size() + " elements into odv export."); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 String[] header = profile.getHeader(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 ArrayList<String> headerList = new ArrayList<String>(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 for (int i= 0; i < header.length; i++){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 headerList.add(header[i]); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 } |
835
2423cefe7d39
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
816
diff
changeset
|
69 |
812
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
70 if (this.startTime != null){ |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
71 headerList.add("time_ISO8601"); |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
72 } |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 ArrayList<String> paramids = new ArrayList<String>(); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
74 |
1058
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
75 Map<StringArrayKey, Map<String,String>> aggregatedRows = |
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
76 new HashMap<StringArrayKey, Map<String,String>>(); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
77 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 while (it.hasNext()) { |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 Result res = it.next(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 |
800
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
81 String[] value = collector.getData(res); |
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
82 StringArrayKey key = new StringArrayKey(value); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 String parameterValue = res.getString("DATAVALUE"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 String parameterID = res.getString("PARAMETER"); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
85 |
1058
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
86 if (!paramids.contains(parameterID)){ |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 paramids.add(parameterID); |
1058
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
88 headerList.add(findParamTitle(parameters, parameterID)); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 headerList.add("QF"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
91 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 Map<String,String> aggregatedRow = aggregatedRows.get(key); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
93 if (aggregatedRow!= null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 aggregatedRow.put(parameterID, parameterValue); |
1058
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
95 } |
2b4f1c095468
Fixed the aggregation of row with the same parameter in the odv export (issue291).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
96 else{ |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
97 Map<String,String> params = new HashMap<String, String>(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
98 params.put(parameterID, parameterValue); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
99 aggregatedRows.put(key, params); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
100 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
101 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
102 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 if (header != null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 writer.writeNext(headerList.toArray(header)); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 |
800
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
107 Iterator<StringArrayKey> rows = aggregatedRows.keySet().iterator(); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 while (rows.hasNext()){ |
800
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
109 StringArrayKey row = rows.next(); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
110 Map<String,String> params = aggregatedRows.get(row); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 ArrayList<String> rowList = new ArrayList<String>(); |
800
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
112 String[] rowArray = row.getValue(); |
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
113 for (int i= 0; i < rowArray.length; i++){ |
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
114 rowList.add(rowArray[i]); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
115 } |
812
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
116 if (this.startTime != null){ |
816
cda3bede32f8
ISSUE215 Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601
Tim Englich <tim.englich@intevation.de>
parents:
815
diff
changeset
|
117 String measurementtime = rowList.get(3).replace(' ','T'); |
cda3bede32f8
ISSUE215 Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601
Tim Englich <tim.englich@intevation.de>
parents:
815
diff
changeset
|
118 rowList.set(3, this.startTime.replace('.','-')); |
cda3bede32f8
ISSUE215 Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601
Tim Englich <tim.englich@intevation.de>
parents:
815
diff
changeset
|
119 rowList.add(measurementtime+":00.0"); |
812
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
120 } |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 for (int i = 0; i < paramids.size();i++){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 String key = paramids.get(i); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 String value = params.get(key); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 if (value == null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 value = ""; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 rowList.add(value); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 rowList.add("1"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 } |
800
db5b04ecb426
ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row.
Tim Englich <tim.englich@intevation.de>
parents:
794
diff
changeset
|
130 writer.writeNext(rowList.toArray(rowArray)); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
133 |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
134 /** |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
135 * This method is used to search specific value coresponding to its key |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
136 * <code>id</code> and return its description. |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
137 * |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
138 * @param values Collection of parameters. |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
139 * @param id Key used to find the value. |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
140 * |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
141 * @return Description of searched value. |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
142 */ |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
143 protected String findParamTitle(Collection values, String id) { |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
144 log.debug("find description of dataset"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
145 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
146 if (values != null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
147 Iterator it = values.iterator(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
148 while (it.hasNext()) { |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
149 KeyValueDescibeData data = (KeyValueDescibeData) it.next(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
150 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
151 if (id.equals(data.getKey())) |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
152 return data.getValue(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
153 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
154 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
155 return ""; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
156 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
157 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
158 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
159 } |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
160 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |