Package javax.jcr

Examples of javax.jcr.Session.importXML()


        Session s = getTestSession();
        String parentPath = childNode.getPath();

        checkReadOnly(parentPath);
        try {
            s.importXML(parentPath, getXmlForImport(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
            s.save();
            fail("Missing write privilege.");
        } catch (AccessDeniedException e) {
            // success
        } finally {
View Full Code Here


        }

        // with simple write privilege moving a node is not allowed.
        modifyPrivileges(parentPath, Privilege.JCR_WRITE, true);
        try {
            s.importXML(parentPath, getXmlForImport(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
            s.save();
            fail("Missing privilege jcr:nodeTypeManagement.");
        } catch (AccessDeniedException e) {
            // success
        } finally {
View Full Code Here

            s.refresh(false);
        }

        // adding jcr:nodeTypeManagement privilege will grant permission to move.
        modifyPrivileges(parentPath, PrivilegeRegistry.REP_WRITE, true);
        s.importXML(parentPath, getXmlForImport(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
        s.save();
    }

    public void testWorkspaceImportXML() throws RepositoryException, NotExecutableException, IOException {
        Workspace wsp = getTestSession().getWorkspace();
View Full Code Here

                        }
                    } else {
                        String xml = createXMLFragment(jcrName, ntName, uuid);
                        InputStream in = new ByteArrayInputStream(xml.getBytes());
                        try {
                            s.importXML(parent.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
                        } catch (IOException e) {
                            throw new RepositoryException(e.getMessage(), e);
                        }
                    }
                    return null;
View Full Code Here

        }

        // and import again underneath /a3
        InputStream in = new FileInputStream(tmpFile);
        try {
            session.importXML(a3.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
            session.save();
        } finally {
            in.close();
        }
View Full Code Here

        }

        // and import again underneath /a3
        InputStream in = new FileInputStream(tmpFile);
        try {
            session.importXML(a3.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
            session.save();
        } finally {
            in.close();
        }
View Full Code Here

                        }
                    } else {
                        String xml = createXMLFragment(jcrName, ntName, uuid);
                        InputStream in = new ByteArrayInputStream(xml.getBytes());
                        try {
                            s.importXML(parent.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
                        } catch (IOException e) {
                            throw new RepositoryException(e.getMessage(), e);
                        }
                    }
                    return null;
View Full Code Here

                return parent.getNode(name);
            }

            ins = nodeXML.openStream();
            Session session = parent.getSession();
            session.importXML(parent.getPath(), ins, IMPORT_UUID_CREATE_NEW);

            // additionally check whether the expected child node exists
            return (parent.hasNode(name)) ? parent.getNode(name) : null;

        } catch (InvalidSerializedDataException isde) {
View Full Code Here

        String uuid = node.getIdentifier();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        session.exportSystemView("/node", out, true, false);
        node.remove();
        session.save();
        session.importXML("/", new ByteArrayInputStream(out.toByteArray()),
                ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
        session.save();
        node = session.getNode("/node");
        assertFalse(uuid.equals(node.getIdentifier()));
    }
View Full Code Here

        }

        // and import again underneath /a3
        InputStream in = new FileInputStream(tmpFile);
        try {
            session.importXML(a3.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
            session.save();
        } finally {
            try { in.close(); } catch (IOException ignore) {}
        }
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.