Skip to content
Snippets Groups Projects
Commit b03f3b2b authored by Mike McKay's avatar Mike McKay
Browse files

Moved XnatAppInfo to use new way of accessing site config preferences.

parent 87f20105
No related branches found
No related tags found
No related merge requests found
......@@ -51,8 +51,8 @@ import java.util.Properties;
@Import({PropertiesConfig.class, DatabaseConfig.class, SecurityConfig.class, ApplicationConfig.class})
public class RootConfig {
@Bean
public XnatAppInfo appInfo(final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException {
return new XnatAppInfo(context, serializerService, template);
public XnatAppInfo appInfo(final SiteConfigPreferences preferences, final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException {
return new XnatAppInfo(preferences, context, serializerService, template);
}
@Bean
......
......@@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.nrg.framework.services.SerializerService;
import org.nrg.prefs.exceptions.InvalidPreferenceName;
import org.nrg.xdat.XDAT;
import org.nrg.xdat.preferences.SiteConfigPreferences;
import org.python.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -47,7 +47,8 @@ public class XnatAppInfo {
private static final String SECONDS = "seconds";
@Inject
public XnatAppInfo(final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException {
public XnatAppInfo(final SiteConfigPreferences preferences, final ServletContext context, final SerializerService serializerService, final JdbcTemplate template) throws IOException {
_preferences=preferences;
_template = template;
final Resource configuredUrls = RESOURCE_LOADER.getResource("classpath:META-INF/xnat/security/configured-urls.yaml");
......@@ -175,7 +176,7 @@ public class XnatAppInfo {
new Object[]{_foundPreferences.get(pref), pref}, new int[]{Types.VARCHAR, Types.VARCHAR}
);
try {
XDAT.getSiteConfigPreferences().set(_foundPreferences.get(pref), pref);
_preferences.set(_foundPreferences.get(pref), pref);
} catch (InvalidPreferenceName e) {
_log.error("", e);
} catch (NullPointerException e) {
......@@ -452,7 +453,7 @@ public class XnatAppInfo {
private final String _nonAdminErrorPath;
private final Pattern _nonAdminErrorPathPattern;
private final AntPathRequestMatcher _nonAdminErrorPathMatcher;
private final SiteConfigPreferences _preferences;
private final Map<String, AntPathRequestMatcher> _openUrls = new HashMap<>();
private final Map<String, AntPathRequestMatcher> _adminUrls = new HashMap<>();
private final Map<String, AntPathRequestMatcher> _initPaths = new HashMap<>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment