Package org.exoplatform.portal.mop.page

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 = PageUtils.toPageState(dst);

            pageService.savePage(new PageContext(src.getPageKey(), dstState));
            service.save(dst);
        }
    }
View Full Code Here


    private boolean canRead(NodeState state) {
        PageKey pageRef = state.getPageRef();
        if (pageRef != null) {
            try {
                PageContext page = userPortal.service.getPageService().loadPage(pageRef);
                if (page != null) {
                    return userPortal.service.getUserACL().hasPermission(page);
                }
            } catch (Exception ignore) {
            }
View Full Code Here

    private boolean canWrite(NodeState state) {
        PageKey pageRef = state.getPageRef();
        if (pageRef != null) {
            try {
                PageContext page = userPortal.service.getPageService().loadPage(pageRef);
                if (page != null) {
                    return userPortal.service.getUserACL().hasEditPermission(page);
                }
            } catch (Exception ignore) {
            }
View Full Code Here

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

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

                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

            UIApplication uiApp = context.getUIApplication();
            UserPortalConfigService service = uiApp.getApplicationComponent(UserPortalConfigService.class);
            String pageId = node.getPageRef();
            // Page page = (pageId != null) ? service.getPage(pageId) : null;
            PageContext page = (pageId != null) ? service.getPageService().loadPage(PageKey.parse(pageId)) : null;
            if (page != null) {
                UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
                if (!userACL.hasPermission(page)) {
                    uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[] { pageId }, 1));
                    return;
View Full Code Here

        private String clonePageFromNode(TreeNode node, String pageName, SiteKey siteKey) {
            String pageId = node.getPageRef();
            if (pageId != null) {
                PageKey sourceKey = PageKey.parse(pageId);
                PageContext page = pageService.loadPage(sourceKey);
                if (page != null) {
                    page = pageService.clone(sourceKey, siteKey.page(pageName));
                    return page.getKey().format();
                }
            }
            return null;
        }
View Full Code Here

            UIPageSelector pageSelector = uiPageNodeForm.getChild(UIPageSelector.class);
            if (pageSelector.getPage() == null) {
                pageSelector.setValue(null);
            } else {
                PageContext pageContext = pageSelector.getPage();
                DataStorage storage = uiPageNodeForm.getApplicationComponent(DataStorage.class);
                PageService pageService = uiPageNodeForm.getApplicationComponent(PageService.class);
                if (pageService.loadPage(pageContext.getKey()) == null) {
                    pageService.savePage(pageContext);

                    //
                    Page page = new Page();
                    page.setOwnerType(pageContext.getKey().getSite().getTypeName());
                    page.setOwnerId(pageContext.getKey().getSite().getName());
                    page.setName(pageContext.getKey().getName());
                    String title = pageContext.getState().getDisplayName();
                    String[] accessPermission = pageContext.getState().getAccessPermissions() == null ? null : pageContext
                            .getState().getAccessPermissions()
                            .toArray(new String[pageContext.getState().getAccessPermissions().size()]);
                    if (title == null || title.trim().length() < 1) {
                        title = page.getName();
                    }
                    page.setTitle(title);
                    page.setShowMaxWindow(false);
                    page.setAccessPermissions(accessPermission);
                    page.setEditPermission(pageContext.getState().getEditPermission());
                    page.setModifiable(true);
                    if (page.getChildren() == null) {
                        page.setChildren(new ArrayList<ModelObject>());
                    }
View Full Code Here

                    accessPermission != null ? Arrays.asList(accessPermission) : null, editPermission);

            // check page is exist
            PageKey pageKey = PageKey.parse(uiForm.getOwnerType().getName() + "::" + ownerId + "::" + uiPageName.getValue());
            PageService pageService = uiForm.getApplicationComponent(PageService.class);
            PageContext existPage = pageService.loadPage(pageKey);
            if (existPage != null) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));
                return;
            }
            pageSelector.setPage(new PageContext(pageKey, pageState));
            event.getRequestContext().addUIComponentToUpdateByAjax(pageSelector);
        }
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.