changeset 646:d299e220d89c

Added support for the 'type' parameter of the collection's out() operation. flys-artifacts/trunk@2031 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 31 May 2011 14:56:18 +0000
parents 433f67a076aa
children bb484489d3df
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java
diffstat 2 files changed, 31 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 31 09:35:19 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 31 14:56:18 2011 +0000
@@ -1,3 +1,9 @@
+2011-05-31  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java:
+	  Added support for the 'type' paramter of the collection's out()
+	  operation.
+
 2011-05-31	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Tue May 31 09:35:19 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Tue May 31 14:56:18 2011 +0000
@@ -123,7 +123,11 @@
 
 
     @Override
-    public void out(Document format, OutputStream out, CallContext context)
+    public void out(
+        String       type,
+        Document     format,
+        OutputStream out,
+        CallContext  context)
     throws IOException
     {
         log.info("FLYSArtifactCollection.out");
@@ -131,13 +135,26 @@
         String name = XMLUtils.xpathString(
             format, XPATH_OUT_NAME, ArtifactNamespaceContext.INSTANCE);
 
-        String type = XMLUtils.xpathString(
+        String subtype = XMLUtils.xpathString(
             format, XPATH_OUT_TYPE, ArtifactNamespaceContext.INSTANCE);
 
-        log.debug("Output name = " + name);
-        log.debug("Output type = " + type);
+        log.info("-> Output name = " + name);
+        log.info("-> Output type = " + type);
+        log.info("-> Output subtype = " + subtype);
 
-        OutGenerator generator = getOutGenerator(context, name, type);
+        OutGenerator generator = null;
+        if (type != null && type.length() > 0) {
+            if (type.indexOf("chartinfo") > 0) {
+                generator = getOutGenerator(context, type, subtype);
+            }
+            else {
+                generator = getOutGenerator(context, name, subtype);
+            }
+        }
+        else {
+            generator = getOutGenerator(context, name, subtype);
+        }
+
         if (generator == null) {
             log.error("There is no generator specified for output: " + name);
             // TODO throw an exception.
@@ -150,7 +167,8 @@
         // TODO Determine the correct master artifact here!
 
         try {
-            doOut(generator, name, type, getAttribute(context, name), context);
+            Document attr = getAttribute(context, name);
+            doOut(generator, name, subtype, attr, context);
         }
         catch (ArtifactDatabaseException adbe) {
             log.error(adbe, adbe);
@@ -175,7 +193,7 @@
         CallContext  context)
     throws IOException
     {
-        log.debug("FLYSArtifactCollection.doOut: " + outName);
+        log.info("FLYSArtifactCollection.doOut: " + outName);
 
         ThemeList themeList = new ThemeList(attributes);
 

http://dive4elements.wald.intevation.org