Mercurial > dive4elements > gnv-client
comparison 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 |
comparison
equal
deleted
inserted
replaced
811:df6d980c5418 | 812:41a7c49b5cb4 |
---|---|
28 | 28 |
29 /** | 29 /** |
30 * Collection of parameters. | 30 * Collection of parameters. |
31 */ | 31 */ |
32 private Collection parameters = null; | 32 private Collection parameters = null; |
33 | |
34 /** | |
35 * The TimeStime which should be integrated in the Export to mark a | |
36 * TimeSeries. | |
37 */ | |
38 private String startTime = null; | |
33 | 39 |
34 /** | 40 /** |
35 * Constructor | 41 * Constructor |
36 * @param collector DataCollector used to extract the required data. | 42 * @param collector DataCollector used to extract the required data. |
37 * @param parameters A collection of parameters to be displayed in the | 43 * @param parameters A collection of parameters to be displayed in the |
38 * export. | 44 * export. |
45 * @param startTime The TimeStamp which should ne integrated in the export | |
46 * to mark a TimeSeries. If it should not be a TimeSeries this Value must | |
47 * be null. | |
39 */ | 48 */ |
40 public ODVExport(DataCollector collector, Collection parameters) { | 49 public ODVExport(DataCollector collector, Collection parameters, String startTime) { |
41 super(collector); | 50 super(collector); |
42 this.parameters = parameters; | 51 this.parameters = parameters; |
52 this.startTime = startTime; | |
43 } | 53 } |
44 | 54 |
45 /** | 55 /** |
46 * @see de.intevation.gnv.exports.Export#writeData(Profile, Collection, | 56 * @see de.intevation.gnv.exports.Export#writeData(Profile, Collection, |
47 * CSVWriter) | 57 * CSVWriter) |
53 | 63 |
54 String[] header = profile.getHeader(); | 64 String[] header = profile.getHeader(); |
55 ArrayList<String> headerList = new ArrayList<String>(); | 65 ArrayList<String> headerList = new ArrayList<String>(); |
56 for (int i= 0; i < header.length; i++){ | 66 for (int i= 0; i < header.length; i++){ |
57 headerList.add(header[i]); | 67 headerList.add(header[i]); |
68 } | |
69 | |
70 if (this.startTime != null){ | |
71 headerList.add("time_ISO8601"); | |
58 } | 72 } |
59 ArrayList<String> paramids = new ArrayList<String>(); | 73 ArrayList<String> paramids = new ArrayList<String>(); |
60 | 74 |
61 Map<StringArrayKey, Map<String,String>> aggregatedRows = new HashMap<StringArrayKey, Map<String,String>>(); | 75 Map<StringArrayKey, Map<String,String>> aggregatedRows = new HashMap<StringArrayKey, Map<String,String>>(); |
62 | 76 |
98 ArrayList<String> rowList = new ArrayList<String>(); | 112 ArrayList<String> rowList = new ArrayList<String>(); |
99 String[] rowArray = row.getValue(); | 113 String[] rowArray = row.getValue(); |
100 for (int i= 0; i < rowArray.length; i++){ | 114 for (int i= 0; i < rowArray.length; i++){ |
101 rowList.add(rowArray[i]); | 115 rowList.add(rowArray[i]); |
102 } | 116 } |
117 if (this.startTime != null){ | |
118 rowList.add(this.startTime); | |
119 } | |
103 for (int i = 0; i < paramids.size();i++){ | 120 for (int i = 0; i < paramids.size();i++){ |
104 String key = paramids.get(i); | 121 String key = paramids.get(i); |
105 String value = params.get(key); | 122 String value = params.get(key); |
106 if (value == null){ | 123 if (value == null){ |
107 value = ""; | 124 value = ""; |