use of org.keycloak.representations.info.ThemeInfoRepresentation in project keycloak by keycloak.
the class ServerInfoAdminResource method setThemes.
private void setThemes(ServerInfoRepresentation info) {
info.setThemes(new HashMap<>());
for (Theme.Type type : Theme.Type.values()) {
List<String> themeNames = filterThemes(type, new LinkedList<>(session.theme().nameSet(type)));
Collections.sort(themeNames);
List<ThemeInfoRepresentation> themes = new LinkedList<>();
info.getThemes().put(type.toString().toLowerCase(), themes);
for (String name : themeNames) {
try {
Theme theme = session.theme().getTheme(name, type);
ThemeInfoRepresentation ti = new ThemeInfoRepresentation();
ti.setName(name);
String locales = theme.getProperties().getProperty("locales");
if (locales != null) {
ti.setLocales(locales.replaceAll(" ", "").split(","));
}
themes.add(ti);
} catch (IOException e) {
throw new WebApplicationException("Failed to load themes", e);
}
}
}
}
Aggregations