use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class CmsPageManagerWrapper method findContentUtilizers.
public boolean findContentUtilizers(Widget[] widgets, String contentId) throws ApsSystemException {
boolean found = false;
if (null != widgets) {
for (Widget widget : widgets) {
ApsProperties config = (null != widget) ? widget.getConfig() : null;
if (null == config || config.isEmpty()) {
continue;
}
String extracted = config.getProperty("contentId");
if (null != extracted && contentId.equals(extracted)) {
found = true;
} else {
String contents = config.getProperty("contents");
List<Properties> properties = (null != contents) ? RowContentListHelper.fromParameterToContents(contents) : null;
if (null == properties || properties.isEmpty()) {
continue;
}
for (int j = 0; j < properties.size(); j++) {
Properties widgProp = properties.get(j);
String extracted2 = widgProp.getProperty("contentId");
if (null != extracted2 && contentId.equals(extracted2)) {
found = true;
break;
}
}
}
}
}
return found;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class RowContentListViewerConfigProcessor method buildConfiguration.
@SuppressWarnings("unchecked")
@Override
public Object buildConfiguration(WidgetConfigurationRequest widget) {
ApsProperties properties = new ApsProperties();
List<RowContentListConfigurationEntry> entryList = (List<RowContentListConfigurationEntry>) widget.getProcessInfo().get(WidgetConfigurationValidator.PROCESS_INFO_CONFIG);
if (null != entryList && !entryList.isEmpty()) {
StringBuffer sbuffer = new StringBuffer("[");
List<String> configTokens = entryList.stream().map(i -> i.toCfg()).collect(Collectors.toList());
sbuffer.append(StringUtils.join(configTokens, ","));
sbuffer.append("]");
properties.put("contents", sbuffer.toString());
}
return properties;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class RowContentListViewerConfigProcessor method extractConfiguration.
/**
* try to build the configuration from a complex structure or from a string
*
* @param widget
* @return
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
@Override
public ApsProperties extractConfiguration(ApsProperties widgetProperties) {
List<Properties> props = RowContentListHelper.fromParameterToContents(widgetProperties.getProperty(WIDGET_CONFIG_KEY_CONTENTS));
Map<String, List<Properties>> map = new HashMap<>();
map.put(WIDGET_CONFIG_KEY_CONTENTS, props);
ApsProperties smartProperties = new ApsProperties();
smartProperties.putAll(map);
return smartProperties;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentInfoTag method extractModelId.
private Object extractModelId(PublicContentAuthorizationInfo authInfo, RequestContext reqCtx) {
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties showletConfig = widget.getConfig();
String modelId = (String) showletConfig.get("modelId");
if (null == modelId) {
modelId = reqCtx.getRequest().getParameter("modelId");
}
if (null == modelId) {
IContentManager contentManager = (IContentManager) ApsWebApplicationUtils.getBean(JacmsSystemConstants.CONTENT_MANAGER, this.pageContext);
modelId = contentManager.getDefaultModel(authInfo.getContentId());
}
return modelId;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestContentViewerHelper method init.
private void init() throws Exception {
try {
_requestContext = this.getRequestContext();
Lang lang = new Lang();
lang.setCode("it");
lang.setDescr("italiano");
_requestContext.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG, lang);
Widget widget = new Widget();
IWidgetTypeManager showletTypeMan = (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
WidgetType showletType = showletTypeMan.getWidgetType("content_viewer");
widget.setType(showletType);
widget.setConfig(new ApsProperties());
_requestContext.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET, widget);
this._helper = (IContentViewerHelper) this.getApplicationContext().getBean("jacmsContentViewerHelper");
} catch (Throwable t) {
throw new Exception(t);
}
}
Aggregations