Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Batch.addNode()


    }

    private void createTestNode(String testPath) throws RepositoryException {
        Batch b = rs.createBatch(si, getNodeId("/"));
        String name = Text.getName(testPath);
        b.addNode(getNodeId("/"), resolver.getQName(name), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);
    }

    private void removeTestNode(String path) throws RepositoryException {
        Batch b = rs.createBatch(si, getNodeId("/"));
View Full Code Here


        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            QValueFactory qvf = rs.getQValueFactory();
            b.addProperty(getNodeId("/test"), resolver.getQName("prop"), qvf.create("value", PropertyType.STRING));
            b.addProperty(getNodeId("/test"), resolver.getQName("propMV"), new QValue[] {qvf.create(1), qvf.create(2)});
            rs.submit(b);
        }
View Full Code Here

    public void testNodeWithPrimaryItem() throws Exception {
        // create file node
        NodeId nid = getNodeId("/test");
        Name fileName = resolver.getQName("test.txt");
        Batch b = rs.createBatch(si, nid);
        b.addNode(nid, fileName, NameConstants.NT_FILE, null);

        String filePath = testPath + "/" + fileName.getLocalName();
        NodeId fileID = getNodeId(filePath);
        b.addNode(fileID, NameConstants.JCR_CONTENT, NameConstants.NT_RESOURCE, null);
View Full Code Here

        Batch b = rs.createBatch(si, nid);
        b.addNode(nid, fileName, NameConstants.NT_FILE, null);

        String filePath = testPath + "/" + fileName.getLocalName();
        NodeId fileID = getNodeId(filePath);
        b.addNode(fileID, NameConstants.JCR_CONTENT, NameConstants.NT_RESOURCE, null);

        NodeId content = getNodeId(filePath + "/" + NameConstants.JCR_CONTENT);

        QValue lastModified = rs.getQValueFactory().create(Calendar.getInstance());
        QValue mimeType = rs.getQValueFactory().create("text/plain", PropertyType.STRING);
View Full Code Here

        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            rs.submit(b);
        }
    }

    @Override
View Full Code Here

        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            rs.submit(b);
        }

        // todo: retrieve second wsp-name from config
        sInfo = rs.obtain(si, "test");
View Full Code Here

        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            rs.submit(b);
        }
    }

    @Override
View Full Code Here

        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            rs.submit(b);
        }

        lastModified = rs.getQValueFactory().create(Calendar.getInstance());
        mimeType = rs.getQValueFactory().create("text/plain", PropertyType.STRING);
View Full Code Here

    private void createFile(Name fileName) throws RepositoryException, IOException {
        NodeId root = getNodeId(testPath);

        Batch b = rs.createBatch(si, root);
        b.addNode(root, fileName, NameConstants.NT_FILE, null);

        String filePath = testPath + "/" + fileName.getLocalName();
        NodeId file = getNodeId(filePath);
        b.addNode(file, NameConstants.JCR_CONTENT, NameConstants.NT_RESOURCE, null);
View Full Code Here

        Batch b = rs.createBatch(si, root);
        b.addNode(root, fileName, NameConstants.NT_FILE, null);

        String filePath = testPath + "/" + fileName.getLocalName();
        NodeId file = getNodeId(filePath);
        b.addNode(file, NameConstants.JCR_CONTENT, NameConstants.NT_RESOURCE, null);

        NodeId content = getNodeId(filePath + "/" + NameConstants.JCR_CONTENT);
        b.addProperty(content, resolver.getQName(JcrConstants.JCR_LASTMODIFIED), lastModified);
        b.addProperty(content, resolver.getQName(JcrConstants.JCR_MIMETYPE), mimeType);
        b.addProperty(content, resolver.getQName(JcrConstants.JCR_ENCODING), enc);
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.