use of org.ambraproject.wombat.config.theme.ThemeGraph in project wombat by PLOS.
the class TestSpringConfiguration method themeGraph.
@Bean
public ThemeGraph themeGraph() throws ThemeGraph.ThemeConfigurationException {
TestClasspathTheme rootTheme = new TestClasspathTheme("root", ImmutableList.of());
TestClasspathTheme theme1 = new TestClasspathTheme("site1", ImmutableList.of(rootTheme));
TestClasspathTheme theme2 = new TestClasspathTheme("site2", ImmutableList.of(rootTheme));
Set<Theme> themes = ImmutableSet.of(rootTheme, theme1, theme2);
return new ThemeGraph(Maps.uniqueIndex(themes, Theme::getKey));
}
use of org.ambraproject.wombat.config.theme.ThemeGraph in project wombat by PLOS.
the class SpringConfiguration method themeGraph.
@Bean
public ThemeGraph themeGraph(ServletContext servletContext, RuntimeConfiguration runtimeConfiguration) throws ThemeGraph.ThemeConfigurationException, IOException {
String path = "/WEB-INF/themes/";
InternalTheme root = new InternalTheme(".Root", ImmutableList.of(), servletContext, path + "root/");
InternalTheme desktop = new InternalTheme(".Desktop", ImmutableList.of(root), servletContext, path + "desktop/");
InternalTheme mobile = new InternalTheme(".Mobile", ImmutableList.of(root), servletContext, path + "mobile/");
Collection<InternalTheme> internalThemes = ImmutableList.of(root, desktop, mobile);
Collection<ThemeSource<?>> themeSources = runtimeConfiguration.getThemeSources();
Collection<ThemeBuilder<?>> themeBuilders = themeSources.stream().flatMap(ts -> ts.readThemes().stream()).collect(Collectors.toList());
return ThemeGraph.create(root, internalThemes, themeBuilders);
}
Aggregations