use of com.agiletec.aps.system.services.lang.ILangManager in project entando-core by entando.
the class TestWidgetTypeDAO method testLoadWidgetTypes.
public void testLoadWidgetTypes() throws Throwable {
DataSource dataSource = (DataSource) this.getApplicationContext().getBean("portDataSource");
WidgetTypeDAO widgetTypeDao = new WidgetTypeDAO();
widgetTypeDao.setDataSource(dataSource);
ILangManager langManager = (ILangManager) this.getService(SystemConstants.LANGUAGE_MANAGER);
widgetTypeDao.setLangManager(langManager);
Map<String, WidgetType> types = null;
try {
types = widgetTypeDao.loadWidgetTypes();
} catch (Throwable t) {
throw t;
}
WidgetType showletType = (WidgetType) types.get("content_viewer");
assertNotNull(showletType);
showletType = (WidgetType) types.get("content_viewer_list");
assertNotNull(showletType);
}
use of com.agiletec.aps.system.services.lang.ILangManager in project entando-core by entando.
the class TestContentDAO method init.
private void init() throws Exception {
this._contentDao = new ContentDAO();
try {
this._contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
Content mockContent = this.getMockContent();
DataSource dataSource = (DataSource) this.getApplicationContext().getBean("portDataSource");
this._contentDao.setDataSource(dataSource);
ILangManager langManager = (ILangManager) this.getService(SystemConstants.LANGUAGE_MANAGER);
this._contentDao.setLangManager(langManager);
this._contentDao.addEntity(mockContent);
} catch (Throwable e) {
throw new Exception(e);
}
}
use of com.agiletec.aps.system.services.lang.ILangManager in project entando-core by entando.
the class ContentListTag method addMultilanguageWidgetParameter.
protected void addMultilanguageWidgetParameter(ApsProperties config, String widgetParamPrefix, Lang currentLang, String var) {
if (null == var || null == config)
return;
String paramValue = config.getProperty(widgetParamPrefix + "_" + currentLang.getCode());
if (null == paramValue) {
ILangManager langManager = (ILangManager) ApsWebApplicationUtils.getBean(SystemConstants.LANGUAGE_MANAGER, this.pageContext);
Lang defaultLang = langManager.getDefaultLang();
paramValue = config.getProperty(widgetParamPrefix + "_" + defaultLang.getCode());
}
if (null != paramValue) {
this.pageContext.setAttribute(var, paramValue);
}
}
use of com.agiletec.aps.system.services.lang.ILangManager in project entando-core by entando.
the class CurrentPageTag method extractPageTitleFromExtraTitles.
private void extractPageTitleFromExtraTitles(IPage page, Lang currentLang, Map extraTitlesMap) {
Object value = null;
if ((this.getLangCode() == null) || (this.getLangCode().equals("")) || (currentLang.getCode().equalsIgnoreCase(this.getLangCode()))) {
value = extraTitlesMap.get(currentLang.getCode());
} else {
value = extraTitlesMap.get(this.getLangCode());
}
if (value == null || value.toString().trim().equals("")) {
ILangManager langManager = (ILangManager) ApsWebApplicationUtils.getBean(SystemConstants.LANGUAGE_MANAGER, this.pageContext);
value = extraTitlesMap.get(langManager.getDefaultLang().getCode());
}
if (null != value && value.toString().trim().length() > 0) {
this.setValue(value.toString());
}
}
use of com.agiletec.aps.system.services.lang.ILangManager in project entando-core by entando.
the class I18nTag method doEndTag.
@Override
public int doEndTag() throws JspException {
RequestContext reqCtx = (RequestContext) this.pageContext.getRequest().getAttribute(RequestContext.REQCTX);
try {
Lang currentLang = null;
if (reqCtx != null) {
currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
} else {
ILangManager langManager = (ILangManager) ApsWebApplicationUtils.getBean(SystemConstants.LANGUAGE_MANAGER, this.pageContext);
currentLang = langManager.getDefaultLang();
}
String label = this.extractLabel(currentLang);
if (this._varName != null) {
this.pageContext.setAttribute(this._varName, label);
} else {
if (this.getEscapeXml()) {
out(this.pageContext, this.getEscapeXml(), label);
} else {
this.pageContext.getOut().print(label);
}
}
} catch (Throwable t) {
_logger.error("Error during tag initialization", t);
throw new JspException("Error during tag initialization", t);
}
return super.doStartTag();
}
Aggregations