comparison artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java @ 8254:c87c87544cc6

Made call context injectors a list of comma separated classes.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 10 Sep 2014 12:42:39 +0200
parents 724081af301c
children 4d99606a844e
comparison
equal deleted inserted replaced
8253:b6d54b946f4c 8254:c87c87544cc6
53 53
54 public OutputHelper(String identifier) { 54 public OutputHelper(String identifier) {
55 this.identifier = identifier; 55 this.identifier = identifier;
56 } 56 }
57 57
58 private static ContextInjector getContextInjector(CallContext context, String out) { 58 private static List<ContextInjector> getContextInjectors(CallContext context, String out) {
59 RiverContext flysContext = context instanceof RiverContext 59 RiverContext flysContext = context instanceof RiverContext
60 ? (RiverContext)context 60 ? (RiverContext)context
61 : (RiverContext)context.globalContext(); 61 : (RiverContext)context.globalContext();
62 62
63 GeneratorLookup generators = 63 GeneratorLookup generators =
67 return null; 67 return null;
68 } 68 }
69 69
70 GeneratorLookup.Item item = generators.getGenerator(out); 70 GeneratorLookup.Item item = generators.getGenerator(out);
71 return item != null 71 return item != null
72 ? item.getContextInjector() 72 ? item.getContextInjectors()
73 : null; 73 : null;
74 } 74 }
75 /** 75 /**
76 * Creates a concrete output. 76 * Creates a concrete output.
77 * 77 *
100 ThemeDocument themeDoc = new ThemeDocument(attributes); 100 ThemeDocument themeDoc = new ThemeDocument(attributes);
101 101
102 List<ArtifactAndFacet> dataProviders = 102 List<ArtifactAndFacet> dataProviders =
103 doBlackboardPass(themeList, context, outName); 103 doBlackboardPass(themeList, context, outName);
104 104
105 ContextInjector ci = getContextInjector(context, outName); 105 List<ContextInjector> cis = getContextInjectors(context, outName);
106 106
107 try { 107 try {
108 for (int i = 0, T = themeList.size(); i < T; i++) { 108 for (int i = 0, T = themeList.size(); i < T; i++) {
109 ManagedFacet theme = themeList.get(i); 109 ManagedFacet theme = themeList.get(i);
110 110
129 // Skip invisible themes. 129 // Skip invisible themes.
130 if (theme.getVisible() == 0) { 130 if (theme.getVisible() == 0) {
131 continue; 131 continue;
132 } 132 }
133 133
134 if (ci != null) { 134 if (cis != null) {
135 ci.injectContext(context, dataProviders.get(i).getArtifact(), request); 135 for (ContextInjector ci: cis) {
136 ci.injectContext(
137 context, dataProviders.get(i).getArtifact(), request);
138 }
136 } 139 }
137 140
138 if (outName.equals("sq_overview")) { 141 if (outName.equals("sq_overview")) {
139 generator.doOut( 142 generator.doOut(
140 dataProviders.get(i), 143 dataProviders.get(i),

http://dive4elements.wald.intevation.org