Search in sources :

Example 6 with IPageManager

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));
            }
        }
    }
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage) GuiFragment(org.entando.entando.aps.system.services.guifragment.GuiFragment) Widget(com.agiletec.aps.system.services.page.Widget)

Example 7 with IPageManager

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);
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) ICacheInfoManager(org.entando.entando.aps.system.services.cache.ICacheInfoManager) IWidgetTypeManager(org.entando.entando.aps.system.services.widgettype.IWidgetTypeManager) IPageModelManager(com.agiletec.aps.system.services.pagemodel.IPageModelManager) ILangManager(com.agiletec.aps.system.services.lang.ILangManager) IUserManager(com.agiletec.aps.system.services.user.IUserManager) IRoleManager(com.agiletec.aps.system.services.role.IRoleManager) IURLManager(com.agiletec.aps.system.services.url.IURLManager) ConfigInterface(com.agiletec.aps.system.services.baseconfig.ConfigInterface) IKeyGeneratorManager(com.agiletec.aps.system.services.keygenerator.IKeyGeneratorManager) II18nManager(com.agiletec.aps.system.services.i18n.II18nManager) ICategoryManager(com.agiletec.aps.system.services.category.ICategoryManager)

Example 8 with IPageManager

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;
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage)

Example 9 with IPageManager

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;
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage)

Example 10 with IPageManager

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;
    }
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage)

Aggregations

IPageManager (com.agiletec.aps.system.services.page.IPageManager)11 IPage (com.agiletec.aps.system.services.page.IPage)8 Lang (com.agiletec.aps.system.services.lang.Lang)3 RequestContext (com.agiletec.aps.system.RequestContext)1 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)1 ConfigInterface (com.agiletec.aps.system.services.baseconfig.ConfigInterface)1 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)1 II18nManager (com.agiletec.aps.system.services.i18n.II18nManager)1 IKeyGeneratorManager (com.agiletec.aps.system.services.keygenerator.IKeyGeneratorManager)1 ILangManager (com.agiletec.aps.system.services.lang.ILangManager)1 Widget (com.agiletec.aps.system.services.page.Widget)1 IPageModelManager (com.agiletec.aps.system.services.pagemodel.IPageModelManager)1 IRoleManager (com.agiletec.aps.system.services.role.IRoleManager)1 IURLManager (com.agiletec.aps.system.services.url.IURLManager)1 IUserManager (com.agiletec.aps.system.services.user.IUserManager)1 CmsAttributeReference (com.agiletec.plugins.jacms.aps.system.services.content.model.CmsAttributeReference)1 SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)1 IReferenceableAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.IReferenceableAttribute)1 SymbolicLinkValidator (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.util.SymbolicLinkValidator)1 HashMap (java.util.HashMap)1