Package org.brixcms.jcr.api

Examples of org.brixcms.jcr.api.JcrNode


                            nodes, targetWorkspace);
                    ;
                    if (!dependencies.isEmpty()) {
                        message.setDefaultModelObject(getDependenciesMessage(dependencies));
                    } else {
                        JcrNode rootNode = targetNode.getObject();
                        if (rootNode == null) {
                            rootNode = targetWorkspace.getSession().getRootNode();
                        }
                        PrototypePlugin.get().restoreNodes(nodes, rootNode);
                        findParent(ModalWindow.class).close(target);
View Full Code Here


    @SuppressWarnings("unchecked")
    protected List<JcrNode> getSelectedNodes() {
        List<JcrNode> nodes = new ArrayList<JcrNode>();
        for (IModel<JcrTreeNode> model : getTreeGrid().getSelectedItems()) {
            JcrTreeNode treeNode = model.getObject();
            JcrNode node = treeNode.getNodeModel() != null ? treeNode.getNodeModel().getObject() : null;
            if (node != null)
                nodes.add(node);
        }

        return nodes;
View Full Code Here

            .synchronizedList(new ArrayList<SaveEventListener>());

    public static void raiseSaveEvent(Node node) {
        try {
            JcrSession session = JcrSession.Wrapper.wrap(node.getSession(), null);
            JcrNode wrapped = JcrNode.Wrapper.wrap(node, session);
            raiseSaveEvent(wrapped);
        } catch (RepositoryException e) {
            throw new JcrException(e);
        }
    }
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public String getObject() {
            // get the tile's jcr node and retrieve the format expression
            JcrNode tileNode = this.tileNode.getObject();
            String format = tileNode.hasProperty("format") ? tileNode.getProperty("format")
                    .getString() : null;

            // create the time expression
            if (format == null) {
                format = "MM/dd/yyyy HH:mm:ss z";
View Full Code Here

        form.add(new ContainerFeedbackPanel("feedback", this));

        form.add(new Button("save") {
            @Override
            public void onSubmit() {
                JcrNode node = nodeModel.getObject();
                node.checkout();
                adapter.apply();
                node.save();
                node.checkin();

                getSession().info(getString("status.saved"));
                goBack();
            }
        });
View Full Code Here

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

    private void createPage(String type) {
        final JcrNode parent = getModelObject();

        if (parent.hasNode(name)) {
            String error = getString("resourceExists", new Model<CreatePageOrTemplatePanel>(
                    CreatePageOrTemplatePanel.this));
            error(error);
        } else {
            JcrNode page = parent.addNode(name, "nt:file");

            AbstractContainer node;

            node = initializePage(type, page);
View Full Code Here

     *                               cloned nodes
     */
    public static void cloneNodes(List<JcrNode> nodes, TargetRootNodeProvider targetRootNodeProvider,
                                  ParentLimiter parentLimiter) {
        if (nodes != null && !nodes.isEmpty()) {
            JcrNode firstTargetRoot = targetRootNodeProvider.getTargetRootNode(nodes.iterator().next());
            String xmlns = createXMLNS(firstTargetRoot.getSession());
            Map<String, String> uuidMap = new HashMap<String, String>();

            nodes = filterRedundantNodes(nodes);

            List<NodePair> processedNodes = new ArrayList<NodePair>();

            for (JcrNode node : nodes) {
                JcrNode targetRoot = targetRootNodeProvider.getTargetRootNode(node);
                createNode(node, targetRoot, xmlns, uuidMap, processedNodes, parentLimiter);
            }

            assignProperties(processedNodes, uuidMap);
        }
View Full Code Here

     * @param nodes
     * @param parentLimiter
     */
    private static void createNode(JcrNode originalNode, JcrNode targetRootNode, String xmlns,
                                   Map<String, String> uuidMap, List<NodePair> nodes, ParentLimiter parentLimiter) {
        JcrNode targetParent = ensureParentExists(originalNode, targetRootNode, parentLimiter, xmlns, uuidMap);

        createNodeAndChildren(originalNode, targetParent, xmlns, uuidMap, nodes);
    }
View Full Code Here

     * @param node
     * @return
     */
    private static List<JcrNode> getParents(JcrNode node, ParentLimiter parentLimiter) {
        List<JcrNode> result = new ArrayList<JcrNode>();
        JcrNode p = node.getParent();
        while (p.getDepth() > 0 && (parentLimiter == null || !parentLimiter.isFinalParent(node, p))) {
            result.add(0, p);
            p = p.getParent();
        }
        return result;
    }
View Full Code Here

    }

    private static JcrNode cloneNode(JcrNode originalNode, JcrNode targetParent, String xmlns,
                                     Map<String, String> uuidMap) {
        // create node
        JcrNode targetNode;
        if (originalNode.isNodeType("mix:referenceable")) {
            targetNode = createNodeWithUUID(originalNode, targetParent, xmlns, uuidMap);
        } else {
            targetNode = targetParent.addNode(originalNode.getName(), originalNode.getPrimaryNodeType().getName());
        }

        // set mixin types
        NodeType[] mixins = originalNode.getMixinNodeTypes();
        for (NodeType type : mixins) {
            if (type.getName().equals("mix:referenceable") == false) {
                targetNode.addMixin(type.getName());
            }
        }
        return targetNode;
    }
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.