diff gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java @ 99:bb45c5097cb6

ehcache Integration for storing the chartresultvalues gnv-artifacts/trunk@146 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 28 Sep 2009 14:17:15 +0000
parents 156db25ad4b4
children ef157bd2fa92
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java	Mon Sep 28 10:20:41 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java	Mon Sep 28 14:17:15 2009 +0000
@@ -77,10 +77,12 @@
    /**
     * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, java.util.Collection, java.io.OutputStream)
     */
-    public void out(String outputMode, Collection<InputData> inputData, OutputStream outputStream) throws TransitionException {
+    public void out(String outputMode, Collection<InputData> inputData, OutputStream outputStream, String uuid) throws TransitionException {
         log.debug("TimeSeriesOutputTransition.out");
         try {
-            this.advance();
+       
+            this.advance(uuid);
+            Collection<Result> chartResult = this.getChartResult(uuid); 
             if (outputMode.equalsIgnoreCase("chart")){
                 log.debug("Chart will be generated.");
                 int chartWidth = 600;
@@ -106,12 +108,12 @@
                 ChartStyle chartStyle = this.creatStyle(chartWidth,chartHeight);
                 ChartLabels chartLables = new ChartLabels(this.getSelectedFeatureName(),this.domainLable);
                 this.createChart(outputStream, parameters, measurements,
-                        chartStyle, chartLables);
+                        chartStyle, chartLables,uuid);
             }else if (outputMode.equalsIgnoreCase("csv")){
                 log.debug("CSV-File will be generated.");
-                if(this.chartResult != null){
+                if(chartResult != null){
                     CSVWriter writer = new CSVWriter(new OutputStreamWriter(outputStream,"ISO-8859-1"), ','); // USE THIS ENCODING BECAUSE OF PROBLEMS WITH EXCEL AND UTF-8
-                    Iterator<Result>it = this.chartResult.iterator();
+                    Iterator<Result>it = chartResult.iterator();
                     while (it.hasNext()){
                         Result result = it.next();
                         int i = 0;
@@ -131,7 +133,7 @@
             }else if (outputMode.equalsIgnoreCase("statistics")){
                 log.debug("Statistics will be generated.");
                 Statistics s = getStatisticsGenerator();
-                Collection<Statistic> statistics = s.calculateStatistics(this.chartResult);
+                Collection<Statistic> statistics = s.calculateStatistics(chartResult);
                 Document doc = this.writeStatistics2XML(statistics);
                 this.writeDocument2OutputStream(doc, outputStream);
             }
@@ -219,20 +221,12 @@
     protected void createChart(OutputStream outputStream,
             Collection<KeyValueDescibeData> parameters,
             Collection<KeyValueDescibeData> measurements,
-            ChartStyle chartStyle, ChartLabels chartLables) throws IOException,
+            ChartStyle chartStyle, ChartLabels chartLables, String uuid) throws IOException,
             TechnicalChartException {
         ChartFactory chartFactory = new ChartFactory();
         chartFactory.createSimpleTimeSeriesChart(chartLables, chartStyle,
                                                  parameters, measurements, 
-                                                 outputStream, this.chartResult);
-    }
-
-    /**
-     * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection)
-     */
-    @Override
-    protected void purifyResult(Collection<Result> result) {
-        this.chartResult = result;
+                                                 outputStream, this.getChartResult(uuid));
     }
     
     protected ChartStyle creatStyle(int witdh, int height){

http://dive4elements.wald.intevation.org