Package javax.jcr

Examples of javax.jcr.Session.save()


                        }
                    } else {
                        // replace property with an nt:file node (if possible)
                        parentNode = item.getParent();
                        item.remove();
                        session.save();
                        fileNode = parentNode.addNode(name, "nt:file");
                    }
                } else {
                    if (lastPos <= 0) {
                        parentNode = session.getRootNode();
View Full Code Here


                contentNode.setProperty("jcr:lastModified", System.currentTimeMillis());
                contentNode.setProperty("jcr:data", new ByteArrayInputStream(buf, 0, size()));
                contentNode.setProperty("jcr:mimeType", mimeType);

                session.save();
                this.repositoryOutputProvider.handleChangeEvent(fileName);
            } catch (final RepositoryException re) {
                throw (IOException)new IOException("Cannot write file " + fileName + ", reason: " + re.toString()).initCause(re);
            } finally {
                if ( session != null ) {
View Full Code Here

            final Principal testUserPrincipal = new Principal() {
                public String getName() {
                    return "testUser";
                }};
               
            session.save();

        } catch (Exception e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }
    }
View Full Code Here

        Session session = resourceResolver.adaptTo(Session.class);
        testPath = "/test_" + new Date().getTime();
        Node testNode = session.getRootNode().addNode(testPath.substring(1), "nt:unstructured");
        testNode.setProperty("sling:resourceType", new String[] { "foo/bar", "bar/foo" });
        session.save();
    }
   
    @Test
    public void test() {
        Resource res = resourceResolver.resolve(testPath);
View Full Code Here

                // write content from form
                writeContent(selfRegSession, user, reqProperties, changes);

                if (selfRegSession.hasPendingChanges()) {
                    selfRegSession.save();
                }

                if (useAdminSession) {
                    //lookup the user from the user session so we can return a live object
                    UserManager userManager2 = AccessControlUtil.getUserManager(jcrSession);
View Full Code Here

    @After
    public void teardown() throws Exception {
        Session session = resourceResolver.adaptTo(Session.class);
        Node testNode = session.getNode(testPath);
        testNode.remove();
        session.save();
    }

}
View Full Code Here

        s = repository.loginAdministrative(null);
        try {

            final Node n = s.getNode(path);
            n.setProperty("sling:message", "CHANGED now");
            s.save();

            final JcrEventsCounter c = counter;
            new Retry(5000) {
                @Override
                protected void exec() throws Exception {
View Full Code Here

            // modify
            final Node modified = session.getNode(pathToModify);
            modified.setProperty("foo", "bar");

            session.save();

            // delete
            final Node deleted = session.getNode(pathToDelete);
            deleted.remove();
            session.save();
View Full Code Here

            session.save();

            // delete
            final Node deleted = session.getNode(pathToDelete);
            deleted.remove();
            session.save();

            Thread.sleep(3500);

        } finally {
            session.logout();
View Full Code Here

        ContentReader reader = ip.getReader();
        reader.parse(contentStream, contentCreator);

        // save changes
        Session session = parent.getSession();
        session.save();

        // finally checkin versionable nodes
        for (final Node versionable : contentCreator.getVersionables()) {
            versionable.checkin();
            if (importListener != null) {
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.