Package org.brixcms

Examples of org.brixcms.Path


        if (nodeURL.startsWith("/")) {
            nodeURL = nodeURL.substring(1);
        }

        builder.append(urlEncodePath(new Path(nodeURL, false)));

        boolean skipFirstSlash = builder.charAt(builder.length() - 1) == '/';

        for (int i = 0; i < parameters.getIndexedCount(); ++i) {
            if (!skipFirstSlash)
View Full Code Here


            set = new HashSet<Path>();
            RequestCycle.get().setMetaData(NODE_SET_KEY, set);
        }


        Path nodePath = new Path(tileNode.getObject().getParent().getPath());

        if (set.contains(nodePath)) {
            // this means we found a loop. However here we just return false,
            // PageTileViewerPanel is responsible for displaying the error
            return false;
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Path getUriPathForNode(Path nodePath, Brix brix) {
        Path uriPath = prefix;

        if (!nodePath.isRoot()) {
            // nodePath is not root, we have to append it to prefix
            uriPath = prefix.append(nodePath.toRelative(Path.ROOT));
        }
View Full Code Here

        JcrUtil.cloneNodes(nodes, provider, limiter);
        targetRootNode.getSession().save();
    }

    private String getCommonParentPath(List<JcrNode> nodes) {
        Path current = null;
        String sitePath = SitePlugin.get().getSiteRootPath();
        for (JcrNode node : nodes) {
            if (node.getPath().startsWith(sitePath) && node instanceof GlobalContainerNode == false) {
                if (current == null) {
                    current = new Path(node.getPath()).parent();
                } else {
                    Path another = new Path(node.getPath()).parent();

                    Path common = Path.ROOT;

                    Iterator<String> i1 = current.iterator();
                    Iterator<String> i2 = another.iterator();
                    while (i1.hasNext() && i2.hasNext()) {
                        String s1 = i1.next();
                        String s2 = i2.next();
                        if (Objects.equal(s1, s2)) {
                            common = common.append(new Path(s1));
                        } else {
                            break;
                        }
                    }
View Full Code Here

public class PathSetTest {
    private PathSet data;

    @Test
    public void containsAncestor() {
        assertTrue(data.remove(new Path("/")));

        assertTrue(data.containsAncestor(new Path("/foo/baz")));
        assertTrue(data.containsAncestor(new Path("/bar/baz")));
        assertTrue(!data.containsAncestor(new Path("/foo")));
        assertTrue(!data.containsAncestor(new Path("/baz")));
    }
View Full Code Here

        assertTrue(!data.containsAncestor(new Path("/baz")));
    }

    @Test
    public void containsParent() {
        assertTrue(!data.containsParent(new Path("/")));
        assertTrue(data.containsParent(new Path("/foo")));
        assertTrue(data.containsParent(new Path("/foo/baz")));
        assertTrue(data.containsParent(new Path("/foo/bar/baz")));
        assertTrue(data.containsParent(new Path("/foo/bar/baz/boz")));
        assertTrue(!data.containsParent(new Path("/foo/baz/bar")));
    }
View Full Code Here

    }

    @Before
    public void initData() {
        data = new PathSet();
        data.add(new Path("/"));
        data.add(new Path("/bar"));
        data.add(new Path("/foo"));
        data.add(new Path("/foo/bar"));
        data.add(new Path("/foo/bar/baz"));
    }
View Full Code Here

        data.add(new Path("/foo/bar/baz"));
    }

    @Test
    public void removeDescendants() {
        data.removeDescendants(new Path("/foo"));
        assertTrue(data.size() == 3);
        assertTrue(data.contains(new Path("/")));
        assertTrue(data.contains(new Path("/bar")));
        assertTrue(data.contains(new Path("/foo")));

        data.removeDescendants(new Path("/"));
        assertTrue(data.size() == 1);
        assertTrue(data.contains(new Path("/")));
    }
View Full Code Here

        assertTrue(data.contains(new Path("/")));
    }

    @Test
    public void removeWithDescendants() {
        data.removeWithDescendants(new Path("/foo"));
        assertTrue(data.size() == 2);
        assertTrue(data.contains(new Path("/")));
        assertTrue(data.contains(new Path("/bar")));

        data.removeWithDescendants(new Path("/"));
        assertTrue(data.isEmpty());
    }
View Full Code Here

        }

        @Override
        public void afterWorkspaceMove(String srcAbsPath, String destAbsPath)
                throws RepositoryException {
            String n1 = new Path(srcAbsPath).getName().toLowerCase();

            // check if the item had extension before renaming. This is used to handle special case
            // when coda creates
            // "Untitled file" node that is later renamed to real file name
            if (n1.lastIndexOf('.') > n1.lastIndexOf('/')) {
View Full Code Here

TOP

Related Classes of org.brixcms.Path

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.