comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 388:cc6840cbe503

Introduced an export output target on collection level that enables collections to be exported. flys-artifacts/trunk@1809 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 03 May 2011 16:26:35 +0000
parents fc3cf0ef777e
children a67748ad4d61
comparison
equal deleted inserted replaced
387:6c63e3c3f77d 388:cc6840cbe503
132 format, XPATH_OUT_NAME, ArtifactNamespaceContext.INSTANCE); 132 format, XPATH_OUT_NAME, ArtifactNamespaceContext.INSTANCE);
133 133
134 String type = XMLUtils.xpathString( 134 String type = XMLUtils.xpathString(
135 format, XPATH_OUT_TYPE, ArtifactNamespaceContext.INSTANCE); 135 format, XPATH_OUT_TYPE, ArtifactNamespaceContext.INSTANCE);
136 136
137 log.debug("Output name = " + name);
138 log.debug("Output type = " + type);
139
137 OutGenerator generator = getOutGenerator(context, name, type); 140 OutGenerator generator = getOutGenerator(context, name, type);
138 if (generator == null) { 141 if (generator == null) {
139 log.error("There is no generator specified for output: " + type); 142 log.error("There is no generator specified for output: " + type);
140 // TODO throw an exception. 143 // TODO throw an exception.
141 144
143 } 146 }
144 147
145 generator.init(format, out, context); 148 generator.init(format, out, context);
146 149
147 try { 150 try {
148 doOut(generator, name, getAttribute(context, name), context); 151 doOut(generator, name, type, getAttribute(context, name), context);
149 } 152 }
150 catch (ArtifactDatabaseException adbe) { 153 catch (ArtifactDatabaseException adbe) {
151 log.error(adbe, adbe); 154 log.error(adbe, adbe);
152 } 155 }
153 } 156 }
163 * @param context The context object. 166 * @param context The context object.
164 */ 167 */
165 protected void doOut( 168 protected void doOut(
166 OutGenerator generator, 169 OutGenerator generator,
167 String outName, 170 String outName,
171 String facet,
168 Document attributes, 172 Document attributes,
169 CallContext context) 173 CallContext context)
170 throws IOException 174 throws IOException
171 { 175 {
172 log.debug("FLYSArtifactCollection.doOut: " + outName); 176 log.debug("FLYSArtifactCollection.doOut: " + outName);
192 log.debug("... artifact: " + art); 196 log.debug("... artifact: " + art);
193 log.debug("... facet: " + theme.getName()); 197 log.debug("... facet: " + theme.getName());
194 } 198 }
195 199
196 String facetName = theme.getName(); 200 String facetName = theme.getName();
201
202 if (outName.equals("export") && !facetName.equals(facet)) {
203 continue;
204 }
197 205
198 generator.doOut( 206 generator.doOut(
199 getArtifact(art, context), 207 getArtifact(art, context),
200 facetName, 208 facetName,
201 getFacetThemeFromAttribute( 209 getFacetThemeFromAttribute(
602 if (generators == null) { 610 if (generators == null) {
603 log.error("No output generators found in the running application!"); 611 log.error("No output generators found in the running application!");
604 return null; 612 return null;
605 } 613 }
606 614
607 Class clazz = generators.get(type); 615 Class clazz = generators.get(name);
608 616
609 try { 617 try {
610 return clazz != null ? (OutGenerator) clazz.newInstance() : null; 618 return clazz != null ? (OutGenerator) clazz.newInstance() : null;
611 } 619 }
612 catch (InstantiationException ie) { 620 catch (InstantiationException ie) {

http://dive4elements.wald.intevation.org