Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/exports/ODVExport.java @ 812:41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
gnv-artifacts/trunk@896 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 09 Apr 2010 13:00:38 +0000 |
parents | db5b04ecb426 |
children | 22c18083225e |
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; |
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
|
33 |
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. |
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
|
45 * @param startTime The TimeStamp which should ne integrated in the export |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
46 * to mark a TimeSeries. If it should not be a TimeSeries this Value must |
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 |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
55 /** |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
56 * @see de.intevation.gnv.exports.Export#writeData(Profile, Collection, |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
57 * CSVWriter) |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
58 */ |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 @Override |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 protected void writeData(Profile profile, Collection result, |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 CSVWriter writer) throws StateException { |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 Iterator<Result> it = result.iterator(); |
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 } |
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
|
69 |
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 |
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
|
75 Map<StringArrayKey, Map<String,String>> aggregatedRows = new HashMap<StringArrayKey, Map<String,String>>(); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
76 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 String currentParameterID = "N/N"; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
78 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 while (it.hasNext()) { |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 Result res = it.next(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 |
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
|
82 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
|
83 StringArrayKey key = new StringArrayKey(value); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 String parameterValue = res.getString("DATAVALUE"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 String parameterID = res.getString("PARAMETER"); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
86 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 if (!currentParameterID.equals(parameterID)){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 paramids.add(parameterID); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 headerList.add(this.findParamTitle(parameters, parameterID)); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 headerList.add("QF"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 currentParameterID = parameterID; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
93 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 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
|
95 if (aggregatedRow!= null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
96 aggregatedRow.put(parameterID, parameterValue); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
97 }else{ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
98 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
|
99 params.put(parameterID, parameterValue); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
100 aggregatedRows.put(key, params); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
101 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
102 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
103 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 if (header != null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 writer.writeNext(headerList.toArray(header)); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 |
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
|
108 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
|
109 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
|
110 StringArrayKey row = rows.next(); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 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
|
115 rowList.add(rowArray[i]); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
116 } |
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
|
117 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
|
118 rowList.add(this.startTime); |
41a7c49b5cb4
ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
800
diff
changeset
|
119 } |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 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
|
121 String key = paramids.get(i); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 String value = params.get(key); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 if (value == null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 value = ""; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 rowList.add(value); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 rowList.add("1"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 } |
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
|
129 writer.writeNext(rowList.toArray(rowArray)); |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
130 } |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
132 |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
133 /** |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
134 * 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
|
135 * <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
|
136 * |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
137 * @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
|
138 * @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
|
139 * |
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
140 * @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
|
141 */ |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
142 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
|
143 log.debug("find description of dataset"); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
144 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
145 if (values != null){ |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
146 Iterator it = values.iterator(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
147 while (it.hasNext()) { |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
148 KeyValueDescibeData data = (KeyValueDescibeData) it.next(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
149 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
150 if (id.equals(data.getKey())) |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
151 return data.getValue(); |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
152 } |
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 return ""; |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
155 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
771
diff
changeset
|
156 |
765
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
157 |
f28a7eac542a
Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
158 } |
771
a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
765
diff
changeset
|
159 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |