changeset 8225:724081af301c

Pass request document to the context injectors.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 08 Sep 2014 16:14:43 +0200
parents 18c737ec098b
children e7ad8b7e66bc
files artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java
diffstat 3 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java	Mon Sep 08 16:06:50 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java	Mon Sep 08 16:14:43 2014 +0200
@@ -330,13 +330,14 @@
 
         // XXX NOTE: the outGen is not able to process its generate() operation,
         // because it has no OutputStream set!
-        outGen.init(out, XMLUtils.newDocument(), null, getContext());
+        Document dummy = XMLUtils.newDocument();
+        outGen.init(out, dummy, null, getContext());
         prepareMasterArtifact(outGen);
 
         try {
             Document outAttr = getAttribute(attr, out);
             OutputHelper helper = new OutputHelper(identifier());
-            helper.doOut(outGen, out, out, outAttr, getContext());
+            helper.doOut(outGen, out, out, outAttr, getContext(), dummy);
         }
         catch (ArtifactDatabaseException adbe) {
             log.error(adbe, adbe);
@@ -422,9 +423,9 @@
             Document attr = getAttribute(cAttr, name);
             OutputHelper helper = new OutputHelper(identifier());
             if (name.equals("sq_overview")) {
-                helper.doOut(generator, name, subtype, format, context);
+                helper.doOut(generator, name, subtype, format, context, format);
             }
-            helper.doOut(generator, name, subtype, attr, context);
+            helper.doOut(generator, name, subtype, attr, context, format);
             generator.generate();
         }
         catch (ArtifactDatabaseException adbe) {
--- a/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java	Mon Sep 08 16:06:50 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java	Mon Sep 08 16:14:43 2014 +0200
@@ -86,9 +86,9 @@
         String       outName,
         String       facet,
         Document     attributes,
-        CallContext  context)
-    throws IOException
-    {
+        CallContext  context,
+        Document     request
+    ) throws IOException {
         boolean debug = log.isDebugEnabled();
 
         if (debug) {
@@ -132,7 +132,7 @@
                 }
 
                 if (ci != null) {
-                    ci.injectContext(context, dataProviders.get(i).getArtifact(), null);
+                    ci.injectContext(context, dataProviders.get(i).getArtifact(), request);
                 }
 
                 if (outName.equals("sq_overview")) {
--- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java	Mon Sep 08 16:06:50 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java	Mon Sep 08 16:14:43 2014 +0200
@@ -94,11 +94,6 @@
             /* Make sure master is also set in those */
             g.setMasterArtifact(master);
 
-            if (g == null) {
-                log.debug("generator is null.");
-                return;
-            }
-
             OutputHelper helper = new OutputHelper(master.identifier());
             Document collectionAttribute = collection.getAttribute();
 
@@ -106,7 +101,7 @@
                 Document cAttr = getAttribute(context, collectionAttribute, name);
                 g.init(name, request, out, context);
 
-                helper.doOut(g, name, name, cAttr, context);
+                helper.doOut(g, name, name, cAttr, context, request);
                 JFreeChart chart = g.generateChart();
                 chart.removeLegend();
                 charts.add(chart);

http://dive4elements.wald.intevation.org