Package javax.jcr

Examples of javax.jcr.Session.save()


        CndImporter.registerNodeTypes(new InputStreamReader(cndInput), session);

        try {
            Node content = session.getRootNode().addNode("content", "nt:unstructured");

            session.save();

            ResourceProxy resource = newResource("/content", "custom");
            resource.getProperties().put("attribute", "some value");

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
View Full Code Here


            content = session.getRootNode().getNode("content");
            assertThat(content.getPrimaryNodeType().getName(), equalTo("custom"));

        } finally {
            session.removeItem("/content");
            session.save();
            session.logout();

            IOUtils.closeQuietly(cndInput);
        }
    }
View Full Code Here

        // }

        Session session = login();
        if (session.nodeExists(path)) {
            session.removeItem(path);
            session.save();
        }
    }

    public Node getNode(String nodePath) throws RepositoryException {
View Full Code Here

                return;
            }

            Node parent = session.getNode(Text.getRelativeParent(path, 1));
            parent.addNode(Text.getName(path), primaryNodeType);
            session.save();
        } finally {
            session.logout();
        }
    }
View Full Code Here

            Node parent = session.getNode(Text.getRelativeParent(path, 1));
            Node resourceNode = parent.addNode(Text.getName(path), "nt:file");
            Node contentNode = resourceNode.addNode("jcr:content", "nt:resource");
            contentNode
                    .setProperty("jcr:data", session.getValueFactory().createBinary(new ByteArrayInputStream(bytes)));
            session.save();
        } finally {
            session.logout();
        }
    }
   
View Full Code Here

            Session session = null;
            try {
                session = this.repository.loginAdministrative(null);
                if ( session.itemExists(path) ) {
                    session.getItem(path).remove();
                    session.save();
                }
            } catch (final RepositoryException re) {
                logger.error("Unable to remove resource from " + path, re);
                return null;
            } finally {
View Full Code Here

            dataNode.setProperty(PROP_DATA, new ByteArrayInputStream(baos.toByteArray()));
            dataNode.setProperty(PROP_MODIFIED, Calendar.getInstance());
            dataNode.setProperty(PROP_ENC, ENCODING);
            dataNode.setProperty(PROP_MIME, MIME_TXT);
            session.save();

            final UpdateResult result = new UpdateResult(JcrInstaller.URL_SCHEME + ':' + path);
            // priority
            final int lastSlash = path.lastIndexOf('/');
            final String parentPath = path.substring(0, lastSlash);
View Full Code Here

            for (String nodeName : nodeNames) {
                content.addNode(nodeName);
            }

            session.save();

            ResourceProxy resource = newResource("/content", "nt:unstructured");

            for (String resourceName : resourceNames) {
                resource.addChild(newResource("/content/" + resourceName, "nt:unstructured"));
View Full Code Here

            while (nodes.hasNext()) {
                finalOrder.add(nodes.nextNode().getName());
            }
        } finally {
            session.removeItem("/content");
            session.save();
            session.logout();
        }

        assertThat("Incorrect node order", finalOrder, equalTo(expected));
    }
View Full Code Here

            if ("create".equals(action)) {
                Node testing = JcrUtils.getOrAddNode(session.getRootNode(), "testing", "nt:unstructured");
                Node servlet = JcrUtils.getOrAddNode(testing, "PathsServlet", "nt:unstructured");
                JcrUtils.getOrAddNode(servlet, "foo", "nt:unstructured");
                if (session.hasPendingChanges()) {
                    session.save();
                    response.setStatus(HttpServletResponse.SC_CREATED);
                }
            } else if ("delete".equals(action)) {
                if (session.nodeExists("/testing/PathsServlet/foo")) {
                    session.getNode("/testing/PathsServlet/foo").remove();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.