Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/exports/ReportGenerator.java @ 1106:e9f66d63bdd0
Write user defined barriers into a shapefile that is placed in the Artifact's directory.
flys-artifacts/trunk@2609 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 30 Aug 2011 11:09:54 +0000 |
parents | c09c9e05ecfa |
children | bdb05dc9b763 |
line wrap: on
line source
package de.intevation.flys.exports; import java.io.IOException; import java.io.OutputStream; import org.apache.log4j.Logger; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.model.Calculation; import org.w3c.dom.Document; public class ReportGenerator implements OutGenerator { private static Logger logger = Logger.getLogger(ReportGenerator.class); protected Document result; protected OutputStream out; protected CallContext context; public ReportGenerator() { } @Override public void init(Document request, OutputStream out, CallContext context) { logger.debug("init"); this.out = out; this.context = context; result = XMLUtils.newDocument(); } @Override public void setMasterArtifact(Artifact master) { // not needed } @Override public void doOut(Artifact artifact, Facet facet, Document attr) { logger.debug("doOut"); facet = ((FLYSArtifact)artifact).getNativeFacet(facet); if (facet != null) { Calculation report = (Calculation)facet.getData(artifact, context); report.toXML(result, context.getMeta()); } } @Override public void generate() throws IOException { logger.debug("generate"); XMLUtils.toStream(result, out); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :