Search in sources :

Example 1 with PageTreeNodeWrapper

use of org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper in project entando-core by entando.

the class PageFinderAction method addTreeWrapper.

private void addTreeWrapper(PageTreeNodeWrapper parent, IPage currentNode) {
    boolean isOnline = currentNode.isOnline();
    String[] children = currentNode.getChildrenCodes();
    if (null == children) {
        return;
    }
    for (int i = 0; i < children.length; i++) {
        IPage newCurrentNode = PageUtils.getPage(this.getPageManager(), isOnline, children[i]);
        if (null == newCurrentNode) {
            continue;
        }
        PageTreeNodeWrapper newNode = new PageTreeNodeWrapper(newCurrentNode);
        if (this.getResultCodes().contains(newCurrentNode.getCode())) {
            parent.addChildCode(newNode.getCode());
            this.addTreeWrapper(newNode, newCurrentNode);
        } else {
            this.addTreeWrapper(parent, newCurrentNode);
        }
    }
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) PageTreeNodeWrapper(org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper)

Example 2 with PageTreeNodeWrapper

use of org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper in project entando-core by entando.

the class AbstractPageActionHelper method getVirtualRoot.

/**
 * Metodo a servizio della costruzione dell'albero delle pagine. Nel caso
 * che l'utente corrente non sia abilitato alla visualizzazione del nodo
 * root, fornisce un nodo "virtuale" nel quale inserire gli eventuali nodi
 * visibili.
 *
 * @return Il nodo root virtuale.
 */
private PageTreeNodeWrapper getVirtualRoot() {
    PageTreeNodeWrapper virtualRoot = new PageTreeNodeWrapper();
    virtualRoot.setCode(AbstractPortalAction.VIRTUAL_ROOT_CODE);
    List<Lang> langs = this.getLangManager().getLangs();
    for (int i = 0; i < langs.size(); i++) {
        Lang lang = langs.get(i);
        virtualRoot.setTitle(lang.getCode(), "ROOT");
    }
    return virtualRoot;
}
Also used : Lang(com.agiletec.aps.system.services.lang.Lang) PageTreeNodeWrapper(org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper)

Example 3 with PageTreeNodeWrapper

use of org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper in project entando-core by entando.

the class PageFinderAction method getAllowedTreeRootNode.

@Override
public ITreeNode getAllowedTreeRootNode() {
    PageTreeNodeWrapper root = null;
    try {
        if (null != this.getResultCodes() && this.getResultCodes().size() > 0) {
            IPage node = this.getPageManager().getDraftRoot();
            root = new PageTreeNodeWrapper(node);
            this.addTreeWrapper(root, node);
        }
    } catch (Throwable t) {
        _logger.error("error in getAllowedTreeRootNode", t);
    }
    return root;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) PageTreeNodeWrapper(org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper)

Example 4 with PageTreeNodeWrapper

use of org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper in project entando-core by entando.

the class AbstractPageActionHelper method addTreeWrapper.

private void addTreeWrapper(PageTreeNodeWrapper currentWrapper, IPage currentNode, Collection<String> userGroupCodes, boolean alsoFreeViewPages) {
    String[] children = currentNode.getChildrenCodes();
    for (int i = 0; i < children.length; i++) {
        IPage newCurrentNode = PageUtils.getPage(this.getPageManager(), !this.isDraftPageHepler(), children[i]);
        if (null == newCurrentNode) {
            return;
        }
        if (this.isPageAllowed(newCurrentNode, userGroupCodes, alsoFreeViewPages)) {
            PageTreeNodeWrapper newNode = new PageTreeNodeWrapper(newCurrentNode);
            currentWrapper.addChildCode(newNode.getCode());
            currentWrapper.addChild(newNode);
            this.addTreeWrapper(newNode, newCurrentNode, userGroupCodes, alsoFreeViewPages);
        } else {
            this.addTreeWrapper(currentWrapper, newCurrentNode, userGroupCodes, alsoFreeViewPages);
        }
    }
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) PageTreeNodeWrapper(org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper)

Example 5 with PageTreeNodeWrapper

use of org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper in project entando-core by entando.

the class AbstractPageActionHelper method getAllowedTreeRoot.

@Override
public ITreeNode getAllowedTreeRoot(Collection<String> userGroupCodes, boolean alsoFreeViewPages) throws ApsSystemException {
    PageTreeNodeWrapper root = null;
    IPage pageRoot = (IPage) this.getRoot();
    if (userGroupCodes.contains(Group.FREE_GROUP_NAME) || userGroupCodes.contains(Group.ADMINS_GROUP_NAME) || (alsoFreeViewPages && null != pageRoot.getExtraGroups() && pageRoot.getExtraGroups().contains(Group.FREE_GROUP_NAME))) {
        root = new PageTreeNodeWrapper(this.getRoot());
    } else {
        root = this.getVirtualRoot();
    }
    this.addTreeWrapper(root, pageRoot, userGroupCodes, alsoFreeViewPages);
    return root;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) PageTreeNodeWrapper(org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper)

Aggregations

PageTreeNodeWrapper (org.entando.entando.apsadmin.portal.node.PageTreeNodeWrapper)5 IPage (com.agiletec.aps.system.services.page.IPage)4 Lang (com.agiletec.aps.system.services.lang.Lang)1