Examples of PageContext


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

    public PageContext getPage(PageKey pageRef) {
        if (pageRef == null) {
            return null;
        }

        PageContext page = pageService.loadPage(pageRef);
        if (page == null || !userACL_.hasPermission(page)) {
            return null;
        }
        return page;
    }
View Full Code Here

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

public class PageUtils {
    private PageUtils() {
    }

    public static Page getPage(DataStorage dataStorage, PageService pageService, PageKey pageKey) throws Exception {
        PageContext pageContext = pageService.loadPage(pageKey);
        if (pageContext == null)
            return null;

        // PageService does not support the entire page at the moment, so we must grab the page from legacy service
        // and update it with data page service does support.
        Page page = dataStorage.getPage(pageKey.format());
        pageContext.update(page);

        return page;
    }
View Full Code Here

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

            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
            }
View Full Code Here

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

            WebuiRequestContext context = event.getRequestContext();
            String id = context.getRequestParameter(OBJECTID);

            UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);
            UIApplication uiApp = context.getUIApplication();
            PageContext page = (id != null) ? service.getPageService().loadPage(PageKey.parse(id)) : null;

            if (page == null) {
                uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[] { id }, 1));
                return;
            }

            UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
            if (!userACL.hasEditPermission(page)) {
                uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[] { id }, 1));
                return;
            }

            UIPortal uiPortal = Util.getUIPortal();
            UserNode userNode = uiPortal.getSelectedUserNode();
            boolean isDeleteCurrentPage = page.getKey().equals(userNode.getPageRef());

            service.getPageService().destroyPage(page.getKey());
            // Minh Hoang TO: The cached UIPage objects corresponding to removed Page should be removed here.
            // As we have multiple UIPortal, which means multiple caches of UIPage. It 's unwise to garbage
            // all UIPage caches at once. Better solution is to clear UIPage on browsing to PageNode having Page
            // removed
View Full Code Here

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

            UIPortalApplication uiPortalApp = (UIPortalApplication) pcontext.getUIApplication();
            String id = context.getRequestParameter(OBJECTID);
            UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);

            // Check existence of the page
            PageContext pageContext = (id != null) ? service.getPage(PageKey.parse(id)) : null;
            if (pageContext == null) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[] { id }, 1));
                return;
            }

            // Check current user 's permissions on the page
            UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
            if (!userACL.hasEditPermission(pageContext)) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.edit.NotEditPage", new String[] { id }, 1));
                return;
            }

            // Need this code to override editpage action in extension project
            UIPageFactory clazz = UIPageFactory.getInstance(pageContext.getState().getFactoryId());
            UIPage uipage = clazz.createUIPage(null);
            Page page = service.getDataStorage().getPage(id);
            pageContext.update(page);
            uipage.switchToEditMode(page);
        }
View Full Code Here

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

            uiPageForm.invokeSetBindingBean(page);
            DataStorage dataService = uiPageForm.getApplicationComponent(DataStorage.class);
            // create new page
            if (uiPage == null) {
                PageService pageService = uiPageForm.getApplicationComponent(PageService.class);
                PageContext existPage = pageService.loadPage(page.getPageKey());
                if (existPage != null) {
                    uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));
                    return;
                }
                page.setModifiable(true);
                if (page.getChildren() == null) {
                    page.setChildren(new ArrayList<ModelObject>());
                }

                //
                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));

                //
                dataService.save(page);
                postSave(uiPortalApp, pcontext);
                return;
View Full Code Here

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

     * @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

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

        //
        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

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

    public void switchToEditMode() throws Exception {
        PageService pageService = this.getApplicationComponent(PageService.class);
        DataStorage dataStorage = this.getApplicationComponent(DataStorage.class);

        PageKey pageKey = new PageKey(getSiteKey(), getName());
        PageContext pageContext = pageService.loadPage(pageKey);
        if (pageContext == null) {
            UIPortalApplication uiApp = Util.getUIPortalApplication();
            ApplicationMessage msg = new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[] { pageKey.format() }, 1);
            uiApp.addMessage(msg);
        } else {
            Page page = dataStorage.getPage(pageKey.format());
            pageContext.update(page);
            switchToEditMode(page);
        }
    }
View Full Code Here

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

        this.service = dataStorage_;
        this.pageService = pageService;
    }

    public void perform() throws Exception {
        PageContext existingPage = pageService.loadPage(src.getPageKey());
        Page dst;

        //
        switch (mode) {
            case CONSERVE:
                dst = null;
                break;
            case INSERT:
                if (existingPage == null) {
                    dst = src;
                } else {
                    dst = null;
                }
                break;
            case MERGE:
            case OVERWRITE:
                dst = src;
                break;
            default:
                throw new AssertionError();
        }

        if (dst != null) {
            PageState dstState = new PageState(dst.getTitle(), dst.getDescription(), dst.isShowMaxWindow(), dst.getFactoryId(),
                    dst.getAccessPermissions() != null ? Arrays.asList(dst.getAccessPermissions()) : null,
                    dst.getEditPermission());

            pageService.savePage(new PageContext(src.getPageKey(), dstState));
            service.save(dst);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.