Package org.exoplatform.portal.mop.page

Examples of org.exoplatform.portal.mop.page.PageContext


            UserPortalConfigService userService = uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);

            // get selected page
            String pageId = node.getPageRef();
            PageContext pageContext = (pageId != null) ? userService.getPageService().loadPage(PageKey.parse(pageId)) : null;
            if (pageContext != null) {
                UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
                if (!userACL.hasEditPermission(pageContext)) {
                    uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[] { pageId }, 1));
                    return;
                }

                uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
                // uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
                // uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor",
                // null);

                UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
                UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
                uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);

                UIPortalComposer portalComposer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class)
                        .setRendered(true);
                portalComposer.setShowControl(true);
                portalComposer.setEditted(false);
                portalComposer.setCollapse(false);
                portalComposer.setId("UIPageEditor");
                portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");

                uiToolPanel.setShowMaskLayer(false);
                uiToolPanel.setWorkingComponent(UIPage.class, null);
                UIPage uiPage = (UIPage) uiToolPanel.getUIComponent();

                if (pageContext.getState().getDisplayName() == null)
                    pageContext.getState().builder().displayName(node.getLabel());

                Page page = userService.getDataStorage().getPage(pageId);
                pageContext.update(page);

                // convert Page to UIPage
                PortalDataMapper.toUIPage(uiPage, page);
                Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
                Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
View Full Code Here


            PageKey pageKey = currentNode.getPageRef();
            if (pageKey == null) {
                return false;
            } else {
                PageService pageService = portalApp.getApplicationComponent(PageService.class);
                PageContext page = pageService.loadPage(pageKey);
                if (page == null) {
                    return false;
                } else {
                    return userACL.hasEditPermission(page);
                }
View Full Code Here

                ExoContainer container = getApplication().getApplicationServiceContainer();
                container.getComponentInstanceOfType(UserPortalConfigService.class);
                UserPortalConfigService configService = (UserPortalConfigService) container
                        .getComponentInstanceOfType(UserPortalConfigService.class);
                PageKey pageRef = node.getPageRef();
                PageContext page = configService.getPage(pageRef);

                //
                if (page != null) {
                    title = page.getState().getDisplayName();
                    String resolvedTitle = ExpressionUtil.getExpressionValue(this.getApplicationResourceBundle(), title);
                    if (resolvedTitle != null) {
                        return resolvedTitle;
                    }
                }
View Full Code Here

     * @param page
     * @param uiPortal
     * @return
     */
    private UIPage getUIPage(UserNode pageNode, UIPortal uiPortal, WebuiRequestContext context) throws Exception {
        PageContext pageContext = null;
        String pageReference = null;
        ExoContainer appContainer = context.getApplication().getApplicationServiceContainer();
        UserPortalConfigService userPortalConfigService = (UserPortalConfigService) appContainer
                .getComponentInstanceOfType(UserPortalConfigService.class);

        if (pageNode != null && pageNode.getPageRef() != null) {
            pageReference = pageNode.getPageRef().format();
            pageContext = userPortalConfigService.getPage(pageNode.getPageRef());
        }

        // The page has been deleted
        if (pageContext == null) {
            // Clear the UIPage from cache in UIPortal
            uiPortal.clearUIPage(pageReference);
            return null;
        }

        UIPage uiPage = uiPortal.getUIPage(pageReference);
        if (uiPage != null) {
            return uiPage;
        }

        try {
            UIPageFactory clazz = UIPageFactory.getInstance(pageContext.getState().getFactoryId());
            uiPage = clazz.createUIPage(context);

            Page page = userPortalConfigService.getDataStorage().getPage(pageReference);
            pageContext.update(page);
            PortalDataMapper.toUIPage(uiPage, page);
            uiPortal.setUIPage(pageReference, uiPage);
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug("Could not handle page '" + pageContext.getKey().format() + "'.", e);
            }
            throw e;
        }

        return uiPage;
View Full Code Here

            PageService pageService = uiWorkingWS.getApplicationComponent(PageService.class);
            try {
                PageState pageState = new PageState(page.getTitle(), page.getDescription(), page.isShowMaxWindow(),
                        page.getFactoryId(), page.getAccessPermissions() != null ? Arrays.asList(page.getAccessPermissions())
                                : null, page.getEditPermission());
                pageService.savePage(new PageContext(pageKey, pageState));
                dataService.save(page);
            } catch (StaleModelException ex) {
                // Temporary solution to concurrency-related issue
                // This catch block should be put in an appropriate ApplicationLifecyclec
            }
            uiToolPanel.setUIComponent(null);

            // Synchronize model object with UIPage object, that seems redundant but in fact
            // mandatory to have consequent edit actions (on the same page) work properly
            uiPage.getChildren().clear();
            page = dataService.getPage(page.getPageId());
            PageContext pageContext = configService.getPage(pageKey);
            pageContext.update(page);
            PortalDataMapper.toUIPage(uiPage, page);

            // Invalidate UIPage cache on UIPortal
            uiPortalApp.invalidateUIPage(pageId);
View Full Code Here

        //
        PageService pageService = getApplicationComponent(PageService.class);
        PageState pageState = new PageState(page.getTitle(), page.getDescription(), page.isShowMaxWindow(),
                page.getFactoryId(), page.getAccessPermissions() != null ? Arrays.asList(page.getAccessPermissions()) : null,
                page.getEditPermission());
        pageService.savePage(new PageContext(page.getPageKey(), pageState));

        //
        DataStorage dataService = getApplicationComponent(DataStorage.class);
        dataService.save(page);
View Full Code Here

    @Override
    public Page getPage(PageId pageId) {
        Parameters.requireNonNull(pageId, "pageId");

        try {
            PageContext context = pageService.loadPage(Util.from(pageId));
            return (context == null) ? null : new PageImpl(context);
        } catch (Throwable e) {
            throw new ApiException("Failed to get page", e);
        }
    }
View Full Code Here

        Permission access = Permission.everyone();
        Permission edit = Permission.any("platform", "administrators");
        PageState pageState = new PageState(pageId.getPageName(), null, false, null, Arrays.asList(Util.from(access)),
            Util.from(edit)[0]);

        PageImpl p = new PageImpl(new PageContext(Util.from(pageId), pageState));
        p.setCreate(true);
        return p;
    }
View Full Code Here

        if (((PageImpl) page).isCreate() && getPage(page.getId()) != null) {
            // There is still a small chance someone else creates the page, but this is currently the best we can do
            throw new EntityAlreadyExistsException("Cannot create page. Page " + page.getId() + " already exists.");
        }

        PageContext context = ((PageImpl) page).getPageContext();

        try {
            pageService.savePage(context);
        } catch (Throwable t) {
            throw new ApiException("Failed to save page " + page.getId(), t);
View Full Code Here

                        }

                        //
                        PageService pageService = uiPage.getApplicationComponent(PageService.class);
                        PageState pageState = PageUtils.toPageState(page);
                        pageService.savePage(new PageContext(page.getPageKey(), pageState));

                        //
                        DataStorage dataService = uiPage.getApplicationComponent(DataStorage.class);
                        dataService.save(page);
                    }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.mop.page.PageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.