changeset 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 6c63e3c3f77d
children 69d05357c177
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java
diffstat 2 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 03 13:23:00 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 03 16:26:35 2011 +0000
@@ -1,3 +1,10 @@
+2011-05-03  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java:
+	  Introduced an "export" output target. If the target is "export", a
+	  facet (read from the incoming xml document) is a necessary parameter
+	  that determines which facets are written to the output.
+
 2011-05-03  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/resources/messages_en.properties: Bugfix: replaced german
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Tue May 03 13:23:00 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Tue May 03 16:26:35 2011 +0000
@@ -134,6 +134,9 @@
         String type = XMLUtils.xpathString(
             format, XPATH_OUT_TYPE, ArtifactNamespaceContext.INSTANCE);
 
+        log.debug("Output name = " + name);
+        log.debug("Output type = " + type);
+
         OutGenerator generator = getOutGenerator(context, name, type);
         if (generator == null) {
             log.error("There is no generator specified for output: " + type);
@@ -145,7 +148,7 @@
         generator.init(format, out, context);
 
         try {
-            doOut(generator, name, getAttribute(context, name), context);
+            doOut(generator, name, type, getAttribute(context, name), context);
         }
         catch (ArtifactDatabaseException adbe) {
             log.error(adbe, adbe);
@@ -165,6 +168,7 @@
     protected void doOut(
         OutGenerator generator,
         String       outName,
+        String       facet,
         Document     attributes,
         CallContext  context)
     throws IOException
@@ -195,6 +199,10 @@
 
                 String facetName = theme.getName();
 
+                if (outName.equals("export") && !facetName.equals(facet)) {
+                    continue;
+                }
+
                 generator.doOut(
                     getArtifact(art, context),
                     facetName,
@@ -604,7 +612,7 @@
             return null;
         }
 
-        Class clazz = generators.get(type);
+        Class clazz = generators.get(name);
 
         try {
             return clazz != null ? (OutGenerator) clazz.newInstance() : null;

http://dive4elements.wald.intevation.org