Package org.apache.jetspeed.page.document

Examples of org.apache.jetspeed.page.document.NodeSet


     */
    public NodeSet getAll() throws DocumentException
    {
        // return secure set of all nodes: enforce access checks
        // on folders and documents while creating filtered nodes
        NodeSet nodes = getAllNodes();
        NodeSet filteredNodes = null;
        Iterator checkAccessIter = nodes.iterator();
        while (checkAccessIter.hasNext())
        {
            Node node = (Node)checkAccessIter.next();
            try
            {
                ((AbstractNode) node).checkAccess(JetspeedActions.VIEW);
                if (filteredNodes != null)
                {
                    filteredNodes.add(node);
                }
            }
            catch (SecurityException se)
            {
                if (filteredNodes == null)
                {
                    filteredNodes = new NodeSetImpl(getPath(), ((NodeSetImpl) nodes).getComparator());
                    Iterator copyIter = nodes.iterator();
                    while (copyIter.hasNext())
                    {
                        Node copyNode = (Node)copyIter.next();
                        if (copyNode != node)
                        {
                            filteredNodes.add(copyNode);
                        }
                        else
                        {
                            break;
                        }
View Full Code Here


            if (!subsiteRoot.equals(""))
            {
                try
                {
                    Folder subsiteFolder = pageManager.getFolder(subsiteRoot);
                    NodeSet set = pageManager.getFolders(subsiteFolder);
                    if (set != null && !set.isEmpty())
                    {
                        Iterator setIterator = set.iterator();
                        while (setIterator.hasNext())
                        {
                            Folder f = (Folder)setIterator.next();
                            subsites.add(new SubsiteInfo(f.getPath(), f.getTitle()));
                        }
View Full Code Here

     * @param type
     * @return
     */
    public NodeSet subset( String type )
    {
        NodeSet subset = (NodeSet) subsets.get(type);
        if (subset == null)
        {
            subset = new NodeSetImpl(resolveToPath, comparator);

            Iterator nodeItr = nodes.values().iterator();
            while (nodeItr.hasNext())
            {
                Node node = (Node) nodeItr.next();
                if (node.getType().equals(type))
                {
                    subset.add(node);
                }
            }
           
            synchronized (subsets)
            {
View Full Code Here

        assertEquals("/_user/user/page2.psml", extractFileSystemPathFromId(requestPageProxy.getId()));
        Folder requestFolderProxy = requestContext.getFolder();
        assertNotNull(requestFolderProxy);
        assertEquals("/", requestFolderProxy.getName());
        assertEquals("/_user/user", extractFileSystemPathFromId(requestFolderProxy.getId()));
        NodeSet requestSiblingPageProxies = requestContext.getSiblingPages();
        assertNotNull(requestSiblingPageProxies);
        assertEquals(3, requestSiblingPageProxies.size());
        assertNotNull(requestSiblingPageProxies.get("page0.psml"));
        assertEquals("/page0.psml", extractFileSystemPathFromId(requestSiblingPageProxies.get("page0.psml").getId()));
        assertNotNull(requestSiblingPageProxies.get("page1.psml"));
        assertEquals("/page1.psml", extractFileSystemPathFromId(requestSiblingPageProxies.get("page1.psml").getId()));
        assertNotNull(requestSiblingPageProxies.get("page2.psml"));
        assertEquals("/_user/user/page2.psml", extractFileSystemPathFromId(requestSiblingPageProxies.get("page2.psml").getId()));
        Folder requestParentFolderProxy = requestContext.getParentFolder();
        assertNull(requestParentFolderProxy);
        NodeSet requestSiblingFolderProxies = requestContext.getSiblingFolders();
        assertNotNull(requestSiblingFolderProxies);
        assertEquals(3, requestSiblingFolderProxies.size());
        assertNotNull(requestSiblingFolderProxies.get("folder0"));
        assertEquals("/folder0", extractFileSystemPathFromId(requestSiblingFolderProxies.get("folder0").getId()));
        assertNotNull(requestSiblingFolderProxies.get("folder1"));
        assertEquals("/_user/user/folder1", extractFileSystemPathFromId(requestSiblingFolderProxies.get("folder1").getId()));
        assertNotNull(requestSiblingFolderProxies.get("folder2"));
        assertEquals("/folder2", extractFileSystemPathFromId(requestSiblingFolderProxies.get("folder2").getId()));
        Folder requestRootFolderProxy = requestContext.getRootFolder();
        assertNotNull(requestRootFolderProxy);
        assertEquals("/", requestRootFolderProxy.getName());
        assertEquals("/_user/user", extractFileSystemPathFromId(requestRootFolderProxy.getId()));
        NodeSet requestRootLinkProxies = requestContext.getRootLinks();
        assertNotNull(requestRootLinkProxies);
        assertEquals(2, requestRootLinkProxies.size());
        assertNotNull(requestRootLinkProxies.get("link0.link"));
        assertEquals("/_group/group/link0.link", extractFileSystemPathFromId(requestRootLinkProxies.get("link0.link").getId()));
        assertNotNull(requestRootLinkProxies.get("link1.link"));
        assertEquals("/link1.link", extractFileSystemPathFromId(requestRootLinkProxies.get("link1.link").getId()));
    }
View Full Code Here

     * @throws DocumentException
     */
    public NodeSet getFolders(boolean checkAccess) throws DocumentException
    {
        // get list of all folders
        NodeSet folders = getAllNodes().subset(FOLDER_TYPE);

        // filter node set by access
        if (checkAccess)
        {
            folders = checkAccess(folders, JetspeedActions.VIEW);
View Full Code Here

     * @throws NodeException
     */
    public NodeSet getPages(boolean checkAccess) throws NodeException
    {
        // get list of all pages
        NodeSet pages = getAllNodes().subset(Page.DOCUMENT_TYPE);

        // filter node set by access
        if (checkAccess)
        {
            pages = checkAccess(pages, JetspeedActions.VIEW);
View Full Code Here

     * @throws NodeException
     */
    public NodeSet getLinks(boolean checkAccess) throws NodeException
    {
        // get list of all links
        NodeSet links = getAllNodes().subset(Link.DOCUMENT_TYPE);

        // filter node set by access
        if (checkAccess)
        {
            links = checkAccess(links, JetspeedActions.VIEW);
View Full Code Here

     */
    public NodeSet getAll() throws DocumentException
    {
        // return secure set of all nodes: enforce access checks
        // on folders and documents while creating filtered nodes
        NodeSet nodes = getAllNodes();
        NodeSet filteredNodes = null;
        Iterator checkAccessIter = nodes.iterator();
        while (checkAccessIter.hasNext())
        {
            Node node = (Node)checkAccessIter.next();
            try
            {
                ((AbstractNode) node).checkAccess(JetspeedActions.VIEW);
                if (filteredNodes != null)
                {
                    filteredNodes.add(node);
                }
            }
            catch (SecurityException se)
            {
                if (filteredNodes == null)
                {
                    filteredNodes = new NodeSetImpl(getPath(), ((NodeSetImpl) nodes).getComparator());
                    Iterator copyIter = nodes.iterator();
                    while (copyIter.hasNext())
                    {
                        Node copyNode = (Node)copyIter.next();
                        if (copyNode != node)
                        {
                            filteredNodes.add(copyNode);
                        }
                        else
                        {
                            break;
                        }
View Full Code Here

            if (!subsiteRoot.equals(""))
            {
                try
                {
                    Folder subsiteFolder = pageManager.getFolder(subsiteRoot);
                    NodeSet set = pageManager.getFolders(subsiteFolder);
                    if (set != null && !set.isEmpty())
                    {
                        Iterator setIterator = set.iterator();
                        while (setIterator.hasNext())
                        {
                            Folder f = (Folder)setIterator.next();
                            subsites.add(new SubsiteInfo(f.getPath(), f.getTitle()));
                        }
View Full Code Here

     * @param type
     * @return
     */
    public NodeSet subset( String type )
    {
        NodeSet subset = (NodeSet) subsets.get(type);
        if (subset == null)
        {
            subset = new NodeSetImpl(resolveToPath, comparator);
            subsets.put(type, subset);

            Iterator nodeItr = nodes.values().iterator();
            while (nodeItr.hasNext())
            {
                Node node = (Node) nodeItr.next();
                if (node.getType().equals(type))
                {
                    subset.add(node);
                }
            }
        }

        return subset;
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.page.document.NodeSet

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.