use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.
the class TestWidgetExecutorService method testExecutor.
public void testExecutor() throws Exception {
super.setUserOnSession("admin");
IPageManager pageManager = (IPageManager) super.getApplicationContext().getBean(SystemConstants.PAGE_MANAGER);
IPage currentPage = pageManager.getOnlinePage("homepage");
super.getRequestContext().addExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE, currentPage);
ExecutorServiceInterface wes = (ExecutorServiceInterface) super.getApplicationContext().getBean("WidgetExecutorService");
wes.service(super.getRequestContext());
String[] widgetOutput = (String[]) super.getRequestContext().getExtraParam("ShowletOutput");
assertNotNull(widgetOutput);
assertEquals(currentPage.getModel().getFrames().length, widgetOutput.length);
for (int i = 0; i < widgetOutput.length; i++) {
String output = widgetOutput[i];
assertNotNull(output);
Widget currentWidget = currentPage.getWidgets()[i];
if (null == currentWidget) {
assertTrue(StringUtils.isBlank(output));
} else {
GuiFragment fragment = this._guiFragmentManager.getUniqueGuiFragmentByWidgetType(currentWidget.getType().getCode());
if (null == fragment) {
assertTrue(StringUtils.isBlank(output));
} else {
assertTrue(StringUtils.isNotBlank(output));
}
}
}
}
use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.
the class TestApplicationContext method testGetServices.
public void testGetServices() {
ConfigInterface configManager = (ConfigInterface) this.getService(SystemConstants.BASE_CONFIG_MANAGER);
assertNotNull(configManager);
ICacheInfoManager cacheInfoManager = (ICacheInfoManager) this.getService(SystemConstants.CACHE_INFO_MANAGER);
assertNotNull(cacheInfoManager);
ILangManager langManager = (ILangManager) this.getService(SystemConstants.LANGUAGE_MANAGER);
assertNotNull(langManager);
IWidgetTypeManager showletTypeManager = (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
assertNotNull(showletTypeManager);
IPageModelManager pageModelManager = (IPageModelManager) this.getService(SystemConstants.PAGE_MODEL_MANAGER);
assertNotNull(pageModelManager);
IPageManager pageManager = (IPageManager) this.getService(SystemConstants.PAGE_MANAGER);
assertNotNull(pageManager);
IRoleManager roleManager = (IRoleManager) this.getService(SystemConstants.ROLE_MANAGER);
assertNotNull(roleManager);
IUserManager userManager = (IUserManager) this.getService(SystemConstants.USER_MANAGER);
assertNotNull(userManager);
IURLManager urlManager = (IURLManager) this.getService(SystemConstants.URL_MANAGER);
assertNotNull(urlManager);
II18nManager i18nManager = (II18nManager) this.getService(SystemConstants.I18N_MANAGER);
assertNotNull(i18nManager);
// ControllerManager controller = (ControllerManager) this.getService(SystemConstants.CONTROLLER_MANAGER);
// assertNotNull(controller);
IKeyGeneratorManager keyGeneratorManager = (IKeyGeneratorManager) this.getService(SystemConstants.KEY_GENERATOR_MANAGER);
assertNotNull(keyGeneratorManager);
ICategoryManager categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER);
assertNotNull(categoryManager);
}
use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.
the class PageAction method doSetOffline.
public String doSetOffline() {
String pageCode = this.getPageCode();
try {
if (StringUtils.isEmpty(pageCode)) {
pageCode = this.getSelectedNode();
this.setPageCode(pageCode);
}
IPageManager pageManager = this.getPageManager();
String check = this.checkSetOffline(pageCode);
if (null != check) {
return check;
}
pageManager.setPageOffline(pageCode);
IPage page = this.getPage(pageCode);
this.addActionMessage(this.getText("message.page.set.offline", new String[] { this.getTitle(page.getCode(), page.getTitles()) }));
// TODO Define a new strutsAction to map "offline" operation
this.addActivityStreamInfo(page, PageActionConstants.UNPUBLISH, true);
} catch (Throwable t) {
_logger.error("error setting page {} offline", pageCode, t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.
the class PageAction method delete.
public String delete() {
String selectedNode = this.getNodeToBeDelete();
try {
IPageManager pageManager = this.getPageManager();
String check = this.checkDelete(selectedNode);
if (null != check) {
return check;
}
IPage pageToDelete = this.getPage(selectedNode);
pageManager.deletePage(selectedNode);
this.setSelectedNode(pageToDelete.getParentCode());
this.addActivityStreamInfo(pageToDelete, ApsAdminSystemConstants.DELETE, false);
} catch (Throwable t) {
_logger.error("error in delete", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.
the class SystemInfoWrapper method getPageWithWidget.
public IPage getPageWithWidget(String widgetCode) {
IPage page = null;
try {
IPageManager pageManager = (IPageManager) ApsWebApplicationUtils.getBean(SystemConstants.PAGE_MANAGER, this.getReqCtx().getRequest());
List<IPage> pages = pageManager.getOnlineWidgetUtilizers(widgetCode);
if (null != pages && !pages.isEmpty()) {
page = pages.get(0);
}
return page;
} catch (Throwable t) {
_logger.error("Error getting page with widget: {}", widgetCode, t);
// ApsSystemUtils.logThrowable(t, this, "getPageWithWidget", "Error getting page with widget: " + widgetCode);
return null;
}
}
Aggregations