use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class CmsHypertextAttribute method getReferences.
@Override
public List<CmsAttributeReference> getReferences(List<Lang> systemLangs) {
List<CmsAttributeReference> refs = new ArrayList<>();
for (Lang lang : systemLangs) {
String text = this.getTextMap().get(lang.getCode());
List<SymbolicLink> links = HypertextAttributeUtil.getSymbolicLinksOnText(text);
if (null != links && !links.isEmpty()) {
for (SymbolicLink symbLink : links) {
if (symbLink.getDestType() != SymbolicLink.URL_TYPE) {
CmsAttributeReference ref = new CmsAttributeReference(symbLink.getPageDest(), symbLink.getContentDest(), symbLink.getResourceDest());
refs.add(ref);
}
}
}
}
return refs;
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class ContentListHelper method getConfiguredUserFilters.
@Override
public List<UserFilterOptionBean> getConfiguredUserFilters(IContentListTagBean bean, RequestContext reqCtx) throws ApsSystemException {
List<UserFilterOptionBean> userEntityFilters = null;
try {
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties config = (null != widget) ? widget.getConfig() : null;
if (null == config || null == config.getProperty(WIDGET_PARAM_CONTENT_TYPE)) {
return null;
}
String contentTypeCode = config.getProperty(WIDGET_PARAM_CONTENT_TYPE);
IApsEntity prototype = this.getContentManager().getEntityPrototype(contentTypeCode);
if (null == prototype) {
_logger.error("Null content type by code '{}'", contentTypeCode);
return null;
}
Integer currentFrame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String userFilters = config.getProperty(WIDGET_PARAM_USER_FILTERS);
if (null != userFilters && userFilters.length() > 0) {
userEntityFilters = FilterUtils.getUserFilters(userFilters, currentFrame, currentLang, prototype, this.getUserFilterDateFormat(), reqCtx.getRequest());
}
} catch (Throwable t) {
_logger.error("Error extracting user filters", t);
throw new ApsSystemException("Error extracting user filters", t);
}
return userEntityFilters;
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class ContentListHelper method buildCacheKey.
protected static String buildCacheKey(String listName, Collection<String> userGroupCodes, RequestContext reqCtx) {
IPage page = (null != reqCtx) ? (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE) : null;
StringBuilder cacheKey = (null != page) ? new StringBuilder(page.getCode()) : new StringBuilder("NOTFOUND");
Widget currentWidget = (null != reqCtx) ? (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET) : null;
if (null != currentWidget && null != currentWidget.getType()) {
cacheKey.append("_").append(currentWidget.getType().getCode());
}
if (null != reqCtx) {
Integer frame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
if (null != frame) {
cacheKey.append("_").append(frame.intValue());
}
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
if (null != currentLang) {
cacheKey.append("_LANG").append(currentLang.getCode()).append("_");
}
}
List<String> groupCodes = new ArrayList<String>(userGroupCodes);
if (!groupCodes.contains(Group.FREE_GROUP_NAME)) {
groupCodes.add(Group.FREE_GROUP_NAME);
}
Collections.sort(groupCodes);
for (String code : groupCodes) {
cacheKey.append("_").append(code);
}
if (null != currentWidget && null != currentWidget.getConfig()) {
List<String> paramKeys = new ArrayList(currentWidget.getConfig().keySet());
Collections.sort(paramKeys);
for (int i = 0; i < paramKeys.size(); i++) {
if (i == 0) {
cacheKey.append("_WIDGETPARAM");
} else {
cacheKey.append(",");
}
String paramkey = (String) paramKeys.get(i);
cacheKey.append(paramkey).append("=").append(currentWidget.getConfig().getProperty(paramkey));
}
}
if (null != listName) {
cacheKey.append("_LISTNAME").append(listName);
}
return cacheKey.toString();
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class ContentViewerHelper method getRenderizationInfo.
@Override
public ContentRenderizationInfo getRenderizationInfo(String contentId, String modelId, boolean publishExtraTitle, RequestContext reqCtx) throws ApsSystemException {
ContentRenderizationInfo renderizationInfo = null;
try {
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String langCode = currentLang.getCode();
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties widgetConfig = widget.getConfig();
contentId = this.extractContentId(contentId, widgetConfig, reqCtx);
modelId = this.extractModelId(contentId, modelId, widgetConfig, reqCtx);
if (contentId != null && modelId != null) {
long longModelId = new Long(modelId).longValue();
this.setStylesheet(longModelId, reqCtx);
renderizationInfo = this.getContentDispenser().getRenderizationInfo(contentId, longModelId, langCode, reqCtx, true);
if (null == renderizationInfo) {
_logger.info("Null Renderization informations: content={}", contentId);
return null;
}
this.getContentDispenser().resolveLinks(renderizationInfo, reqCtx);
this.manageAttributeValues(renderizationInfo, publishExtraTitle, reqCtx);
} else {
_logger.warn("Parametri visualizzazione contenuto incompleti: " + "contenuto={} modello={}", contentId, modelId);
}
} catch (Throwable t) {
_logger.error("Error extracting renderization info", t);
throw new ApsSystemException("Error extracting renderization info", t);
}
return renderizationInfo;
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class FilterUtils method getUserFilter.
public UserFilterOptionBean getUserFilter(String contentType, IEntityFilterBean bean, IContentManager contentManager, String dateFormat, RequestContext reqCtx) {
UserFilterOptionBean filter = null;
try {
IApsEntity prototype = contentManager.createContentType(contentType);
Properties props = new Properties();
props.setProperty(UserFilterOptionBean.PARAM_KEY, bean.getKey());
props.setProperty(UserFilterOptionBean.PARAM_IS_ATTRIBUTE_FILTER, String.valueOf(bean.isAttributeFilter()));
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
Integer currentFrame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
filter = new UserFilterOptionBean(props, prototype, currentFrame, currentLang, dateFormat, reqCtx.getRequest());
} catch (Throwable t) {
_logger.error("Error creating user filter", t);
// ApsSystemUtils.logThrowable(t, FilterUtils.class, "getUserFilter", "Error creating user filter");
}
return filter;
}
Aggregations