[PATCH] Call context inspector in output helper
Wald Commits
scm-commit at wald.intevation.org
Mon Sep 8 15:48:21 CEST 2014
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1410184091 -7200
# Node ID a0994a326e2a6de941119697a005dc939b208bf7
# Parent 1d3d61c8f596fe56b757bb428bbaa132a72023fd
Call context inspector in output helper.
diff -r 1d3d61c8f596 -r a0994a326e2a artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java Mon Sep 08 13:33:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java Mon Sep 08 15:48:11 2014 +0200
@@ -23,6 +23,8 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.dive4elements.artifacts.ContextInjector;
+
import org.dive4elements.artifactdatabase.Backend;
import org.dive4elements.artifactdatabase.Backend.PersistentArtifact;
import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
@@ -52,6 +54,24 @@
public OutputHelper(String identifier) {
this.identifier = identifier;
}
+
+ private static ContextInjector getContextInjector(CallContext context, String out) {
+ RiverContext flysContext = context instanceof RiverContext
+ ? (RiverContext)context
+ : (RiverContext)context.globalContext();
+
+ GeneratorLookup generators =
+ (GeneratorLookup)flysContext.get(RiverContext.OUTGENERATORS_KEY);
+
+ if (generators == null) {
+ return null;
+ }
+
+ GeneratorLookup.Item item = generators.getGenerator(out);
+ return item != null
+ ? item.getContextInjector()
+ : null;
+ }
/**
* Creates a concrete output.
*
@@ -82,6 +102,8 @@
List<ArtifactAndFacet> dataProviders =
doBlackboardPass(themeList, context, outName);
+ ContextInjector ci = getContextInjector(context, outName);
+
try {
for (int i = 0, T = themeList.size(); i < T; i++) {
ManagedFacet theme = themeList.get(i);
@@ -109,6 +131,10 @@
continue;
}
+ if (ci != null) {
+ ci.injectContext(context, dataProviders.get(i).getArtifact());
+ }
+
if (outName.equals("sq_overview")) {
generator.doOut(
dataProviders.get(i),
More information about the Dive4Elements-commits
mailing list