annotate gnv-artifacts/src/main/java/de/intevation/gnv/exports/ODVExport.java @ 1115:f953c9a559d8

Added license file and license headers. gnv-artifacts/trunk@1260 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:46:55 +0000
parents 2b4f1c095468
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
5 * Read the file LGPL.txt coming with the software for details
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1058
diff changeset
8
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.exports;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import java.util.ArrayList;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import java.util.Collection;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import java.util.HashMap;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import java.util.Iterator;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import java.util.Map;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18
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
19 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
20 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
21 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
22 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
23
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 /**
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
25 * 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
26 * an CSV document.
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 *
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
28 * @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
29 */
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 public class ODVExport extends DefaultExport {
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
32 /**
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
33 * 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
34 */
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 private static Logger log = Logger.getLogger(ODVExport.class);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
36
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
37 /**
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
38 * Collection of parameters.
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
39 */
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 private Collection parameters = null;
835
2423cefe7d39 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 816
diff changeset
41
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
42 /**
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 800
diff changeset
43 * 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
44 * 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
45 */
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 private String startTime = null;
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
47
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 /**
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 * Constructor
794
d0967fdee36f Repaired JavaDoc in Export package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 779
diff changeset
50 * @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
51 * @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
52 * export.
835
2423cefe7d39 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 816
diff changeset
53 * @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
54 * 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
55 * be null.
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 */
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
57 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
58 super(collector);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 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
60 this.startTime = startTime;
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 812
diff changeset
63
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 @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
65 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
66 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
67 )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
68 {
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 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
70 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
71
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 String[] header = profile.getHeader();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 ArrayList<String> headerList = new ArrayList<String>();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 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
75 headerList.add(header[i]);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 }
835
2423cefe7d39 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 816
diff changeset
77
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
78 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
79 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
80 }
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 ArrayList<String> paramids = new ArrayList<String>();
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
82
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
83 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
84 new HashMap<StringArrayKey, Map<String,String>>();
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
85
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 while (it.hasNext()) {
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 Result res = it.next();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88
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
89 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
90 StringArrayKey key = new StringArrayKey(value);
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 String parameterValue = res.getString("DATAVALUE");
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 String parameterID = res.getString("PARAMETER");
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
93
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
94 if (!paramids.contains(parameterID)){
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 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
96 headerList.add(findParamTitle(parameters, parameterID));
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 headerList.add("QF");
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
99
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 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
101 if (aggregatedRow!= null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 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
103 }
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
104 else{
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 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
106 params.put(parameterID, parameterValue);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 aggregatedRows.put(key, params);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
110
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 if (header != null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 writer.writeNext(headerList.toArray(header));
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114
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
115 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
116 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
117 StringArrayKey row = rows.next();
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118 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
119 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
120 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
121 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
122 rowList.add(rowArray[i]);
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 }
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
124 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
125 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
126 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
127 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
128 }
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 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
130 String key = paramids.get(i);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 String value = params.get(key);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 if (value == null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133 value = "";
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
134 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135 rowList.add(value);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
136 rowList.add("1");
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137 }
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
138 writer.writeNext(rowList.toArray(rowArray));
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
141
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
142 /**
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
143 * 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
144 * <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
145 *
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
146 * @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
147 * @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
148 *
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
149 * @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
150 */
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 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
152 log.debug("find description of dataset");
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 if (values != null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 Iterator it = values.iterator();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 while (it.hasNext()) {
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
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 if (id.equals(data.getKey()))
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 return data.getValue();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 return "";
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
165
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 }
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
168 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org