use of com.agiletec.aps.system.services.page.Widget 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.system.services.page.Widget 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.system.services.page.Widget 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.system.services.page.Widget in project entando-core by entando.
the class TestContentViewerWidgetAction method intSaveViewerConfig.
private void intSaveViewerConfig(String contentId, String pageCode, int frame) throws Throwable {
IPage page = this._pageManager.getDraftPage(pageCode);
Widget widget = page.getWidgets()[frame];
assertNull(widget);
this.setUserOnSession("admin");
this.initAction("/do/jacms/Page/SpecialWidget/Viewer", "saveViewerConfig");
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", pageCode);
params.put("frame", String.valueOf(frame));
params.put("widgetTypeCode", "content_viewer");
params.put("contentId", contentId);
this.addParameters(params);
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentViewerWidgetAction method testSave_1.
public void testSave_1() throws Throwable {
String pageCode = "pagina_2";
int frame = 3;
IPage page = this._pageManager.getDraftPage(pageCode);
IPage onlinePage = this._pageManager.getOnlinePage(pageCode);
Widget widget = page.getWidgets()[frame];
assertNull(widget);
assertNull(onlinePage.getWidgets()[frame]);
try {
this.setUserOnSession("admin");
this.initAction("/do/jacms/Page/SpecialWidget/Viewer", "saveViewerConfig");
this.addParameter("pageCode", pageCode);
this.addParameter("frame", String.valueOf(frame));
this.addParameter("widgetTypeCode", "content_viewer");
this.addParameter("contentId", "ART187");
this.addParameter("modelId", "1");
String result = this.executeAction();
assertEquals("configure", result);
page = this._pageManager.getDraftPage(pageCode);
onlinePage = this._pageManager.getOnlinePage(pageCode);
widget = page.getWidgets()[frame];
assertNotNull(widget);
assertNull(onlinePage.getWidgets()[frame]);
assertEquals("content_viewer", widget.getType().getCode());
assertEquals(2, widget.getConfig().size());
assertEquals("ART187", widget.getConfig().getProperty("contentId"));
assertEquals("1", widget.getConfig().getProperty("modelId"));
} catch (Throwable t) {
throw t;
} finally {
page = this._pageManager.getDraftPage(pageCode);
page.getWidgets()[frame] = null;
this._pageManager.updatePage(page);
}
}
Aggregations