Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveExporter.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | 32563516c485 |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
46 /** | 46 /** |
47 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 47 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
48 */ | 48 */ |
49 public class HistoricalDischargeCurveExporter extends AbstractExporter { | 49 public class HistoricalDischargeCurveExporter extends AbstractExporter { |
50 | 50 |
51 private static final Logger logger = | 51 private static final Logger log = |
52 Logger.getLogger(HistoricalDischargeCurveExporter.class); | 52 Logger.getLogger(HistoricalDischargeCurveExporter.class); |
53 | 53 |
54 | 54 |
55 public static final String CSV_TIMERANGE_HEADER = | 55 public static final String CSV_TIMERANGE_HEADER = |
56 "export.historical.discharge.csv.header.timerange"; | 56 "export.historical.discharge.csv.header.timerange"; |
82 data = new ArrayList<WQTimerange[]>(); | 82 data = new ArrayList<WQTimerange[]>(); |
83 } | 83 } |
84 | 84 |
85 @Override | 85 @Override |
86 protected void addData(Object d) { | 86 protected void addData(Object d) { |
87 logger.debug("Add data of class: " + d.getClass()); | 87 log.debug("Add data of class: " + d.getClass()); |
88 | 88 |
89 if (d instanceof CalculationResult) { | 89 if (d instanceof CalculationResult) { |
90 d = ((CalculationResult) d).getData(); | 90 d = ((CalculationResult) d).getData(); |
91 | 91 |
92 logger.debug("Internal data of CalculationResult: " + d.getClass()); | 92 log.debug("Internal data of CalculationResult: " + d.getClass()); |
93 | 93 |
94 if (d instanceof HistoricalDischargeData) { | 94 if (d instanceof HistoricalDischargeData) { |
95 d = (WQTimerange[]) ((HistoricalDischargeData) d).getWQTimeranges(); | 95 d = (WQTimerange[]) ((HistoricalDischargeData) d).getWQTimeranges(); |
96 | 96 |
97 if (d instanceof WQTimerange[]) { | 97 if (d instanceof WQTimerange[]) { |
98 logger.debug("Add new data of type WQTimerange"); | 98 log.debug("Add new data of type WQTimerange"); |
99 data.add((WQTimerange[]) d); | 99 data.add((WQTimerange[]) d); |
100 } | 100 } |
101 } | 101 } |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 @Override | 106 @Override |
107 protected void writeCSVData(CSVWriter writer) { | 107 protected void writeCSVData(CSVWriter writer) { |
108 logger.info("HistoricalDischargeCurveExporter.writeCSVData"); | 108 log.info("HistoricalDischargeCurveExporter.writeCSVData"); |
109 logger.debug("CSV gets " + data.size() + " WQTimerange[] objects."); | 109 log.debug("CSV gets " + data.size() + " WQTimerange[] objects."); |
110 | 110 |
111 writeCSVHeader(writer); | 111 writeCSVHeader(writer); |
112 | 112 |
113 for (WQTimerange[] arr: data) { | 113 for (WQTimerange[] arr: data) { |
114 for (WQTimerange wqt: arr) { | 114 for (WQTimerange wqt: arr) { |
136 parameters, | 136 parameters, |
137 source); | 137 source); |
138 JasperExportManager.exportReportToPdfStream(print, out); | 138 JasperExportManager.exportReportToPdfStream(print, out); |
139 } | 139 } |
140 catch(JRException je) { | 140 catch(JRException je) { |
141 logger.warn("Error generating PDF Report!"); | 141 log.warn("Error generating PDF Report!"); |
142 je.printStackTrace(); | 142 je.printStackTrace(); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 | 146 |
157 }); | 157 }); |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 protected void wqt2CSV(CSVWriter writer, WQTimerange wqt) { | 161 protected void wqt2CSV(CSVWriter writer, WQTimerange wqt) { |
162 logger.debug("Add next WQTimerange to CSV"); | 162 log.debug("Add next WQTimerange to CSV"); |
163 | 163 |
164 DateFormat df = Formatter.getMediumDateFormat(context); | 164 DateFormat df = Formatter.getMediumDateFormat(context); |
165 NumberFormat wf = Formatter.getHistoricalDischargeW(context); | 165 NumberFormat wf = Formatter.getHistoricalDischargeW(context); |
166 NumberFormat qf = Formatter.getHistoricalDischargeQ(context); | 166 NumberFormat qf = Formatter.getHistoricalDischargeQ(context); |
167 | 167 |