Mercurial > dive4elements > river
changeset 695:45cd58a2a2bb facets-slt
OutGenerators doOut() takes a facet object now instead of just its name.
flys-artifacts/branches/facets-slt@2137 c6561f87-3c4e-4783-a992-168aeb5c3f6f
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Thu Jun 16 14:31:41 2011 +0000 @@ -234,7 +234,7 @@ generator.doOut( artifact, - facetName, + theme, getFacetThemeFromAttribute( art, outName,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Thu Jun 16 14:31:41 2011 +0000 @@ -13,6 +13,8 @@ import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.artifacts.common.ArtifactNamespaceContext; import de.intevation.artifacts.common.utils.XMLUtils; @@ -105,11 +107,13 @@ * skipped. * @param attr The attr document. */ - public void doOut(Artifact artifact, String facet, Document attr) { - logger.debug("AbstractExporter.doOut: " + facet); + public void doOut(Artifact artifact, Facet facet, Document attr) { + String name = facet.getName(); - if (!isFacetValid(facet)) { - logger.warn("Facet '" + facet + "' not valid. No output created!"); + logger.debug("AbstractExporter.doOut: " + name); + + if (!isFacetValid(name)) { + logger.warn("Facet '" + name + "' not valid. No output created!"); return; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -18,6 +18,8 @@ import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.flys.model.River; import de.intevation.flys.artifacts.FLYSArtifact; @@ -243,7 +245,7 @@ } - public abstract void doOut(Artifact artifact, String facet, Document attr); + public abstract void doOut(Artifact artifact, Facet facet, Document attr); public abstract void generate() throws IOException; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartInfoGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartInfoGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -14,6 +14,8 @@ import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.artifacts.common.utils.XMLUtils; @@ -77,7 +79,7 @@ * @param facet * @param attr */ - public void doOut(Artifact artifact, String facet, Document attr) { + public void doOut(Artifact artifact, Facet facet, Document attr) { generator.doOut(artifact, facet, attr); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -9,6 +9,8 @@ import de.intevation.artifacts.Artifact; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.WQKms; @@ -65,7 +67,7 @@ @Override - public void doOut(Artifact artifact, String facet, Document attr) { + public void doOut(Artifact artifact, Facet facet, Document attr) { logger.debug("ComputedDischargeCurveGenerator.doOut"); WQKms wqkms = getData(artifact);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -15,6 +15,8 @@ import de.intevation.artifacts.Artifact; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.flys.model.DischargeTable; import de.intevation.flys.model.Gauge; import de.intevation.flys.model.River; @@ -92,8 +94,8 @@ } - public void doOut(Artifact artifact, String facet, Document attr) { - logger.debug("DischargeCurveGenerator.doOut: " + facet); + public void doOut(Artifact artifact, Facet facet, Document attr) { + logger.debug("DischargeCurveGenerator.doOut: " + facet.getName()); if (!(artifact instanceof FLYSArtifact)) { logger.error("Artifact is no instance of FLYSArtifact.");
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -14,6 +14,8 @@ import de.intevation.artifacts.Artifact; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.WQCKms; import de.intevation.flys.artifacts.model.WQKms; @@ -92,7 +94,7 @@ @Override - public void doOut(Artifact artifact, String facet, Document attr) { + public void doOut(Artifact artifact, Facet facet, Document attr) { logger.debug("DischargeLongitudinalSectionGenerator.doOut"); if (facet != null && facet.equals(FACET_W)) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -16,6 +16,8 @@ import de.intevation.artifacts.Artifact; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.flys.model.River; import de.intevation.flys.artifacts.WINFOArtifact; @@ -157,10 +159,13 @@ } - public void doOut(Artifact artifact, String facet, Document attr) { - logger.debug("DurationCurveGenerator.doOut: " + facet); + @Override + public void doOut(Artifact artifact, Facet facet, Document attr) { + String name = facet.getName(); - if (facet == null || facet.length() == 0) { + logger.debug("DurationCurveGenerator.doOut: " + name); + + if (name == null || name.length() == 0) { logger.error("No facet given. Cannot create dataset."); return; } @@ -168,14 +173,14 @@ WINFOArtifact winfo = (WINFOArtifact) artifact; River river = winfo.getRiver(); - if (facet.equals(DURATION_CURVE_W)) { + if (name.equals(DURATION_CURVE_W)) { doWOut(getDurationCurveData(artifact), river.getName()); } - else if (facet.equals(DURATION_CURVE_Q)) { + else if (name.equals(DURATION_CURVE_Q)) { doQOut(getDurationCurveData(artifact), river.getName()); } else { - logger.warn("Unknown facet name: " + facet); + logger.warn("Unknown facet name: " + name); return; } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -17,6 +17,8 @@ import de.intevation.artifacts.Artifact; +import de.intevation.artifactdatabase.state.Facet; + import de.intevation.flys.model.River; import de.intevation.flys.artifacts.FLYSArtifact; @@ -179,22 +181,24 @@ } - public void doOut(Artifact artifact, String facet, Document attr) { - logger.debug("LongitudinalSectionGenerator.doOut: " + facet); + public void doOut(Artifact artifact, Facet facet, Document attr) { + String name = facet.getName(); - if (facet == null) { + logger.debug("LongitudinalSectionGenerator.doOut: " + name); + + if (name == null) { logger.error("No facet name for doOut(). No output generated!"); return; } - if (facet.equals(LONGITUDINAL_SECTION_W)) { + if (name.equals(LONGITUDINAL_SECTION_W)) { doWOut(getWaterlevelData(artifact)); } - else if (facet.equals(LONGITUDINAL_SECTION_Q)) { + else if (name.equals(LONGITUDINAL_SECTION_Q)) { doQOut(getWaterlevelData(artifact)); } else { - logger.warn("Unknown facet name: " + facet); + logger.warn("Unknown facet name: " + name); return; } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/OutGenerator.java Thu Jun 16 14:10:49 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/OutGenerator.java Thu Jun 16 14:31:41 2011 +0000 @@ -8,6 +8,8 @@ import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; +import de.intevation.artifactdatabase.state.Facet; + /** * An OutGenerator is used to create a collected outputs of a list of Artifacts. @@ -44,7 +46,7 @@ * @param attr A document that might contain some attributes used while * producing the output. */ - void doOut(Artifact artifact, String facet, Document attr); + void doOut(Artifact artifact, Facet facet, Document attr); /** * Writes the collected output of all artifacts specified in the