Search in sources :

Example 31 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class PageTreeMenuAction method intro.

public String intro() {
    String pageCode = (this.getSelectedNode() != null ? this.getSelectedNode() : this.getPageCode());
    if (StringUtils.isBlank(pageCode)) {
        ITreeNode rootNode = this.getAllowedTreeRootNode();
        pageCode = rootNode.getCode();
        if (VIRTUAL_ROOT_CODE.equals(pageCode)) {
            if (null != rootNode.getChildrenCodes() && rootNode.getChildrenCodes().length > 0) {
                pageCode = rootNode.getChildrenCodes()[0];
            } else {
                this.addActionError(this.getText("error.page.virtualRootSelected"));
                return "noRoot";
            }
        }
    }
    this.setPageCode(pageCode);
    this.setSelectedNode(pageCode);
    String check = this.checkSelectedNode(pageCode);
    if (null != check) {
        return check;
    }
    return SUCCESS;
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Example 32 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class AbstractTreeAction method getShowableTree.

@Override
public ITreeNode getShowableTree() {
    ITreeNode node = null;
    try {
        ITreeNode allowedTree = this.getAllowedTreeRootNode();
        node = this.getTreeHelper().getShowableTree(this.getTreeNodesToOpen(), allowedTree, this.getNodeGroupCodes());
    } catch (Throwable t) {
        _logger.error("error in getShowableTree", t);
    }
    return node;
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Example 33 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TreeNodeBaseActionHelper method addTreeWrapper.

private void addTreeWrapper(TreeNodeWrapper currentNode, ITreeNode currentTreeNode) {
    String[] children = currentTreeNode.getChildrenCodes();
    for (int i = 0; i < children.length; i++) {
        ITreeNode newCurrentTreeNode = this.getTreeNode(children[i]);
        TreeNodeWrapper newNode = this.buildWrapper(newCurrentTreeNode);
        currentNode.addChildCode(newNode.getCode());
        currentNode.addChild(newNode);
        this.addTreeWrapper(newNode, newCurrentTreeNode);
    }
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Example 34 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TreeNodeBaseActionHelper method checkTargetNodesOnClosing.

@Override
public Set<String> checkTargetNodesOnClosing(String nodeToCloseCode, Set<String> lastOpenedNodes, Collection<String> groupCodes) throws ApsSystemException {
    ITreeNode nodeToClose = this.getTreeNode(nodeToCloseCode);
    if (null == nodeToCloseCode || null == nodeToClose) {
        return this.checkTargetNodes(null, lastOpenedNodes, groupCodes);
    }
    Set<String> checkedTargetNodes = new HashSet<String>();
    try {
        if (nodeToClose.isRoot()) {
            return checkedTargetNodes;
        }
        if (null != lastOpenedNodes) {
            Iterator<String> iter = lastOpenedNodes.iterator();
            while (iter.hasNext()) {
                String code = (String) iter.next();
                if (null != code && this.checkNode(code, groupCodes) && !code.equals(nodeToCloseCode) && !this.getTreeNode(code).isChildOf(nodeToCloseCode)) {
                    checkedTargetNodes.add(code);
                }
            }
        }
        if (null != nodeToClose.getParent() && this.checkNode(nodeToClose.getParent().getCode(), groupCodes)) {
            checkedTargetNodes.add(nodeToClose.getParent().getCode());
        }
    } catch (Throwable t) {
        _logger.error("Error check target nodes on closing tree", t);
        throw new ApsSystemException("Error check target nodes on closing tree", t);
    }
    return checkedTargetNodes;
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) HashSet(java.util.HashSet)

Example 35 with ITreeNode

use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.

the class TreeNodeBaseActionHelper method buildCheckNodes.

private void buildCheckNodes(Set<String> treeNodesToOpen, Set<String> nodesToShow, Collection<String> groupCodes) {
    if (null == treeNodesToOpen) {
        return;
    }
    Iterator<String> iter = treeNodesToOpen.iterator();
    while (iter.hasNext()) {
        String targetNode = (String) iter.next();
        ITreeNode treeNode = this.getTreeNode(targetNode);
        if (null != treeNode) {
            this.buildCheckNodes(treeNode, nodesToShow, groupCodes);
        }
    }
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Aggregations

ITreeNode (com.agiletec.aps.system.common.tree.ITreeNode)36 Category (com.agiletec.aps.system.services.category.Category)9 ArrayList (java.util.ArrayList)9 PageTreeAction (com.agiletec.apsadmin.portal.PageTreeAction)7 IDataObjectSearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.IDataObjectSearchEngineManager)4 SearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager)4 SearchEngineFilter (org.entando.entando.aps.system.services.searchengine.SearchEngineFilter)4 TreeNodeWrapper (com.agiletec.apsadmin.system.TreeNodeWrapper)2 Term (org.apache.lucene.index.Term)2 BooleanQuery (org.apache.lucene.search.BooleanQuery)2 MatchAllDocsQuery (org.apache.lucene.search.MatchAllDocsQuery)2 PhraseQuery (org.apache.lucene.search.PhraseQuery)2 Query (org.apache.lucene.search.Query)2 TermQuery (org.apache.lucene.search.TermQuery)2 TermRangeQuery (org.apache.lucene.search.TermRangeQuery)2 FacetedContentsResult (org.entando.entando.aps.system.services.searchengine.FacetedContentsResult)2 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 IPage (com.agiletec.aps.system.services.page.IPage)1 IPageActionHelper (com.agiletec.apsadmin.portal.helper.IPageActionHelper)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1