Package org.apache.jackrabbit.spi

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


        String ref = rs.getNodeInfo(si, nid).getId().getUniqueID();
        Name propName = resolver.getQName("refProp");
        QValue v = rs.getQValueFactory().create(ref, PropertyType.REFERENCE);

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, v);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertFalse(pi.isMultiValued());
        assertEquals(v, pi.getValues()[0]);
View Full Code Here


        QValue v = rs.getQValueFactory().create(NameConstants.JCR_AUTOCREATED);
        QValue v2 = rs.getQValueFactory().create(NameConstants.JCR_BASEVERSION);
        QValue v3 = rs.getQValueFactory().create(NameConstants.JCR_CONTENT);

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, v);
        b.setValue(pid, v2);
        b.setValue(pid, v3);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
View Full Code Here

    }

    public void testUseConsumedBatch() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, resolver.getQName("any"), rs.getQValueFactory().create(1.34));
        rs.submit(b);

        try {
            b.remove(nid);
            rs.submit(b);
View Full Code Here

        NodeId nid = getNodeId(testPath);
        Batch b = rs.createBatch(si, nid);

        NodeId id = getNodeId(testPath + "/aTestNode");
        b.addNode(nid, resolver.getQName("aTestNode"), NameConstants.NT_UNSTRUCTURED, null);
        b.addProperty(id, resolver.getQName("aString"), rs.getQValueFactory().create("ba", PropertyType.STRING));
        rs.submit(b);

        PropertyId pid = getPropertyId(id, resolver.getQName("aString"));
        b = rs.createBatch(si, nid);
        b.remove(pid);
View Full Code Here

    public void testEmptyValueArray() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("mvProperty");

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, new QValue[0]);
        rs.submit(b);

        PropertyId pid = getPropertyId(nid, propName);
        PropertyInfo pi = rs.getPropertyInfo(si, pid);
        assertTrue(pi.isMultiValued());
View Full Code Here

    public void testEmptyValueArray2() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("mvProperty");

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, new QValue[] { rs.getQValueFactory().create(true)});
        rs.submit(b);

        PropertyId pid = getPropertyId(nid, propName);
        b = rs.createBatch(si, pid);
        b.setValue(pid, new QValue[0]);
View Full Code Here

        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("mvProperty2");
        QValue[] vs = new QValue[] {rs.getQValueFactory().create(111), rs.getQValueFactory().create(222), rs.getQValueFactory().create(333)};

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, vs);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertTrue(pi.isMultiValued());
        assertEquals(Arrays.asList(vs), Arrays.asList(pi.getValues()));
View Full Code Here

    public void testSetBinaryValue() throws RepositoryException, IOException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("binProp");

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[] {'a', 'b', 'c'}));
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertFalse(pi.isMultiValued());
        assertEquals("abc", pi.getValues()[0].getString());
View Full Code Here

    public void testSetEmptyBinaryValue() throws RepositoryException, IOException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("binProp");

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[0]));
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertFalse(pi.isMultiValued());
        InputStream in = pi.getValues()[0].getStream();
View Full Code Here

        QValue[] vs = new QValue[] {
                rs.getQValueFactory().create(new byte[] {'a', 'b', 'c'}),
                rs.getQValueFactory().create(new byte[] {'d', 'e', 'f'}),
                rs.getQValueFactory().create(new byte[] {'g', 'h', 'i'})
        };
        b.addProperty(nid, propName, vs);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertTrue(pi.isMultiValued());
        vs = pi.getValues();
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.