use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class AlfrescoNavigationHandler method getWizardContainer.
/**
* Retrieves the configured wizard container page
*
* @param context FacesContext
* @return The container page
*/
protected String getWizardContainer(FacesContext context) {
String container;
// determine which kind of container we need to return, if the
// external session flag is set then use the plain container
Object obj = context.getExternalContext().getSessionMap().get(EXTERNAL_CONTAINER_SESSION);
if (obj != null && obj instanceof Boolean && ((Boolean) obj).booleanValue()) {
if ((this.plainWizardContainer == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) {
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null) {
this.plainWizardContainer = globalConfig.getConfigElement("plain-wizard-container").getValue();
}
}
container = this.plainWizardContainer;
} else {
if ((this.wizardContainer == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) {
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null) {
this.wizardContainer = globalConfig.getConfigElement("wizard-container").getValue();
}
}
container = this.wizardContainer;
}
if (logger.isDebugEnabled())
logger.debug("Using wizard container: " + container);
return container;
}
use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class AlfrescoNavigationHandler method getWizardConfig.
/**
* Returns the wizard configuration object for the given wizard name.
* If there is a node in the dispatch context a lookup is performed using
* the node otherwise the global config section is used.
*
* @param name The name of wizard being launched
* @param dispatchContext The node being acted upon
* @return The WizardConfig for the wizard or null if no config could be found
*/
protected WizardConfig getWizardConfig(FacesContext context, String name, Node dispatchContext) {
WizardConfig wizardConfig = null;
ConfigService configSvc = Application.getConfigService(context);
Config config = null;
if (dispatchContext != null) {
if (logger.isDebugEnabled())
logger.debug("Using dispatch context for wizard lookup: " + dispatchContext.getType().toString());
// use the node to perform the lookup (this will include the global section)
config = configSvc.getConfig(dispatchContext);
} else {
if (logger.isDebugEnabled())
logger.debug("Looking up wizard in global config");
// just use the global
config = configSvc.getGlobalConfig();
}
if (config != null) {
WizardsConfigElement wizardsCfg = (WizardsConfigElement) config.getConfigElement(WizardsConfigElement.CONFIG_ELEMENT_ID);
if (wizardsCfg != null) {
wizardConfig = wizardsCfg.getWizard(name);
}
}
return wizardConfig;
}
use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class AlfrescoNavigationHandler method getDialogConfig.
/**
* Returns the dialog configuration object for the given dialog name.
* If there is a node in the dispatch context a lookup is performed using
* the node otherwise the global config section is used.
*
* @param name The name of dialog being launched
* @param dispatchContext The node being acted upon
* @return The DialogConfig for the dialog or null if no config could be found
*/
protected DialogConfig getDialogConfig(FacesContext context, String name, Node dispatchContext) {
DialogConfig dialogConfig = null;
ConfigService configSvc = Application.getConfigService(context);
Config config = null;
if (dispatchContext != null) {
if (logger.isDebugEnabled())
logger.debug("Using dispatch context for dialog lookup: " + dispatchContext.getType().toString());
// use the node to perform the lookup (this will include the global section)
config = configSvc.getConfig(dispatchContext);
} else {
if (logger.isDebugEnabled())
logger.debug("Looking up dialog in global config");
// just use the global
config = configSvc.getGlobalConfig();
}
if (config != null) {
DialogsConfigElement dialogsCfg = (DialogsConfigElement) config.getConfigElement(DialogsConfigElement.CONFIG_ELEMENT_ID);
if (dialogsCfg != null) {
dialogConfig = dialogsCfg.getDialog(name);
}
}
return dialogConfig;
}
use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class Application method getLoginPage.
/**
* Retrieves the configured login page for the application
*
* @param context The Spring contexr
* @return The configured login page or null if the configuration is missing
*/
public static String getLoginPage(ApplicationContext context) {
String loginPage = null;
ConfigService svc = (ConfigService) context.getBean(BEAN_CONFIG_SERVICE);
ClientConfigElement clientConfig = (ClientConfigElement) svc.getGlobalConfig().getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
if (clientConfig != null) {
loginPage = clientConfig.getLoginPage();
}
return loginPage;
}
use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class Application method getLanguage.
/**
* Return the configured language Locale for the application context
*
* @param ctx
* the application context
* @return Current language Locale set or the VM default if none set - never null
*/
public static Locale getLanguage(ApplicationContext ctx) {
// get from web-client config - the first item in the configured list of languages
Config config = ((ConfigService) ctx.getBean(Application.BEAN_CONFIG_SERVICE)).getConfig("Languages");
LanguagesConfigElement langConfig = (LanguagesConfigElement) config.getConfigElement(LanguagesConfigElement.CONFIG_ELEMENT_ID);
List<String> languages = langConfig.getLanguages();
if (languages != null && languages.size() != 0) {
return I18NUtil.parseLocale(languages.get(0));
} else {
// failing that, use the server default locale
return Locale.getDefault();
}
}
Aggregations