Mercurial > dive4elements > river
changeset 701:dad1a2c88f9f facets-slt
Base WST/CSV exports on facets. TODO: generate the facets.
flys-artifacts/branches/facets-slt@2151 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 17 Jun 2011 13:45:50 +0000 |
parents | 94f0f91be11c |
children | 32ed5d789e50 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java |
diffstat | 6 files changed, 35 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Fri Jun 17 13:10:20 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Fri Jun 17 13:45:50 2011 +0000 @@ -13,5 +13,8 @@ String DURATION_W = "duration_curve.w"; String DURATION_Q = "duration_curve.q"; + + String CSV = "csv"; + String WST = "wst"; } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Fri Jun 17 13:10:20 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Fri Jun 17 13:45:50 2011 +0000 @@ -20,6 +20,8 @@ import de.intevation.flys.artifacts.resources.Resources; +import de.intevation.flys.artifacts.FLYSArtifact; + /** * An abstract exporter that implements some basic methods for exporting data of @@ -78,7 +80,7 @@ * @param artifacts The artifact that stores the data that has to be * exported. */ - protected abstract void addData(Artifact artifact); + protected abstract void addData(Object data); public void init(Document request, OutputStream out, CallContext context) { @@ -117,7 +119,13 @@ return; } - addData(artifact); + FLYSArtifact flys = (FLYSArtifact)artifact; + + Facet nativeFacet = flys.getNativeFacet(facet); + + if (nativeFacet != null) { + addData(nativeFacet.getData(flys, context)); + } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java Fri Jun 17 13:10:20 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveExporter.java Fri Jun 17 13:45:50 2011 +0000 @@ -3,6 +3,7 @@ import java.io.OutputStream; import java.text.NumberFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.w3c.dom.Document; @@ -11,10 +12,8 @@ import au.com.bytecode.opencsv.CSVWriter; -import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; -import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.WQKms; import de.intevation.flys.utils.Formatter; @@ -51,9 +50,11 @@ } - protected void addData(Artifact artifact) { - WINFOArtifact winfoArtifact = (WINFOArtifact) artifact; - data.add(winfoArtifact.getComputedDischargeCurveData()); + @Override + protected void addData(Object d) { + if (d instanceof WQKms []) { + data.addAll(Arrays.asList((WQKms [])d)); + } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java Fri Jun 17 13:10:20 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java Fri Jun 17 13:45:50 2011 +0000 @@ -6,9 +6,6 @@ import au.com.bytecode.opencsv.CSVWriter; -import de.intevation.artifacts.Artifact; - -import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.WQCKms; import de.intevation.flys.artifacts.model.WQKms; @@ -41,13 +38,10 @@ @Override - protected void addData(Artifact artifact) { - WINFOArtifact winfo = (WINFOArtifact) artifact; - WQKms[] wqkms = winfo.getDischargeLongitudinalSectionData(); - - logger.debug("Got " + wqkms != null ? wqkms.length : 0 + " WQKms obj."); - - data.add(wqkms); + protected void addData(Object d) { + if (d instanceof WQKms []) { + data.add((WQKms [])d); + } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveExporter.java Fri Jun 17 13:10:20 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveExporter.java Fri Jun 17 13:45:50 2011 +0000 @@ -3,6 +3,7 @@ import java.io.OutputStream; import java.text.NumberFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.w3c.dom.Document; @@ -11,10 +12,8 @@ import au.com.bytecode.opencsv.CSVWriter; -import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; -import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.WQDay; import de.intevation.flys.utils.Formatter; @@ -55,9 +54,11 @@ } - protected void addData(Artifact artifact) { - WINFOArtifact winfoArtifact = (WINFOArtifact) artifact; - data.add(winfoArtifact.getDurationCurveData()); + @Override + protected void addData(Object d) { + if (d instanceof WQDay []) { + data.addAll(Arrays.asList((WQDay [])d)); + } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Fri Jun 17 13:10:20 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Fri Jun 17 13:45:50 2011 +0000 @@ -77,8 +77,11 @@ } - protected void addData(Artifact artifact) { - data.add(getWaterlevelData(artifact)); + @Override + protected void addData(Object d) { + if (d instanceof WQKms []) { + data.add((WQKms [])d); + } } @@ -99,6 +102,7 @@ } + @Override protected void writeCSVData(CSVWriter writer) { logger.info("WaterlevelExporter.writeData");