use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentListHelper method extractContentsId.
protected List<String> extractContentsId(IContentListTagBean bean, RequestContext reqCtx) throws ApsSystemException {
List<String> contentsId = null;
try {
List<UserFilterOptionBean> userFilters = bean.getUserFilterOptions();
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties config = (null != widget) ? widget.getConfig() : null;
if (null == bean.getContentType() && null != config) {
bean.setContentType(config.getProperty(WIDGET_PARAM_CONTENT_TYPE));
}
if (null == bean.getContentType()) {
throw new ApsSystemException("Tipo contenuto non definito");
}
if (null == bean.getCategory() && null != config && null != config.getProperty(SHOWLET_PARAM_CATEGORY)) {
bean.setCategory(config.getProperty(SHOWLET_PARAM_CATEGORY));
}
this.addWidgetFilters(bean, config, WIDGET_PARAM_FILTERS, reqCtx);
if (null != userFilters && userFilters.size() > 0) {
for (UserFilterOptionBean userFilter : userFilters) {
EntitySearchFilter filter = userFilter.getEntityFilter();
if (null != filter) {
bean.addFilter(filter);
}
}
}
String[] categories = this.getCategories(bean.getCategories(), config, userFilters);
Collection<String> userGroupCodes = this.getAllowedGroups(reqCtx);
boolean orCategoryFilterClause = this.extractOrCategoryFilterClause(config);
contentsId = this.getContentManager().loadPublicContentsId(bean.getContentType(), categories, orCategoryFilterClause, bean.getFilters(), userGroupCodes);
} catch (Throwable t) {
_logger.error("Error extracting contents id", t);
throw new ApsSystemException("Error extracting contents id", t);
}
return contentsId;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentMapperCacheWrapper method searchPublishedDataObjects.
private void searchPublishedDataObjects(ContentPageMapper contentPageMapper, IPage page, IPageManager pageManager) {
PageModel pageModel = page.getModel();
if (pageModel != null) {
int mainFrame = pageModel.getMainFrame();
Widget[] widgets = page.getWidgets();
Widget widget = null;
if (null != widgets && mainFrame != -1) {
widget = widgets[mainFrame];
}
ApsProperties config = (null != widget) ? widget.getConfig() : null;
String contentId = (null != config) ? config.getProperty("contentId") : null;
if (null != contentId) {
contentPageMapper.add(contentId, page.getCode());
}
String[] childCodes = page.getChildrenCodes();
for (String childCode : childCodes) {
IPage child = pageManager.getOnlinePage(childCode);
if (null != child) {
this.searchPublishedDataObjects(contentPageMapper, child, pageManager);
}
}
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestContentListViewerWidgetAction method testInitConfigListViewer_2.
public void testInitConfigListViewer_2() throws Throwable {
String result = this.executeConfigListViewer("admin", "homepage", "0", null);
assertEquals(Action.SUCCESS, result);
ContentListViewerWidgetAction action = (ContentListViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
assertEquals("content_viewer_list", widget.getType().getCode());
ApsProperties props = widget.getConfig();
assertEquals(4, props.size());
assertEquals("NEW", props.getProperty("contentType"));
assertEquals("5", props.getProperty("maxElemForItem"));
assertEquals("11", props.getProperty("modelId"));
assertEquals("(order=DESC;attributeFilter=true;likeOption=false;key=Date)+(order=ASC;attributeFilter=true;likeOption=false;key=Title)", props.getProperty("filters"));
List<Properties> filtersProperties = action.getFiltersProperties();
assertEquals(2, filtersProperties.size());
Properties firstFilter = filtersProperties.get(0);
assertEquals("DESC", firstFilter.getProperty(EntitySearchFilter.ORDER_PARAM));
assertEquals("true", firstFilter.getProperty(EntitySearchFilter.FILTER_TYPE_PARAM));
assertEquals("false", firstFilter.getProperty(EntitySearchFilter.LIKE_OPTION_PARAM));
assertEquals("Date", firstFilter.getProperty(EntitySearchFilter.KEY_PARAM));
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestContentListViewerWidgetAction method testFailureConfigContentType_2.
public void testFailureConfigContentType_2() throws Throwable {
// Tipo contenuto inesistente
String result = this.executeConfigContentType("admin", "homepage", "1", "content_viewer_list", "WRO");
assertEquals(Action.INPUT, result);
ContentListViewerWidgetAction action = (ContentListViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(0, props.size());
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestContentViewerWidgetAction method testInitConfigViewer_2.
public void testInitConfigViewer_2() throws Throwable {
String result = this.executeConfigViewer("admin", "homepage", "2", null);
assertEquals(Action.SUCCESS, result);
ContentViewerWidgetAction action = (ContentViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(2, props.size());
assertEquals("ART1", props.getProperty("contentId"));
assertEquals("2", props.getProperty("modelId"));
}
Aggregations