Package org.gatein.api.page

Examples of org.gatein.api.page.Page


        public boolean accept(Node element) {
            if (element.getPageId() == null) {
                return true;
            }

            Page page = portal.getPage(element.getPageId());
            Permission permission = access ? page.getAccessPermission() : page.getEditPermission();
            return portal.hasPermission(user, permission);
        }
View Full Code Here


                Arrays.asList(Util.from(accessPermission)),
                Util.from(editPermission)[0], // this is the same as the createPage, but is it right?
                Arrays.asList(Util.from(moveAppsPermission)),
                Arrays.asList(Util.from(moveContainersPermission)));
        PageContext pageContext = new PageContext(pageKey, pageState);
        Page page = new PageImpl(pageContext);
        page.setChildren(this.children);

        if (log.isTraceEnabled()) {
            log.trace("Page finished: " + this);
        }
View Full Code Here

            if (element.getPageId() == null) {
                return true;
            }

            Page page = portal.getPage(element.getPageId());
            Permission permission = access ? page.getAccessPermission() : page.getEditPermission();
            return portal.hasPermission(user, permission);
        }
View Full Code Here

        } else if (sorting.getComparator() == null) {
            return new Comparator<Page>() {
                @Override
                public int compare(Page page, Page other) {
                    if (sorting.getOrder() == Sorting.Order.descending) {
                        Page tmp = page;
                        page = other;
                        other = tmp;
                    }

                    return page.compareTo(other);
View Full Code Here

    }

    @Managed("{page-name}")
    public ModelObject getPage(@MappedPath("page-name") String name) {
        PageId pageId = new PageId(siteId, name);
        Page page = portal.getPage(pageId);
        if (page == null) {
            throw notFound("Could not retrieve page", pageId);
        }

        // Populate model
View Full Code Here

    @ManagedOperation(name = OperationNames.ADD_RESOURCE, description = "Adds the given page to the portal")
    public ModelObject addPage(@MappedPath("page-name") String name) {

        // Create the page
        PageId pageId = new PageId(siteId, name);
        Page page;
        try {
            page = portal.createPage(pageId);
        } catch (EntityAlreadyExistsException e) {
            throw alreadyExists("Could not add page", pageId);
        } catch (EntityNotFoundException e) {
View Full Code Here

    @ManagedRole("administrators")
    @ManagedOperation(name = OperationNames.UPDATE_RESOURCE, description = "Updates a page of the portal")
    public ModelObject updatePage(@MappedPath("page-name") String name, @ManagedContext ModelObject pageModel) {
        // Retrieve page from api, ensuring it exists
        PageId pageId = new PageId(siteId, name);
        Page page = portal.getPage(pageId);
        if (page == null) {
            throw notFound("Could not update page", pageId);
        }
        boolean changed = false;

        // Update displayName
        if (pageModel.has("displayName")) {
            ModelString displayNameModel = get(pageModel, ModelString.class, "displayName");
            page.setDisplayName(displayNameModel.getValue());
            changed = true;
        }

        // Update description
        if (pageModel.has("description")) {
            ModelString descModel = get(pageModel, ModelString.class, "description");
            page.setDescription(descModel.getValue());
            changed = true;
        }

        // Update access-permissions
        if (pageModel.has("access-permissions")) {
            Permission permission = getPermission(pageModel, false, "access-permissions");
            page.setAccessPermission(permission);
            changed = true;
        }

        // Update edit-permissions
        if (pageModel.has("edit-permissions")) {
            Permission permission = getPermission(pageModel, true, "edit-permissions");
            page.setEditPermission(permission);
            changed = true;
        }

        // Save changes
        if (changed) {
View Full Code Here

TOP

Related Classes of org.gatein.api.page.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.