[PATCH] Pass request document to the context injectors

Wald Commits scm-commit at wald.intevation.org
Mon Sep 8 16:14:46 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1410185683 -7200
# Node ID 724081af301c0957d03d0a26ff39ee9258812766
# Parent  18c737ec098baa9d046b394c34d03c81322c94ab
Pass request document to the context injectors.

diff -r 18c737ec098b -r 724081af301c artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java
--- 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) {
diff -r 18c737ec098b -r 724081af301c artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java
--- 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")) {
diff -r 18c737ec098b -r 724081af301c artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java
--- 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);


More information about the Dive4Elements-commits mailing list