Package org.exoplatform.portal.config.model

Examples of org.exoplatform.portal.config.model.Page


     * @param ownerId the new owner id
     * @return the page
     * @throws Exception any exception
     */
    public Page createPageTemplate(String temp, String ownerType, String ownerId) throws Exception {
        Page page = newPortalConfigListener_.createPageFromTemplate(ownerType, ownerId, temp);
        updateOwnership(page, ownerType, ownerId);
        return page;
    }
View Full Code Here


     */
    private void updateOwnership(ModelObject object, String ownerType, String ownerId) {
        if (object instanceof Container) {
            Container container = (Container) object;
            if (container instanceof Page) {
                Page page = (Page) container;
                page.setOwnerType(ownerType);
                page.setOwnerId(ownerId);
            }
            for (ModelObject child : container.getChildren()) {
                updateOwnership(child, ownerType, ownerId);
            }
        } else if (object instanceof Application) {
View Full Code Here

                        PageKey pageKey = siteKey.page(src.getName());
                        if (pages.getChild(src.getName()) == null) {
                            rollbackDeletes.getPages().add(src);
                        } else {
                            PageContext pageContext = pageService.loadPage(pageKey);
                            Page existing = dataStorage.getPage(pageKey.format());
                            pageContext.update(existing);
                            rollbackSaves.getPages().add(PageUtils.copy(existing));
                        }
                    }
                }
                break;
            case OVERWRITE:

                // No pages exist yet.
                if (size == 0) {
                    dst = data;
                    rollbackDeletes = data;
                } else {
                    List<Page> list = PageUtils.getAllPages(dataStorage, pageService, siteKey).getPages();
                    rollbackSaves = new Page.PageSet();
                    rollbackSaves.setPages(new ArrayList<Page>(list.size()));
                    rollbackDeletes = new Page.PageSet();
                    for (Page page : list) {
                        Page copy = PageUtils.copy(page);
                        pageService.destroyPage(siteKey.page(page.getName()));
                        dataStorage.save();
                        rollbackSaves.getPages().add(copy);
                    }
                    for (Page src : data.getPages()) {
                        Page found = findPage(list, src);
                        if (found == null) {
                            rollbackDeletes.getPages().add(src);
                        }
                    }
View Full Code Here

    Page.PageSet getRollbackDeletes() {
        return rollbackDeletes;
    }

    private static Page findPage(List<Page> pages, Page src) {
        Page found = null;
        for (Page page : pages) {
            if (src.getName().equals(page.getName())) {
                found = page;
            }
        }
View Full Code Here

        this.pageService = pageService;
    }

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

        //
        switch (mode) {
            case CONSERVE:
                dst = null;
View Full Code Here

    private Page unmarshalPage(StaxNavigator<Element> navigator) throws XMLStreamException {
        requiresChild(navigator, Element.NAME);
        String name = getRequiredContent(navigator, true);

        Page page = new Page();
        page.setName(name);

        // TODO: Need valid way to ensure a sequence of xml elements, with a mix of required and optional elements.
        Element current = navigator.sibling();
        while (current != null) {
            switch (current) {
                case TITLE:
                    page.setTitle(getContent(navigator, false));
                    current = navigator.sibling();
                    break;
                case DESCRIPTION:
                    page.setDescription(getContent(navigator, false));
                    current = navigator.sibling();
                    break;
                case ACCESS_PERMISSIONS:
                    page.setAccessPermissions(unmarshalAccessPermissions(navigator, true));
                    current = navigator.sibling();
                    break;
                case EDIT_PERMISSION:
                    page.setEditPermission(unmarshalEditPermission(navigator));
                    current = navigator.sibling();
                    break;
                case SHOW_MAX_WINDOW:
                    page.setShowMaxWindow(parseRequiredContent(navigator, ValueType.BOOLEAN));
                    current = navigator.sibling();
                    break;
                case MOVE_APPLICATIONS_PERMISSIONS:
                    page.setMoveAppsPermissions(unmarshalPermissions(navigator, false));
                    current = navigator.sibling();
                    break;
                case MOVE_CONTAINERS_PERMISSIONS:
                    page.setMoveContainersPermissions(unmarshalPermissions(navigator, false));
                    current = navigator.sibling();
                    break;
                case CONTAINER:
                    if (page.getChildren() == null) {
                        page.setChildren(new ArrayList<ModelObject>());
                    }
                    page.getChildren().add(unmarshalContainer(navigator.fork()));
                    current = navigator.sibling();
                    break;
                case PORTLET_APPLICATION:
                    if (page.getChildren() == null) {
                        page.setChildren(new ArrayList<ModelObject>());
                    }
                    page.getChildren().add(unmarshalPortletApplication(navigator.fork()));
                    current = navigator.sibling();
                    break;
                case GADGET_APPLICATION:
                    if (page.getChildren() == null) {
                        page.setChildren(new ArrayList<ModelObject>());
                    }
                    page.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
                    current = navigator.sibling();
                    break;
                case UNKNOWN:
                    throw unknownElement(navigator);
                default:
View Full Code Here

                throw new OperationException(operationName, "Could not retrieve pages for site " + siteKey);
            }
        } else {
            PageKey key = new PageKey(siteKey, pageName);
            try {
                Page page = PageUtils.getPage(dataStorage, pageService, key);
                if (page == null) {
                    throw new ResourceNotFoundException("No page found for " + key);
                } else {
                    resultHandler.completed(page);
                }
View Full Code Here

        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

            throw new IllegalArgumentException("Unknown page service implementation " + pageService.getClass());
        }

        ArrayList<Page> pageList = new ArrayList<Page>(pageContextList.size());
        for (PageContext pageContext : pageContextList) {
            Page page = dataStorage.getPage(pageContext.getKey().format());
            pageContext.update(page);
            pageList.add(page);
        }

        pages.setPages(pageList);
View Full Code Here

        return dashboard;
    }

    public static Page copy(Page existing) {
        Page page = new Page();

        // Copy page specific data
        page.setEditPermission(existing.getEditPermission());
        page.setModifiable(existing.isModifiable());
        page.setOwnerId(existing.getOwnerId());
        page.setOwnerType(existing.getOwnerType());
        page.setPageId(existing.getPageId());
        page.setShowMaxWindow(existing.isShowMaxWindow());

        // Copy container specific data.
        copyFields(existing, page);

        return page;
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.config.model.Page

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.