Package org.apache.jetspeed.page.document

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


        Pattern pattern = getCachedPattern(regex);
        NodeSetImpl subset = new NodeSetImpl(comparator);
        Iterator nodeItr = iterator();
        while (nodeItr.hasNext())
        {
            Node node = (Node) nodeItr.next();
            if (pattern.matcher(node.getName()).matches())
            {
                subset.add(node);
            }
        }
        return subset;
View Full Code Here


        Pattern pattern = getCachedPattern(regex);
        NodeSetImpl subset = new NodeSetImpl(comparator);
        Iterator nodeItr = iterator();
        while (nodeItr.hasNext())
        {
            Node node = (Node) nodeItr.next();
            if (!pattern.matcher(node.getName()).matches())
            {
                subset.add(node);
            }
        }
        return subset;
View Full Code Here

        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
View Full Code Here

                String[] nodeNames = folderHandler.listAll(getPath());
                for (int i = 0; i < nodeNames.length; i++)
                {
                    if (!nodeNames[i].equals(FolderMetaDataImpl.DOCUMENT_TYPE))
                    {
                        Node node = null;
                        try
                        {
                            if (getPath().endsWith(PATH_SEPARATOR))
                            {
                                if(nodeNames[i].indexOf(".") > -1)
                                {   
                                    node = getHandlerFactory().getDocumentHandlerForPath(nodeNames[i]).getDocument(getPath() + nodeNames[i]);
                                }
                                else
                                {
                                    node = folderHandler.getFolder(getPath() + nodeNames[i]);
                                }
                            }
                            else
                            {
                               
                                if(nodeNames[i].indexOf(".") > -1)
                                {   
                                    node = getHandlerFactory().getDocumentHandlerForPath(nodeNames[i]).getDocument(getPath() + PATH_SEPARATOR + nodeNames[i]);
                                }
                                else
                                {
                                    node = folderHandler.getFolder(getPath() + PATH_SEPARATOR + nodeNames[i]);
                                }
                            }
                            node.setParent(this);
                            allNodes.add(node);
                        }              
                        catch (UnsupportedDocumentTypeException e)
                        {
                            // Skip unsupported documents
View Full Code Here

            synchronized(all)
            {
                Iterator nodeIter = accessAll().iterator();
                while (nodeIter.hasNext())
                {
                    Node node = (Node)nodeIter.next();
                    if (node instanceof PageImpl)
                    {
                        pages.add(node);
                    }
                    else if (node instanceof FolderImpl)
View Full Code Here

            // check permissions and constraints, filter nodes as required
            NodeSetImpl filteredNodes = null;
            Iterator checkAccessIter = nodes.iterator();
            while (checkAccessIter.hasNext())
            {
                Node node = (Node)checkAccessIter.next();
                try
                {
                    // check access
                    node.checkAccess(JetspeedActions.VIEW);

                    // add to filteredNodes nodes if copying
                    if (filteredNodes != null)
                    {
                        // permitted, add to filteredNodes nodes
                        filteredNodes.add(node);
                    }
                }
                catch (SecurityException se)
                {
                    // create filteredNodes nodes if not already copying
                    if (filteredNodes == null)
                    {
                        // not permitted, copy previously permitted nodes
                        // to new filteredNodes node set with same comparator
                        filteredNodes = new NodeSetImpl(nodes);
                        Iterator copyIter = nodes.iterator();
                        while (copyIter.hasNext())
                        {
                            Node copyNode = (Node)copyIter.next();
                            if (copyNode != node)
                            {
                                filteredNodes.add(copyNode);
                            }
                            else
View Full Code Here

        if (view != null)
        {
            // define menu node for titles and metadata if options
            // specifies a single visible page or folder proxy
            String options = definition.getOptions();
            Node optionProxy = null;
            if ((options != null) && (options.indexOf(',') == -1))
            {
                try
                {
                    optionProxy = view.getNodeProxy(options, context.getPage(), true, true);
View Full Code Here

                            if (pathProxies != null)
                            {
                                Iterator pathProxiesIter = pathProxies.iterator();
                                while (pathProxiesIter.hasNext())
                                {
                                    Node pathProxy = (Node)pathProxiesIter.next();
                                    if ((locatorName == null) || locatorName.equals(MenuOptionsDefinition.ANY_PROFILE_LOCATOR) ||
                                        locatorName.equals(view.getProfileLocatorName(pathProxy)))
                                    {
                                        if (elementProxies == null)
                                        {
                                            elementProxies = new ArrayList();
                                        }
                                        appendMenuElementProxies(pathProxy, elementProxies);
                                    }
                                }
                            }
                        }
                        else
                        {
                            // get visible proxy for path from view and append to
                            // list if unique and pass profile locator name filter
                            Node pathProxy = null;
                            try
                            {
                                pathProxy = view.getNodeProxy(optionPath, context.getPage(), true, true);
                            }
                            catch (NodeNotFoundException nnfe)
                            {
                            }
                            catch (SecurityException se)
                            {
                            }
                            if ((pathProxy != null) &&
                                ((locatorName == null) || locatorName.equals(MenuOptionsDefinition.ANY_PROFILE_LOCATOR) ||
                                 locatorName.equals(view.getProfileLocatorName(pathProxy))))
                            {
                                if (elementProxies == null)
                                {
                                    elementProxies = new ArrayList();
                                }
                                appendMenuElementProxies(pathProxy, elementProxies);
                            }
                        }

                        // set relative element flag if path is relative
                        elementRelative = (elementRelative || !optionPath.startsWith(Folder.PATH_SEPARATOR));
                    }
                }

                // return if no proxies available
                if (elementProxies == null)
                {
                    return null;
                }
            }
           
            // sort elements proxies using url and/or names if order
            // specified and more than one element proxy in list
            if ((order != null) && (elementProxies.size() > 1))
            {
                // create ordered element proxies
                List orderedElementProxies = new ArrayList(elementProxies.size());
               
                // split multiple comma separated elements orderings
                // after converted to regexp pattern
                String [] orderings = orderRegexpPattern(order).split(",");
               
                // copy ordered proxies per ordering
                for (int i=0; ((i < orderings.length) && (elementProxies.size() > 1)); i++)
                {
                    String ordering = orderings[i].trim();
                    if (ordering.length() > 0)
                    {
                        // get ordering pattern and matcher
                        Pattern pattern = Pattern.compile(ordering);
                        Matcher matcher = null;
                       
                        // use regular expression to match urls or names of
                        // element proxies; matched proxies are removed and
                        // placed in the ordered elements proxies list
                        Iterator elementProxiesIter = elementProxies.iterator();
                        while (elementProxiesIter.hasNext())
                        {
                            Node elementProxy = (Node)elementProxiesIter.next();
                           
                            // get url or name to test ordering match against
                            String test = null;
                            if (ordering.charAt(0) == Folder.PATH_SEPARATOR_CHAR)
                            {
                                test = elementProxy.getUrl();
                            }
                            else
                            {
                                test = elementProxy.getName();
                            }
                           
                            // construct or reset ordering matcher
                            if (matcher == null)
                            {
                                matcher = pattern.matcher(test);
                            }
                            else
                            {
                                matcher.reset(test);
                            }
                           
                            // move proxy to ordered list if matched
                            if (matcher.matches())
                            {
                                orderedElementProxies.add(elementProxy);
                                elementProxiesIter.remove();
                            }
                        }
                    }
                }
               
                // copy remaining unordered proxies
                orderedElementProxies.addAll(elementProxies);
               
                // replace element proxies with ordered list
                elementProxies = orderedElementProxies;
            }
           
            // expand paths if single page or folder element proxy
            // has been specified in elements with no depth expansion
            if (paths && (depth == 0) && (elementProxies.size() == 1) &&
                ((elementProxies.get(0) instanceof Folder) || (elementProxies.get(0) instanceof Page)))
            {
                Node parentNode = ((Node)elementProxies.get(0)).getParent();
                while (parentNode != null)
                {
                    elementProxies.add(0, parentNode);
                    parentNode = parentNode.getParent();
                }
            }
           
            // convert elements proxies into menu elements
            DefaultMenuOptionsDefinition defaultMenuOptionsDefinition = null;
            ListIterator elementProxiesIter = elementProxies.listIterator();
            while (elementProxiesIter.hasNext())
            {
                Node elementProxy = (Node)elementProxiesIter.next();
                MenuElement menuElement = null;

                // convert folders into nested menus if depth specified
                // with no paths expansion, (negative depth values are
                // interpreted as complete menu expansion)
                if ((elementProxy instanceof Folder) && ((depth < 0) || (depth > 1)) && !paths)
                {
                    // construct menu definition and associated menu
                    MenuDefinition nestedMenuDefinition = new DefaultMenuDefinition(elementProxy.getUrl(), depth - 1, locatorName);
                    menuElement = new MenuImpl(this, nestedMenuDefinition, context, null);
                }
                else
                {
                    // construct shared default menu option definition and menu option
View Full Code Here

        if (entry.getDocument() instanceof Document && ((Document) entry.getDocument()).getPath().endsWith(documentType))
        {
            Document document = (Document) entry.getDocument();
            Document freshDoc = getDocument(document.getPath(), false);
            Node parent = ((AbstractNode)document).getParent(false);
            freshDoc.setParent(parent);
            if(parent instanceof FolderImpl)
            {
                FolderImpl folder = (FolderImpl) parent;
View Full Code Here

            }

            // lookup request path in view for viewable page or folder
            // nodes; note: directly requested pages/folders may be hidden
            // or not viewable
            Node requestNode = null;
            try
            {
                // try page or folder request url
                requestNode = view.getNodeProxy(requestPath, null, false, false);
            }
View Full Code Here

TOP

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

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.