Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Batch


        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("doubleProp");

        QValue v = rs.getQValueFactory().create(234567);

        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


        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("dateProp");

        QValue v = rs.getQValueFactory().create(Calendar.getInstance());

        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

        l.add("String value containing \n>line sep \r+and \r\n-diff\n\r^chars.");
        l.add("String value containing \u0633\u0634 unicode chars.");

        for (String val : l) {
            QValue v = vf.create(val, PropertyType.STRING);
            Batch b = rs.createBatch(si, nid);
            b.addProperty(nid, propName, v);
            rs.submit(b);

            PropertyInfo pi = getPropertyInfo(nid, propName);
            assertEquals(v, pi.getValues()[0]);
            assertEquals(v.getString(), pi.getValues()[0].getString());
View Full Code Here

                rs.getQValueFactory().create(NameConstants.JCR_DEFAULTPRIMARYTYPE),
                rs.getQValueFactory().create(NameConstants.MIX_LOCKABLE),
                rs.getQValueFactory().create(NameConstants.JCR_PRIMARYTYPE),
                rs.getQValueFactory().create(NameConstants.NT_VERSION)
        };
        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 testSetPathValue() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("pathProp");

        QValue v = rs.getQValueFactory().create(resolver.getQPath(testPath));
        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

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

        QValue v = rs.getQValueFactory().create(false);
        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());
        assertFalse(pi.getValues()[0].getBoolean());
View Full Code Here

    public void testSetReferenceValue() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        NodeInfo nInfo = rs.getNodeInfo(si, nid);
        if (!Arrays.asList(nInfo.getMixins()).contains(NameConstants.MIX_REFERENCEABLE)) {
            Batch b = rs.createBatch(si, nid);
            b.setMixins(nid, new Name[] {NameConstants.MIX_REFERENCEABLE});
            rs.submit(b);
        }

        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

    public void testSetWeakReferenceValue() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        NodeInfo nInfo = rs.getNodeInfo(si, nid);
        if (!Arrays.asList(nInfo.getMixins()).contains(NameConstants.MIX_REFERENCEABLE)) {
            Batch b = rs.createBatch(si, nid);
            b.setMixins(nid, new Name[] {NameConstants.MIX_REFERENCEABLE});
            rs.submit(b);
        }

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

        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));
        assertFalse(pi.isMultiValued());
        assertEquals(1, pi.getValues().length);
View Full Code Here

        assertEquals(PropertyType.NAME, pi.getType());
    }

    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);
            fail();
        } catch (IllegalStateException e) {
            // success
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.Batch

Copyright © 2018 www.massapicom. 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.