Package org.gatein.api.page

Examples of org.gatein.api.page.PageImpl


        return pages;
    }

    @Override
    public void savePage(Page page) {
        PageImpl pageImpl = (PageImpl) page;
        Parameters.requireNonNull(pageImpl, "page");

        if (getSite(pageImpl.getSiteId()) == null) {
            throw new EntityNotFoundException("Site " + pageImpl.getSiteId() + " doesn't exist");
        }

        if (pageImpl.isCreate() && getPage(pageImpl.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 " + pageImpl.getId() + " already exists.");
        }

        PageContext context = pageImpl.getPageContext();

        try {
            pageService.savePage(context);

            if (!pageImpl.isChildrenSet()) {
                // it seems that the page was created without a container, and it wasn't loaded,
                // so, we are done
                return;
            }

            // Added as required by the Compose Page API work:
            // In addition to the pageService, which stores only metadata about the page, we also send it
            // to the dataStorage for persistence, because this one takes care of persisting the children as well.
            // As such, we need to get the ModelObject representation of the Page, which is the only representation
            // that the dataStorage would accept.
            dataStorage.save(getModelObjectFor(pageImpl));
            dataStorage.save();
        } catch (Throwable t) {
            throw new ApiException("Failed to save page " + pageImpl.getId(), t);
        }
    }
View Full Code Here


    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

        List<String> moveContainersPermissions = ProtectedContainer.DEFAULT_MOVE_CONTAINERS_PERMISSIONS;

        PageState pageState = new PageState(pageId.getPageName(), null, false, null, Arrays.asList(Util.from(Permission
                .everyone())), Util.from(edit)[0], moveAppsPermissions, moveContainersPermissions);

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

            iterator = result.iterator();
        }

        List<Page> pages = new ArrayList<Page>();
        while (iterator.hasNext()) {
            pages.add(new PageImpl(iterator.next()));
        }

        filter(pages, query.getFilter());

        return pages;
View Full Code Here

TOP

Related Classes of org.gatein.api.page.PageImpl

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.