Package org.brixcms.jcr.api

Examples of org.brixcms.jcr.api.JcrNode


        return brix.getAuthorizationStrategy().isActionAuthorized(action);
    }

    private void checkForSiteRoot(JcrNode webNode) {
        if (!webNode.hasNode(SITE_NODE_NAME)) {
            JcrNode site = webNode.addNode(SITE_NODE_NAME, "nt:folder");
            site.addMixin(BrixNode.JCR_TYPE_BRIX_NODE);

            JcrNodeIterator nodes = webNode.getNodes();
            while (nodes.hasNext()) {
                BrixNode node = (BrixNode) nodes.nextNode();
                if (node.isSame(site) == false && node instanceof GlobalContainerNode == false) {
                    JcrSession session = webNode.getSession();
                    session.move(node.getPath(), site.getPath() + "/" + node.getName());
                }
            }
        } else {
            // make reference for brix:site to brix:web to prevent creating prototypes
            // without selecting brix:web
            JcrNode site = webNode.getNode(SITE_NODE_NAME);
            if (!site.hasProperty(Brix.NS_PREFIX + "web")) {
                site.setProperty(Brix.NS_PREFIX + "web", webNode);
            }
        }
    }
View Full Code Here


        if (delegate == null) {
            return null;
        } else {
            Behavior behavior = session.getBehavior();
            if (behavior != null) {
                JcrNode node = behavior.wrap(delegate, session);
                if (node != null) {
                    return node;
                }
            }
            return new NodeWrapper(delegate, session);
View Full Code Here

        tf.setRequired(true);
        tf.add(NodeNameValidator.getInstance());
    }

    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);
        } else {
            FolderNode node = (FolderNode) parent.addNode(name, "nt:folder");
            parent.save();

            SitePlugin.get().selectNode(this, node, true);
        }
    }
View Full Code Here

TOP

Related Classes of org.brixcms.jcr.api.JcrNode

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.