annotate gnv-artifacts/src/main/java/de/intevation/gnv/exports/ODVExport.java @ 816:cda3bede32f8

ISSUE215 Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601 gnv-artifacts/trunk@901 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 12 Apr 2010 09:26:26 +0000
parents 22c18083225e
children 2423cefe7d39
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
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
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 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
58 CSVWriter writer) throws StateException {
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 Iterator<Result> it = result.iterator();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 String[] header = profile.getHeader();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 ArrayList<String> headerList = new ArrayList<String>();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 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
64 headerList.add(header[i]);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 }
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
66
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 800
diff changeset
67 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
68 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
69 }
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 ArrayList<String> paramids = new ArrayList<String>();
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
71
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
72 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
73
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 String currentParameterID = "N/N";
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
75
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 while (it.hasNext()) {
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 Result res = it.next();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78
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
79 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
80 StringArrayKey key = new StringArrayKey(value);
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 String parameterValue = res.getString("DATAVALUE");
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 String parameterID = res.getString("PARAMETER");
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
83
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 if (!currentParameterID.equals(parameterID)){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 paramids.add(parameterID);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 headerList.add(this.findParamTitle(parameters, parameterID));
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 headerList.add("QF");
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 currentParameterID = parameterID;
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
90
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 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
92 if (aggregatedRow!= null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 aggregatedRow.put(parameterID, parameterValue);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 }else{
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 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
96 params.put(parameterID, parameterValue);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 aggregatedRows.put(key, params);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
100
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 if (header != null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 writer.writeNext(headerList.toArray(header));
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104
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
105 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
106 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
107 StringArrayKey row = rows.next();
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 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
109 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
110 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
111 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
112 rowList.add(rowArray[i]);
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 }
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
114 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
115 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
116 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
117 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
118 }
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 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
120 String key = paramids.get(i);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 String value = params.get(key);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 if (value == null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 value = "";
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 rowList.add(value);
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 rowList.add("1");
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 }
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
128 writer.writeNext(rowList.toArray(rowArray));
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 }
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
131
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
132 /**
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
133 * 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
134 * <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
135 *
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
136 * @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
137 * @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
138 *
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
139 * @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
140 */
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141 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
142 log.debug("find description of dataset");
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 if (values != null){
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145 Iterator it = values.iterator();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 while (it.hasNext()) {
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149 if (id.equals(data.getKey()))
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 return data.getValue();
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 }
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 return "";
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 771
diff changeset
155
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 }
771
a0e63136954e Added and repaired javadoc in de.intevation.gnv.exports package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 765
diff changeset
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org