Package org.brixcms

Examples of org.brixcms.Path


     */
    public BrixNode getNodeForUriPath(final Path uriPath) {
        BrixNode node = null;

        // create desired nodepath
        final Path nodePath = brix.getConfig().getMapper().getNodePathForUriPath(
                uriPath.toAbsolute(), brix);

        if (nodePath != null) {
            // allow site plugin to translate the node path into an actual jcr path
            final String jcrPath = SitePlugin.get().toRealWebNodePath(nodePath.toString());

            // retrieve jcr session
            final String workspace = getWorkspace();
            final JcrSession session = brix.getCurrentSession(workspace);

View Full Code Here


     * @return uri path that represents the node
     */
    public Path getUriPathForNode(final BrixNode node) {
        // allow site plugin to translate jcr path into node path
        final String jcrPath = SitePlugin.get().fromRealWebNodePath(node.getPath());
        final Path nodePath = new Path(jcrPath);

        // use urimapper to create the uri
        return brix.getConfig().getMapper().getUriPathForNode(nodePath, brix);
    }
View Full Code Here

    }

    public void removeDescendants(Path path) {
        Iterator<Path> i = iterator();
        while (i.hasNext()) {
            Path p = i.next();
            if (p.isDescendantOf(path)) {
                i.remove();
            }
        }
    }
View Full Code Here

    public JcrNode nodeForPath(BrixNode baseNode, Path path) {
        return nodeForPath(baseNode, path.toString());
    }

    public JcrNode nodeForPath(BrixNode baseNode, String path) {
        Path realPath = new Path(SitePlugin.get().toRealWebNodePath(path));

        if (realPath.isAbsolute() == false) {
            Path base = new Path(baseNode.getPath());
            if (!baseNode.isFolder()) {
                base = base.parent();
            }
            realPath = base.append(realPath);
        }

        String strPath = realPath.toString();
        if (baseNode.getSession().itemExists(strPath) == false) {
            return null;
View Full Code Here

     * @return uri path that represents the node
     */
    public Path getUriPathForNode(final BrixNode node) {
        // allow site plugin to translate jcr path into node path
        final String jcrPath = SitePlugin.get().fromRealWebNodePath(node.getPath());
        final Path nodePath = new Path(jcrPath);

        // use urimapper to create the uri
        return brix.getConfig().getMapper().getUriPathForNode(nodePath, brix);
    }
View Full Code Here

        // use urimapper to create the uri
        return brix.getConfig().getMapper().getUriPathForNode(nodePath, brix);
    }

    public String toRealWebNodePath(String nodePath) {
        Path prefix = new Path(getSiteRootPath());
        Path path = new Path(nodePath);

        if (path.isRoot()) {
            path = new Path(".");
        } else if (path.isAbsolute()) {
            path = path.toRelative(new Path("/"));
        }

        return prefix.append(path).toString();
    }
View Full Code Here

    public String pathForNode(JcrNode node) {
        return SitePlugin.get().fromRealWebNodePath(node.getPath());
    }

    public String fromRealWebNodePath(String nodePath) {
        Path prefix = new Path(getSiteRootPath());
        Path path = new Path(nodePath);

        if (path.equals(prefix)) {
            path = new Path("/");
        } else if (path.isDescendantOf(prefix)) {
            path = path.toRelative(prefix);
        }

        if (!path.isAbsolute()) {
            path = new Path("/").append(path);
        }

        return path.toString();
    }
View Full Code Here

    }

    private void createFolder() {
        final JcrNode parent = (JcrNode) getModelObject();

        final Path path = new Path(parent.getPath());
        final Path newPath = path.append(new Path(name));

        final JcrSession session = parent.getSession();

        if (session.itemExists(newPath.toString())) {
            class ModelObject implements Serializable {
                @SuppressWarnings("unused")
                public String path = SitePlugin.get().fromRealWebNodePath(newPath.toString());
            }

            ;
            String error = getString("resourceExists", new Model<ModelObject>(new ModelObject()));
            error(error);
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.