Mercurial > dive4elements > gnv-client
view gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java @ 636:22cc12b1622c
Take parent states only to describe static user interface part - not the current state itself.
gnv-artifacts/trunk@718 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 01 Mar 2010 14:15:33 +0000 |
parents | 93978859fa9e |
children | 4fc97074eb90 |
line wrap: on
line source
/** * */ package de.intevation.gnv.state.layer; import java.io.OutputStream; import java.util.Collection; import java.util.Iterator; import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Node; import de.intevation.artifactdatabase.Config; import de.intevation.artifactdatabase.XMLUtils; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.gnv.geobackend.base.Result; import de.intevation.gnv.state.InputData; import de.intevation.gnv.state.OutputStateBase; import de.intevation.gnv.state.exception.StateException; /** * @author Tim Englich <tim.englich@intevation.de> * */ public class LayerOutputState extends OutputStateBase { /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(LayerOutputState.class); /** * The UID of this Class. */ private static final long serialVersionUID = 9180957321704424049L; /** * The ID for the Query fetching the Layer from the DB */ private String dataQueryID = null; /** * Constructor */ public LayerOutputState() { super(); } /** * @see de.intevation.gnv.state.OutputState#out(org.w3c.dom.Document, * java.util.Collection, java.io.OutputStream, * java.lang.String, de.intevation.artifacts.CallContext) */ public void out(Document format, Collection<InputData> inputData, OutputStream outputStream, String uuid, CallContext callContext) throws StateException { log.debug("LayerOutputState.out"); String outputMode = XMLUtils.xpathString( format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE); if (outputMode.equalsIgnoreCase("wms")) { Collection<Result> data = this.fetchData(); // TODO USE ME }else if (outputMode.equalsIgnoreCase("zip")){ Collection<Result> data = this.fetchData(); // TODO USE ME } } protected Collection<Result> fetchData(){ log.debug("LayerOutputState.fetchData"); // TODO PUT ALL in CACHE Collection<Result> result = this.getData(this.queryID); Collection<Result> data = null; if (result != null){ Iterator<Result> it = result.iterator(); String table = null; String where = null; if (it.hasNext()){ Result resultValue = it.next(); table = resultValue.getString(0); where = resultValue.getString(1); // TODO ADD SpatialFilter if Geometry is available } data = null; // TODO Fetch the Data for the Layer and Trim the Geometries // using the Geometry if on is available. } return data; } @Override public void setup(Node configuration) { log.debug("LayerOutputState.setup"); super.setup(configuration); this.dataQueryID = Config.getStringXPath(configuration,"queryID-layerdata"); } }