changeset 762:b3f922908a31

ISSUE122: Added all required Columns for the CSV-Export. gnv-artifacts/trunk@817 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 22 Mar 2010 12:47:44 +0000
parents 0b1de7e38907
children e4d1fded433b
files gnv-artifacts/ChangeLog gnv-artifacts/doc/conf/queries.properties gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java
diffstat 5 files changed, 145 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Mon Mar 22 11:23:33 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Mon Mar 22 12:47:44 2010 +0000
@@ -1,3 +1,21 @@
+2010-03-22  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 122
+
+	* src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java: 
+	  Added all required Columns for the CSV-Export. Integrated own 
+	  Columnspecifications for the different Kinds of Profiles (TimeSeriesPoints,
+	  Mesh, InstantaneousPoint).
+
+	* doc/conf/queries.properties: 
+	  Manipulated the Queries for fetching the Data for generating the CSV-Output
+	  for all kinds of Vertical- and Horizontalprofiles in that way that now all 
+	  required Columns were included.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: 
+	  Removed deprecated TODO-Flags.
+
 2010-03-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	  Issue209
--- a/gnv-artifacts/doc/conf/queries.properties	Mon Mar 22 11:23:33 2010 +0000
+++ b/gnv-artifacts/doc/conf/queries.properties	Mon Mar 22 12:47:44 2010 +0000
@@ -304,7 +304,9 @@
            TS.PARAMETERID GROUP1, \
            TSV.TIMEVALUE GROUP2, \
            1 GROUP3, \
-           1 DATAID \
+           1 DATAID, \
+           M.FEATUREID, \
+           TS.TIMESERIESID \
     from MEDIAN.TIMESERIES TS, \
          MEDIAN.TIMESERIESVALUE TSV, \
          MEDIAN.MEASUREMENT M \
@@ -464,7 +466,9 @@
            msv.PARAMETERID GROUP1, \
            msv.TIMEVALUE GROUP2, \
            1 GROUP3, \
-           2 DATAID \
+           2 DATAID, \
+           MP.FEATUREID, \
+           MP.MESHID \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT mp, \
          MEDIAN.MESH m, \
@@ -609,7 +613,9 @@
         MSV.PARAMETERID GROUP1, \
         IP.TIMEVALUE GROUP2, \
         1 GROUP3, \
-        3 DATAID \
+        3 DATAID, \
+        IP.FEATUREID, \
+        IP.SERIESID \
     FROM MEDIAN.INSTANTANEOUSPOINT IP, \
          MEDIAN.MEASUREMENT M, \
          MEDIAN.MEASUREDSCALARVALUE MSV \
@@ -857,7 +863,8 @@
         MSV.PARAMETERID GROUP1, \
         ZLOCATION GROUP2, \
         1 GROUP3, \
-        3 DATAID \
+        3 DATAID, \
+        MEDIAN.INSTANTANEOUSPOINT.SURVEYID \
     FROM MEDIAN.INSTANTANEOUSPOINT, \
          MEDIAN.MEASUREMENT M, \
          MEDIAN.MEASUREDSCALARVALUE MSV \
@@ -927,7 +934,8 @@
            msv.TIMEVALUE GROUP3, \
            MEDIAN.MESHPOINT.JPOSITION, \
            MEDIAN.MESHPOINT.IPOSITION, \
-           2 DATAID \
+           2 DATAID, \
+           MEDIAN.MESHPOINT.MESHID \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT, \
          MEDIAN.MESH m, \
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java	Mon Mar 22 11:23:33 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java	Mon Mar 22 12:47:44 2010 +0000
@@ -1,49 +1,35 @@
 package de.intevation.gnv.state.profile.horizontal;
 
-import de.intevation.artifacts.CallContext;
-
-import de.intevation.gnv.chart.Chart;
-import de.intevation.gnv.chart.ChartLabels;
-import de.intevation.gnv.chart.HorizontalProfileChart;
-
-import de.intevation.gnv.exports.DefaultExport;
-import de.intevation.gnv.exports.DefaultProfile;
-
-import de.intevation.gnv.exports.Export.Profile;
-
-import de.intevation.gnv.exports.ShapeDataCollector;
-
-import de.intevation.gnv.geobackend.base.Result;
-
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-
-import de.intevation.gnv.state.exception.StateException;
-
-import de.intevation.gnv.state.InputData;
-
-import de.intevation.gnv.state.timeseries.TimeSeriesOutputState;
-
-import de.intevation.gnv.statistics.HorizontalProfileStatistics;
-import de.intevation.gnv.statistics.Statistics;
-
-import de.intevation.gnv.utils.InputValidator;
-import de.intevation.gnv.utils.WKTUtils;
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
-
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-
 import java.util.Collection;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.Locale;
 
 import org.apache.log4j.Logger;
+import org.jfree.chart.ChartTheme;
 
-import org.jfree.chart.ChartTheme;
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.chart.Chart;
+import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.HorizontalProfileChart;
+import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.ShapeDataCollector;
+import de.intevation.gnv.exports.Export.Profile;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.state.InputData;
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.state.timeseries.TimeSeriesOutputState;
+import de.intevation.gnv.statistics.HorizontalProfileStatistics;
+import de.intevation.gnv.statistics.Statistics;
+import de.intevation.gnv.utils.InputValidator;
+import de.intevation.gnv.utils.WKTUtils;
 
 /**
  * @author Tim Englich (tim.englich@intevation.de)
@@ -52,11 +38,18 @@
 public class HorizontalProfileOutputState
 extends      TimeSeriesOutputState
 {    
-    public static final String [] HORIZONTAL_PROFILE_COLUMNS = {
+    public static final String [] HORIZONTAL_PROFILE_MESH_COLUMNS = {
         "SHAPE",
         "YORDINATE",
-        "GROUP1"
-        // "GROUP2",
+        "GROUP1",
+        "MESHID"
+    };
+    
+    public static final String [] HORIZONTAL_PROFILE_MEASUREMENT_COLUMNS = {
+        "SHAPE",
+        "YORDINATE",
+        "GROUP1",
+        "SURVEYID"
     };
 
 
@@ -65,7 +58,7 @@
         "Latitude",
         "Value",
         "ParameterID",
-        //"MeshID"
+        "MeshID"
     };
 
 
@@ -74,8 +67,9 @@
         "Latitude",
         "Value",
         "ParameterID",
-        //"SurveyID"
+        "SurveyID"
     };
+    
     /**
      * The UID of this class
      */
@@ -195,7 +189,7 @@
 
         Profile profile = null;
         int     dataid  = res.getInteger("DATAID").intValue();
-
+        DefaultExport export = null;
         // on meshes
         if (dataid == 2) {
             profile =  new DefaultProfile(
@@ -205,6 +199,8 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new ShapeDataCollector(HORIZONTAL_PROFILE_MESH_COLUMNS));
         }
 
         // on measurements
@@ -216,10 +212,11 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new ShapeDataCollector(HORIZONTAL_PROFILE_MEASUREMENT_COLUMNS));
         }
 
-        DefaultExport export = new DefaultExport(
-            new ShapeDataCollector(HORIZONTAL_PROFILE_COLUMNS));
+       
         export.create(profile, out, results);
     }
 
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java	Mon Mar 22 11:23:33 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java	Mon Mar 22 12:47:44 2010 +0000
@@ -11,14 +11,14 @@
 import java.util.Locale;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.ChartTheme;
 
+import de.intevation.artifacts.CallContext;
 import de.intevation.gnv.chart.Chart;
 import de.intevation.gnv.chart.ChartLabels;
 import de.intevation.gnv.chart.VerticalProfileChart;
+import de.intevation.gnv.exports.DefaultDataCollector;
 import de.intevation.gnv.exports.DefaultExport;
-import de.intevation.gnv.exports.DefaultDataCollector;
 import de.intevation.gnv.exports.DefaultProfile;
 import de.intevation.gnv.exports.Export.Profile;
 import de.intevation.gnv.geobackend.base.Result;
@@ -27,8 +27,6 @@
 import de.intevation.gnv.statistics.Statistics;
 import de.intevation.gnv.statistics.VerticalProfileStatistics;
 
-import de.intevation.artifacts.CallContext;
-
 /**
  * @author Tim Englich <tim.englich@intevation.de>
  * 
@@ -38,36 +36,52 @@
     public static final String [] VERTICAL_PROFILE_COLUMNS = {
         "XORDINATE", // not quite sure if this is depth
         "YORDINATE",
-        "GROUP1"
-        // "GROUP2",
-        // "GROUP3"
+        "GROUP1",
+        "FEATUREID",
+        "TIMESERIESID"
+    };
+    
+    public static final String [] VERTICAL_PROFILE_MESH_COLUMNS = {
+        "XORDINATE", // not quite sure if this is depth
+        "YORDINATE",
+        "GROUP1",
+        "FEATUREID",
+        "MESHID"
+    };
+    
+    public static final String [] VERTICAL_PROFILE_MEASUREMENT_COLUMNS = {
+        "XORDINATE", // not quite sure if this is depth
+        "YORDINATE",
+        "GROUP1",
+        "FEATUREID",
+        "SERIESID"
     };
 
 
     public static final String [] VERTICAL_MESH_CSV_COLUMN_LABEL = {
         "CentralDepth",
         "Value",
-        "ParameterID"
-        // TODO "FeatureID",
-        // TODO "MeshID"
+        "ParameterID",
+        "FeatureID",
+        "MeshID"
     };
 
 
     public static final String [] VERTICAL_TIMESERIES_CSV_COLUMN_LABEL = {
         "Depth",
         "Value",
-        "ParameterID"
-        // TODO FeatureID missing
-        // TODO TimeseriesID missing
+        "ParameterID",
+        "FeatureID",
+        "TimeseriesID"
     };
 
 
     public static final String [] VERTICAL_MEASUREMENT_CSV_COLUMN_LABEL = {
         "Depth",
         "Value",
-        "ParameterID"
-        // TODO FeatureID missing
-        // TODO SeriesID missing
+        "ParameterID",
+        "FeatureID",
+        "SeriesID"
     };
 
 
@@ -140,15 +154,15 @@
     protected void createCSV(OutputStream out, Collection<Result> results)
     throws UnsupportedEncodingException, IOException, StateException
     {
-        Iterator iter = results.iterator();
-        Result   res  = iter.hasNext() ? (Result) iter.next() : null;
+        Iterator<Result> iter = results.iterator();
+        Result   res  = iter.hasNext() ? iter.next() : null;
 
         if (res == null)
             return;
 
         Profile profile = null;
         int     dataid  = res.getInteger("DATAID").intValue();
-
+        DefaultExport export = null;
         // on meshes
         if (dataid == 2) {
             profile =  new DefaultProfile(
@@ -158,6 +172,8 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new DefaultDataCollector(VERTICAL_PROFILE_MESH_COLUMNS));
         }
 
         // on timeseries
@@ -169,6 +185,8 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new DefaultDataCollector(VERTICAL_PROFILE_COLUMNS));
         }
 
         // on measurements
@@ -180,10 +198,9 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new DefaultDataCollector(VERTICAL_PROFILE_MEASUREMENT_COLUMNS));
         }
-
-        DefaultExport export = new DefaultExport(
-            new DefaultDataCollector(VERTICAL_PROFILE_COLUMNS));
         export.create(profile, out, results);
     }
 
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Mon Mar 22 11:23:33 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Mon Mar 22 12:47:44 2010 +0000
@@ -1,66 +1,8 @@
 package de.intevation.gnv.state.timeseries;
 
-import au.com.bytecode.opencsv.CSVWriter;
-
-import de.intevation.artifactdatabase.Config;
-import de.intevation.artifactdatabase.XMLUtils;
-
-import de.intevation.artifacts.ArtifactNamespaceContext;
-import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.CallMeta;
-
-import de.intevation.gnv.artifacts.context.GNVArtifactContext;
-
-import de.intevation.gnv.artifacts.ressource.RessourceFactory;
-
-import de.intevation.gnv.chart.Chart;
-import de.intevation.gnv.chart.ChartLabels;
-import de.intevation.gnv.chart.DefaultHistogram;
-import de.intevation.gnv.chart.TimeSeriesChart;
-import de.intevation.gnv.chart.XMLChartTheme;
-
-import de.intevation.gnv.chart.exception.TechnicalChartException;
-
-import de.intevation.gnv.exports.ChartExportHelper;
-import de.intevation.gnv.exports.DefaultDataCollector;
-import de.intevation.gnv.exports.DefaultExport;
-import de.intevation.gnv.exports.DefaultProfile;
-
-import de.intevation.gnv.exports.Export.Profile;
-
-import de.intevation.gnv.exports.SimpleOdvDataCollector;
-
-import de.intevation.gnv.geobackend.base.Result;
-
-import de.intevation.gnv.histogram.HistogramHelper;
-
-import de.intevation.gnv.state.InputData;
-import de.intevation.gnv.state.OutputStateBase;
-
-import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-import de.intevation.gnv.state.describedata.NamedArrayList;
-import de.intevation.gnv.state.describedata.NamedCollection;
-
-import de.intevation.gnv.state.exception.StateException;
-
-import de.intevation.gnv.statistics.Statistic;
-import de.intevation.gnv.statistics.StatisticSet;
-import de.intevation.gnv.statistics.Statistics;
-import de.intevation.gnv.statistics.TimeseriesStatistics;
-
-import de.intevation.gnv.statistics.exception.StatisticsException;
-
-import de.intevation.gnv.timeseries.gap.DefaultTimeGap;
-import de.intevation.gnv.timeseries.gap.TimeGap;
-
-import de.intevation.gnv.utils.ArtifactXMLUtilities;
-
-import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -71,14 +13,50 @@
 import java.util.Vector;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.ChartTheme;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import au.com.bytecode.opencsv.CSVWriter;
+import de.intevation.artifactdatabase.Config;
+import de.intevation.artifactdatabase.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.gnv.artifacts.context.GNVArtifactContext;
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+import de.intevation.gnv.chart.Chart;
+import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.DefaultHistogram;
+import de.intevation.gnv.chart.TimeSeriesChart;
+import de.intevation.gnv.chart.XMLChartTheme;
+import de.intevation.gnv.chart.exception.TechnicalChartException;
+import de.intevation.gnv.exports.ChartExportHelper;
+import de.intevation.gnv.exports.DefaultDataCollector;
+import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.SimpleOdvDataCollector;
+import de.intevation.gnv.exports.Export.Profile;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.histogram.HistogramHelper;
+import de.intevation.gnv.state.InputData;
+import de.intevation.gnv.state.OutputStateBase;
+import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.describedata.NamedArrayList;
+import de.intevation.gnv.state.describedata.NamedCollection;
+import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.statistics.Statistic;
+import de.intevation.gnv.statistics.StatisticSet;
+import de.intevation.gnv.statistics.Statistics;
+import de.intevation.gnv.statistics.TimeseriesStatistics;
+import de.intevation.gnv.statistics.exception.StatisticsException;
+import de.intevation.gnv.timeseries.gap.DefaultTimeGap;
+import de.intevation.gnv.timeseries.gap.TimeGap;
+import de.intevation.gnv.utils.ArtifactXMLUtilities;
+
 /**
  * @author Tim Englich    (tim.englich@intevation.de)
  * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
@@ -168,7 +146,6 @@
 
     /**
      * Profile for exporting data to odv
-     * TODO Change TIMESERIES_PROFILE_NAMES, which belong to CSV exports
      */
     public static final Profile TIMESERIES_ODV_PROFILE =
         new DefaultProfile(

http://dive4elements.wald.intevation.org