Package org.brixcms.jcr.api

Examples of org.brixcms.jcr.api.JcrNode


    @SuppressWarnings("unchecked")
    public void validate(IValidatable validatable) {
        Object o = validatable.getValue();
        if (o != null) {
            JcrNode node = nodeModel.getObject();
            Path path = null;
            if (o instanceof Path) {
                path = (Path) o;
            } else {
                path = new Path(o.toString());
            }

            if (!path.isAbsolute()) {
                Path parent = new Path(node.getPath());
                if (!((BrixNode) node).isFolder())
                    parent = parent.parent();
                path = parent.append(path);
            } else {
                path = new Path(SitePlugin.get().toRealWebNodePath(path.toString()));
            }
            if (node.getSession().itemExists(path.toString()) == false) {
                ValidationError error = new ValidationError();
                error.setMessage("Node ${path} could not be found");
                error.addMessageKey("NodePathValidator");
                error.getVariables().put("path", path.toString());
                validatable.error(error);
View Full Code Here


    }

    @Override
    public boolean checkRequired() {
        if (isRequired()) {
            JcrNode node = (JcrNode) getModelObject();
            if (node == null) {
                return false;
            }
        }
        return true;
View Full Code Here

        set.add(nodePath);

        final boolean result;

        if (tileNode.getObject().hasProperty("pageNode")) {
            JcrNode pageNode = tileNode.getObject().getProperty("pageNode").getNode();
            result = ((AbstractContainer) pageNode).requiresSSL();
        } else {
            result = false;
        }
View Full Code Here

        super.onBeforeRender();
    }

    private void init() {
        JcrNode tileNode = (JcrNode) getModelObject();

        if (checkLoop(getModel()) == true) {
            add(new Label("view", "Loop detected."));
        } else {
            BrixNode pageNode = (BrixNode) (tileNode.hasProperty("pageNode") ? tileNode.getProperty("pageNode")
                    .getNode() : null);

            if (pageNode != null) {
                add(new PageRenderingPanel("view", new BrixNodeModel(pageNode)));
            } else {
View Full Code Here

    /**
     * @deprecated
     */
    @Deprecated
    public JcrNode getNodeByUUID(final String uuid) {
        JcrNode result = uuidMap.get(uuid);
        if (result == null) {
            result = executeCallback(new Callback<JcrNode>() {
                public JcrNode execute() throws Exception {
                    Node node = getDelegate().getNodeByUUID(uuid);
                    return JcrNode.Wrapper.wrap(node, getJcrSession());
View Full Code Here

        }
        return result;
    }

    public JcrNode getNodeByIdentifier(final String id) {
        JcrNode result = uuidMap.get(id);
        if (result == null) {
            result = executeCallback(new Callback<JcrNode>() {
                public JcrNode execute() throws Exception {
                    Node node = getDelegate().getNodeByIdentifier(id);
                    return JcrNode.Wrapper.wrap(node, getJcrSession());
View Full Code Here

    public JcrNode wrap(Node node, JcrSession session) {
        if (node instanceof JcrNode) {
            return (JcrNode) node;
        }

        JcrNode n = new NodeWrapper(node, session);

        Collection<JcrNodeWrapperFactory> factories = brix.getConfig().getRegistry().lookupCollection(
                JcrNodeWrapperFactory.POINT);

        for (JcrNodeWrapperFactory factory : factories) {
View Full Code Here

            handleSaveEvent((SaveEvent) event);
        }
    }

    private void handleSaveEvent(SaveEvent event) {
        JcrNode node = event.getNode();
        touch(node);
        if (node.getDepth() == 0 || node.isNodeType("nt:folder")) {
            // go through immediate children to determine if there are any
            // modified ones
            JcrNodeIterator iterator = node.getNodes();
            while (iterator.hasNext()) {
                JcrNode n = iterator.nextNode();
                if (n.isModified() || n.isNew()) {
                    touch(n);
                } else if (n.hasNode("jcr:content")) {
                    JcrNode content = n.getNode("jcr:content");
                    if (content.isModified() || content.isNew()) {
                        touch(n);
                    } else if (content.hasProperty("jcr:data")) {
                        JcrProperty data = content.getProperty("jcr:data");
                        if (data.isNew() || data.isModified()) {
                            touch(n);
                        }
                    }
                }
View Full Code Here

    public Rule getRule(String name) {
        if (!hasNode(RULES)) {
            return null;
        } else {
            JcrNode parent = getNode(RULES);
            if (parent.hasNode(name)) {
                Rule rule = Rule.load(parent.getNode(name));
                return rule;
            } else {
                return null;
            }
        }
View Full Code Here

    public List<Rule> getRules(boolean sortByPriority) {
        if (!hasNode(RULES)) {
            return Collections.emptyList();
        } else {
            JcrNode rules = getNode(RULES);
            List<Rule> result = new ArrayList<Rule>();
            JcrNodeIterator n = rules.getNodes();
            while (n.hasNext()) {
                Rule rule = Rule.load(n.nextNode());
                result.add(rule);
            }
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.