Package org.apache.jackrabbit.core.persistence.util.NodePropBundle

Examples of org.apache.jackrabbit.core.persistence.util.NodePropBundle.PropertyEntry


                NameConstants.MIX_CREATED));
        bundle.setReferenceable(true);
        bundle.setSharedSet(new HashSet<NodeId>(Arrays.asList(
                new NodeId(5, 6), new NodeId(7, 8), new NodeId(9, 10))));

        PropertyEntry property;

        property = new PropertyEntry(
                new PropertyId(id, NameConstants.JCR_CREATED));
        property.setType(PropertyType.DATE);
        property.setMultiValued(false);
        Calendar date = Calendar.getInstance();
        date.setTimeInMillis(1234567890);
        property.setValues(new InternalValue[] { InternalValue.create(date) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, NameConstants.JCR_CREATEDBY));
        property.setType(PropertyType.STRING);
        property.setMultiValued(false);
        property.setValues(
                new InternalValue[] { InternalValue.create("test") });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "binary")));
        property.setType(PropertyType.BINARY);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] { InternalValue.create(
                new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "boolean")));
        property.setType(PropertyType.BOOLEAN);
        property.setMultiValued(true);
        property.setValues(new InternalValue[] {
                InternalValue.create(true), InternalValue.create(false) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "date")));
        property.setType(PropertyType.DATE);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] { InternalValue.create(date) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "decimal")));
        property.setType(PropertyType.DECIMAL);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] {
                InternalValue.create(new BigDecimal("1234567890.0987654321")) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "double")));
        property.setType(PropertyType.DOUBLE);
        property.setMultiValued(true);
        property.setValues(new InternalValue[] {
                InternalValue.create(1.0), InternalValue.create(Math.PI) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "long")));
        property.setType(PropertyType.LONG);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] {
                InternalValue.create(1234567890) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "name")));
        property.setType(PropertyType.NAME);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] {
                InternalValue.create(NameConstants.JCR_MIMETYPE) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "path")));
        property.setType(PropertyType.PATH);
        property.setMultiValued(true);
        PathFactory pathFactory = PathFactoryImpl.getInstance();
        Path root = pathFactory.getRootPath();
        Path path = pathFactory.create(root, NameConstants.JCR_SYSTEM, false);
        property.setValues(new InternalValue[] {
                InternalValue.create(root), InternalValue.create(path) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "reference")));
        property.setType(PropertyType.REFERENCE);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] {
                InternalValue.create(new NodeId(11, 12)) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "string")));
        property.setType(PropertyType.STRING);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] {
                InternalValue.create("test") });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "uri")));
        property.setType(PropertyType.URI);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] {
                InternalValue.create(new URI("http://jackrabbit.apache.org/")) });
        bundle.addProperty(property);

        property = new PropertyEntry(
                new PropertyId(id, factory.create("", "weakreference")));
        property.setType(PropertyType.WEAKREFERENCE);
        property.setMultiValued(false);
        property.setValues(new InternalValue[] {
                InternalValue.create(new NodeId(13, 14), true) });
        bundle.addProperty(property);

        bundle.addChildNodeEntry(
                NameConstants.JCR_SYSTEM, new NodeId(15, 16));
View Full Code Here


        NodePropBundle result = binding.readBundle(new ByteArrayInputStream(
                corrupted), NodeId.randomId());
       
        Iterator<PropertyEntry> iterator = result.getPropertyEntries()
                .iterator();
        PropertyEntry pe = iterator.next();
        InternalValue iv = pe.getValues()[0];
        assertEquals(PropertyType.DATE, pe.getType());
        assertEquals(PropertyType.DATE, iv.getType());
        assertEquals("20112022-11-11T19:00:00.000+01:00", iv.getString());

        try {
            iv.getDate();
View Full Code Here

        bundle.setMixinTypeNames(Collections.<Name>emptySet());
        bundle.setSharedSet(Collections.<NodeId>emptySet());

        Name name = factory.create("", "test");

        PropertyEntry property =
            new PropertyEntry(new PropertyId(bundle.getId(), name));
        property.setType(value.getType());
        property.setMultiValued(false);
        property.setValues(new InternalValue[] { value });
        bundle.addProperty(property);

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        binding.writeBundle(buffer, bundle);
        byte[] bytes = buffer.toByteArray();
View Full Code Here

        if (r.nextInt(10) > 0) {
            bundle.setSharedSet(randomNodeIdSet(r));
        }
        int count = randomSize(r);
        for (int i=0; i<count; i++) {
            PropertyEntry p = randomProperty(id, r);
            bundle.addProperty(p);
        }
        count = randomSize(r);
        for (int i=0; i<count; i++) {
            bundle.addChildNodeEntry(randomName(r), randomNodeId(r));
View Full Code Here

        }
        return true;
    }
   
    private static PropertyEntry randomProperty(NodeId nodeId, Random r) {
        PropertyEntry p = new PropertyEntry(
                new PropertyId(nodeId, randomName(r)));       
        int type = PropertyType.STRING;
        if (r.nextInt(10) == 0) {
            type = r.nextInt() + 15;
        }
        p.setType(type);
        p.setModCount((short) randomSize(r));
        boolean multiValued = r.nextBoolean();
        p.setMultiValued(multiValued);
        int size;
        if (multiValued && r.nextInt(10) > 0) {
            size = 1;
        } else {
            size = randomSize(r);
        }
        InternalValue[] values = new InternalValue[size];
        for (int i = 0; i < size; i++) {
            values[i] = randomValue(r);
        }
        p.setValues(values);
        return p;
    }
View Full Code Here

     */
    public PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException {
        NodePropBundle bundle = getBundle(id.getParentId());
        if (bundle != null) {
            PropertyState state = createNew(id);
            PropertyEntry p = bundle.getPropertyEntry(id.getName());
            if (p != null) {
                state.setMultiValued(p.isMultiValued());
                state.setType(p.getType());
                state.setValues(p.getValues());
                state.setModCount(p.getModCount());
            } else if (id.getName().equals(JCR_UUID)) {
                state.setType(PropertyType.STRING);
                state.setMultiValued(false);
                state.setValues(new InternalValue[] {
                        InternalValue.create(id.getParentId().toString()) });
View Full Code Here

     */
    public PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException {
        NodePropBundle bundle = getBundle(id.getParentId());
        if (bundle != null) {
            PropertyState state = createNew(id);
            PropertyEntry p = bundle.getPropertyEntry(id.getName());
            if (p != null) {
                state.setMultiValued(p.isMultiValued());
                state.setType(p.getType());
                state.setValues(p.getValues());
                state.setModCount(p.getModCount());
            } else if (id.getName().equals(JCR_UUID)) {
                state.setType(PropertyType.STRING);
                state.setMultiValued(false);
                state.setValues(new InternalValue[] {
                        InternalValue.create(id.getParentId().toString()) });
View Full Code Here

     */
    public PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException {
        NodePropBundle bundle = getBundle(id.getParentId());
        if (bundle != null) {
            PropertyState state = createNew(id);
            PropertyEntry p = bundle.getPropertyEntry(id.getName());
            if (p != null) {
                state.setMultiValued(p.isMultiValued());
                state.setType(p.getType());
                state.setValues(p.getValues());
                state.setModCount(p.getModCount());
            } else if (id.getName().equals(JCR_UUID)) {
                state.setType(PropertyType.STRING);
                state.setMultiValued(false);
                state.setValues(new InternalValue[] {
                        InternalValue.create(id.getParentId().toString()) });
View Full Code Here

     */
    public PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException {
        NodePropBundle bundle = getBundle(id.getParentId());
        if (bundle != null) {
            PropertyState state = createNew(id);
            PropertyEntry p = bundle.getPropertyEntry(id.getName());
            if (p != null) {
                state.setMultiValued(p.isMultiValued());
                state.setType(p.getType());
                state.setValues(p.getValues());
                state.setModCount(p.getModCount());
            } else if (id.getName().equals(JCR_UUID)) {
                state.setType(PropertyType.STRING);
                state.setMultiValued(false);
                state.setValues(new InternalValue[] {
                        InternalValue.create(id.getParentId().toString()) });
View Full Code Here

     */
    public PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException {
        NodePropBundle bundle = getBundle(id.getParentId());
        if (bundle != null) {
            PropertyState state = createNew(id);
            PropertyEntry p = bundle.getPropertyEntry(id.getName());
            if (p != null) {
                state.setMultiValued(p.isMultiValued());
                state.setType(p.getType());
                state.setValues(p.getValues());
                state.setModCount(p.getModCount());
            } else if (id.getName().equals(JCR_UUID)) {
                state.setType(PropertyType.STRING);
                state.setMultiValued(false);
                state.setValues(new InternalValue[] {
                        InternalValue.create(id.getParentId().toString()) });
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.persistence.util.NodePropBundle.PropertyEntry

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.