use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class ProtectedResourceProvider method executeLoginRedirect.
protected void executeLoginRedirect(HttpServletRequest request, HttpServletResponse response) throws ServletException {
try {
StringBuilder targetUrl = new StringBuilder(request.getRequestURL());
Map<String, String> params = new HashMap<String, String>();
params.put("returnUrl", targetUrl.toString());
String loginPageCode = this.getConfigManager().getParam(SystemConstants.CONFIG_PARAM_LOGIN_PAGE_CODE);
IPage page = this.getPageManager().getOnlinePage(loginPageCode);
Lang defaultLang = this.getLangManager().getDefaultLang();
String url = this.getUrlManager().createURL(page, defaultLang, params);
response.sendRedirect(url);
} catch (Throwable t) {
_logger.error("Error executing redirect login page", t);
throw new ServletException("Error executing redirect login page", t);
}
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class BaseContentGroupBulkCommand method checkContentReferences.
protected boolean checkContentReferences(Content content) {
List<Lang> systemLangs = this.getSystemLangs();
IPageManager pageManager = this.getPageManager();
SymbolicLinkValidator validator = new SymbolicLinkValidator(this.getApplier(), pageManager);
for (AttributeInterface attribute : content.getAttributeList()) {
if (attribute instanceof IReferenceableAttribute) {
List<CmsAttributeReference> references = ((IReferenceableAttribute) attribute).getReferences(systemLangs);
if (references != null) {
for (CmsAttributeReference reference : references) {
SymbolicLink symbolicLink = this.convertToSymbolicLink(reference);
if (symbolicLink != null) {
String result = validator.scan(symbolicLink, content);
if (ICmsAttributeErrorCodes.INVALID_CONTENT_GROUPS.equals(result) || ICmsAttributeErrorCodes.INVALID_RESOURCE_GROUPS.equals(result) || ICmsAttributeErrorCodes.INVALID_PAGE_GROUPS.equals(result)) {
return false;
}
}
}
}
}
}
return true;
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class WidgetValidatorCmsHelper method validateTitle.
public static void validateTitle(WidgetConfigurationRequest widget, ILangManager langManager, BeanPropertyBindingResult errors) {
String titleParamPrefix = IContentListWidgetHelper.WIDGET_PARAM_TITLE + "_";
if (isMultilanguageParamValued(widget, titleParamPrefix, langManager)) {
Lang defaultLang = langManager.getDefaultLang();
String defaultTitleParam = titleParamPrefix + defaultLang.getCode();
String defaultTitle = extractConfigParam(widget, defaultTitleParam);
if (StringUtils.isBlank(defaultTitle)) {
errors.reject(ERRCODE_INVALID_CONFIGURATION, new String[] { defaultLang.getDescr() }, widget.getCode() + ".defaultLangTitle.required");
}
}
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class WidgetValidatorCmsHelper method isMultilanguageParamValued.
protected static boolean isMultilanguageParamValued(WidgetConfigurationRequest widget, String prefix, ILangManager langManager) {
Map<String, Object> config = widget.getConfig();
if (null == config) {
return false;
}
List<Lang> langs = langManager.getLangs();
for (int i = 0; i < langs.size(); i++) {
Lang lang = langs.get(i);
// (String) config.get(prefix + lang.getCode());
String paramValue = extractConfigParam(widget, prefix + lang.getCode());
if (null != paramValue && paramValue.trim().length() > 0) {
return true;
}
}
return false;
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class WidgetValidatorCmsHelper method validateLink.
public static void validateLink(WidgetConfigurationRequest widget, ILangManager langManager, IPageManager pageManager, BeanPropertyBindingResult errors) {
String pageLink = extractConfigParam(widget, IContentListWidgetHelper.WIDGET_PARAM_PAGE_LINK);
boolean existsPageLink = pageLink != null && pageManager.getDraftPage(pageLink) != null;
String linkDescrParamPrefix = IContentListWidgetHelper.WIDGET_PARAM_PAGE_LINK_DESCR + "_";
if (existsPageLink || isMultilanguageParamValued(widget, linkDescrParamPrefix, langManager)) {
if (!existsPageLink) {
errors.reject(ERRCODE_INVALID_CONFIGURATION, new String[] { pageLink }, widget.getCode() + ".pageLink.required");
}
Lang defaultLang = langManager.getDefaultLang();
String defaultLinkDescrParam = linkDescrParamPrefix + defaultLang.getCode();
String defaultLinkDescr = extractConfigParam(widget, defaultLinkDescrParam);
if (defaultLinkDescr == null || defaultLinkDescr.length() == 0) {
errors.reject(ERRCODE_INVALID_CONFIGURATION, new String[] { defaultLang.getDescr() }, widget.getCode() + ".defaultLangLink.required");
}
}
}
Aggregations