Mercurial > dive4elements > river
changeset 8221:a0994a326e2a
Call context inspector in output helper.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 08 Sep 2014 15:48:11 +0200 |
parents | 1d3d61c8f596 |
children | 1cd7225df846 0bec47e5a951 |
files | artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java |
diffstat | 1 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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),