Search in sources :

Example 21 with ITreeNode

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

the class PageTreeTag method doStartTag.

@Override
public int doStartTag() throws JspException {
    try {
        IPageActionHelper helper = this.getHelper(this.isOnline());
        ITreeNode root = this.getAllowedTreeRootNode(helper);
        ValueStack stack = this.getStack();
        stack.getContext().put(this.getVar(), root);
        stack.setValue("#attr['" + this.getVar() + "']", root, false);
    } catch (Throwable t) {
        _logger.error("error in doStartTag", t);
        throw new JspException("Error during tag initialization", t);
    }
    return super.doStartTag();
}
Also used : JspException(javax.servlet.jsp.JspException) ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) ValueStack(com.opensymphony.xwork2.util.ValueStack) IPageActionHelper(com.agiletec.apsadmin.portal.helper.IPageActionHelper)

Example 22 with ITreeNode

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

the class PageTreeTag method getAllowedTreeRootNode.

public ITreeNode getAllowedTreeRootNode(ITreeNodeBaseActionHelper helper) {
    ITreeNode root = null;
    try {
        root = helper.getAllowedTreeRoot(this.getAllowedGroups());
        if (this.isOnDemand()) {
            Collection<String> allowedGroups = this.convertCollection(this.getAllowedGroups());
            root = helper.getShowableTree(this.getTargetNodes(allowedGroups, helper), root, allowedGroups);
        }
    } catch (Throwable t) {
        _logger.error("error in getAllowedTreeRootNode", t);
    }
    return root;
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Example 23 with ITreeNode

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

the class TestCategoryAction method testViewTree.

public void testViewTree() throws Throwable {
    this.setUserOnSession("pageManagerCoach");
    this.initAction("/do/Category", "viewTree");
    String result = this.executeAction();
    assertEquals("userNotAllowed", result);
    this.setUserOnSession("admin");
    this.initAction("/do/Category", "viewTree");
    result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    CategoryAction action = (CategoryAction) this.getAction();
    ITreeNode root = action.getTreeRootNode();
    assertEquals(this._categoryManager.getRoot().getCode(), root.getCode());
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode)

Example 24 with ITreeNode

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

the class TestPageTreeAction method checkTestViewTree_3_4.

private void checkTestViewTree_3_4() throws Throwable {
    ITreeNode showableRoot = ((PageTreeAction) this.getAction()).getShowableTree();
    assertEquals("homepage", showableRoot.getCode());
    assertTrue(showableRoot instanceof TreeNodeWrapper);
    ITreeNode[] children = ((TreeNodeWrapper) showableRoot).getChildren();
    assertEquals(7, children.length);
    boolean check = false;
    for (int i = 0; i < children.length; i++) {
        TreeNodeWrapper child = (TreeNodeWrapper) children[i];
        if (child.getCode().equals("pagina_1")) {
            assertEquals(2, child.getChildrenCodes().length);
            assertEquals("pagina_11", child.getChildrenCodes()[0]);
            assertEquals("pagina_12", child.getChildrenCodes()[1]);
            check = true;
        } else {
            assertEquals(0, child.getChildrenCodes().length);
        }
    }
    if (!check) {
        fail();
    }
}
Also used : ITreeNode(com.agiletec.aps.system.common.tree.ITreeNode) TreeNodeWrapper(com.agiletec.apsadmin.system.TreeNodeWrapper)

Example 25 with ITreeNode

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

the class TestPageTreeAction method testViewTree_2.

public void testViewTree_2() throws Throwable {
    this.initAction("/do/Page", "viewTree");
    this.setUserOnSession("pageManagerCustomers");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    ITreeNode root = ((PageTreeAction) this.getAction()).getAllowedTreeRootNode();
    assertNotNull(root);
    assertEquals(AbstractPortalAction.VIRTUAL_ROOT_CODE, root.getCode());
    assertEquals(1, root.getChildrenCodes().length);
    assertEquals("customers_page", root.getChildrenCodes()[0]);
    ITreeNode showableRoot = ((PageTreeAction) this.getAction()).getShowableTree();
    assertEquals(AbstractPortalAction.VIRTUAL_ROOT_CODE, showableRoot.getCode());
    assertEquals(0, showableRoot.getChildrenCodes().length);
}
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