use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class PageAction method addPublishedContents.
protected void addPublishedContents(Widget[] widgets, Collection<Content> contents) {
try {
if (widgets != null) {
for (Widget widget : widgets) {
ApsProperties config = (null != widget) ? widget.getConfig() : null;
if (null == config || config.isEmpty()) {
continue;
}
String extracted = config.getProperty("contentId");
this.addContent(contents, extracted);
String contentsParam = config.getProperty("contents");
List<Properties> properties = (null != contentsParam) ? RowContentListHelper.fromParameterToContents(contentsParam) : 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");
this.addContent(contents, extracted2);
}
}
}
} catch (Throwable t) {
String msg = "Error extracting published contents on page";
_logger.error("Error extracting published contents on page", t);
throw new RuntimeException(msg, t);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentListViewerWidgetAction method validateFilters.
protected void validateFilters() {
WidgetType type = this.getWidget().getType();
ApsProperties config = this.getWidget().getConfig();
if (null != config && null != type && type.hasParameter("categories") && type.hasParameter("maxElemForItem") && type.hasParameter("maxElements") && StringUtils.isNotEmpty(config.getProperty("contentType")) && StringUtils.isEmpty(config.getProperty("categories")) && StringUtils.isEmpty(config.getProperty("maxElemForItem")) && StringUtils.isEmpty(config.getProperty("maxElements"))) {
this.addFieldError("categories", this.getText("error.widget.listViewer.parameters.invalid"));
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentListViewerWidgetAction method createValuedShowlet.
@Override
protected void createValuedShowlet() throws Exception {
try {
super.createValuedShowlet();
ApsProperties config = this.getWidget().getConfig();
this.extractFiltersProperties(config);
this.extractUserFiltersProperties(config);
this.extractCategories(config);
} catch (Throwable t) {
_logger.error("Error creating user filter", t);
throw new ApsSystemException("Error creating user filter", t);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentListViewerWidgetAction method init.
@Override
public String init() {
try {
super.init();
ApsProperties config = this.getWidget().getConfig();
if (null == config) {
return SUCCESS;
}
this.extractFiltersProperties(config);
this.extractUserFiltersProperties(config);
this.extractCategories(config);
} catch (Throwable t) {
_logger.error("error in init", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class PageConfigurationControllerWidgetsIntegrationTest method createPage.
protected Page createPage(String pageCode) {
IPage parentPage = pageManager.getDraftPage("service");
PageModel pageModel = parentPage.getMetadata().getModel();
PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel.getCode(), true, pageCode + "_title", null, null, false, null, null);
ApsProperties config = PageTestUtil.createProperties("temp", "tempValue", "contentId", "ART11");
Widget widgetToAdd = PageTestUtil.createWidget("content_viewer", config, this.widgetTypeManager);
Widget[] widgets = { widgetToAdd };
Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage, "free", metadata, widgets);
return pageToAdd;
}
Aggregations