comparison flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java @ 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 45cd58a2a2bb
children cded0924193d
comparison
equal deleted inserted replaced
700:94f0f91be11c 701:dad1a2c88f9f
17 17
18 import de.intevation.artifacts.common.ArtifactNamespaceContext; 18 import de.intevation.artifacts.common.ArtifactNamespaceContext;
19 import de.intevation.artifacts.common.utils.XMLUtils; 19 import de.intevation.artifacts.common.utils.XMLUtils;
20 20
21 import de.intevation.flys.artifacts.resources.Resources; 21 import de.intevation.flys.artifacts.resources.Resources;
22
23 import de.intevation.flys.artifacts.FLYSArtifact;
22 24
23 25
24 /** 26 /**
25 * An abstract exporter that implements some basic methods for exporting data of 27 * An abstract exporter that implements some basic methods for exporting data of
26 * artifacts. 28 * artifacts.
76 * data. 78 * data.
77 * 79 *
78 * @param artifacts The artifact that stores the data that has to be 80 * @param artifacts The artifact that stores the data that has to be
79 * exported. 81 * exported.
80 */ 82 */
81 protected abstract void addData(Artifact artifact); 83 protected abstract void addData(Object data);
82 84
83 85
84 public void init(Document request, OutputStream out, CallContext context) { 86 public void init(Document request, OutputStream out, CallContext context) {
85 logger.debug("AbstractExporter.init"); 87 logger.debug("AbstractExporter.init");
86 88
115 if (!isFacetValid(name)) { 117 if (!isFacetValid(name)) {
116 logger.warn("Facet '" + name + "' not valid. No output created!"); 118 logger.warn("Facet '" + name + "' not valid. No output created!");
117 return; 119 return;
118 } 120 }
119 121
120 addData(artifact); 122 FLYSArtifact flys = (FLYSArtifact)artifact;
123
124 Facet nativeFacet = flys.getNativeFacet(facet);
125
126 if (nativeFacet != null) {
127 addData(nativeFacet.getData(flys, context));
128 }
121 } 129 }
122 130
123 131
124 /** 132 /**
125 * Generates an export based on a specified facet. 133 * Generates an export based on a specified facet.

http://dive4elements.wald.intevation.org