Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.QName


            }
        } else if (!id.equals(other.id)) {
            return false;
        }

        QName nonVersionedRT1 = getRecordTypeName(Scope.NON_VERSIONED);
        QName nonVersionedRT2 = other.getRecordTypeName(Scope.NON_VERSIONED);

        if (nonVersionedRT1 != null && nonVersionedRT2 != null && !nonVersionedRT1.equals(nonVersionedRT2)) {
            return false;
        }
View Full Code Here


        record.setVersion(1L);
        record.setField(fieldType6.getName(), "value2");
        record = repository.update(record, true, true);

        // Change record to a different record type
        RecordType recordTypeA = typeManager.newRecordType(new QName("testmut", "RTA"));
        recordTypeA.addFieldTypeEntry(fieldType4.getId(), false);
        recordTypeA.addFieldTypeEntry(fieldType5.getId(), false);
        recordTypeA.addFieldTypeEntry(fieldType6.getId(), false);
        recordTypeA = typeManager.createRecordType(recordTypeA);
View Full Code Here

        this.defaultNamespace = namespace;
    }

    private QName resolveNamespace(String name) throws RecordException {
        if (defaultNamespace != null) {
            return new QName(defaultNamespace, name);
        }

        QName recordTypeName = getRecordTypeName();
        if (recordTypeName != null) {
            return new QName(recordTypeName.getNamespace(), name);
        }

        throw new RecordException("Namespace could not be resolved for name '" + name +
            "' since no default namespace was given and no record type is set.");
    }
View Full Code Here

        //
        // Test on system fields
        //

        final QName versionField = new QName("org.lilyproject.system", "version");

        // Create new record to be sure numbering starts from 1
        record = createDefaultRecord();

        record.setField(fieldType2.getName(), new Integer(55));
View Full Code Here

    }

    @Test
    public void testRecordWithLinkFields() throws Exception {
        FieldType linkFieldType = typeManager.createFieldType(typeManager
                .newFieldType(typeManager.getValueType("LINK"), new QName("testRecordWithLinkFields", "linkFieldType"),
                        Scope.NON_VERSIONED));

        RecordType recordTypeWithLink = typeManager.newRecordType(new QName(namespace, "recordTypeWithLink"));
        recordTypeWithLink.addFieldTypeEntry(typeManager.newFieldTypeEntry(linkFieldType.getId(), false));
        recordTypeWithLink = typeManager.createRecordType(recordTypeWithLink);

        // Create records to link to
        Record record = createDefaultRecord();
View Full Code Here

    }

    @Test
    public void testRecordValueType() throws Exception {
        String namespace = "testRecordValueType";
        QName rvtRTName = new QName(namespace, "rvtRT");
        QName rtName = new QName(namespace, "rt");
        QName ft1Name = new QName(namespace, "ft1");
        QName ft2Name = new QName(namespace, "ft2");
        QName ft3Name = new QName(namespace, "ft3");
        typeManager.recordTypeBuilder().name(rvtRTName).field(fieldType1.getId(), false).create();
        ValueType rvt = typeManager.getValueType("RECORD<" + rvtRTName.toString() + ">");
        FieldType ft1 = typeManager.createFieldType(typeManager.newFieldType(rvt, ft1Name, Scope.NON_VERSIONED));
        FieldType ft2 = typeManager.createFieldType(typeManager.newFieldType(rvt, ft2Name, Scope.VERSIONED));
        FieldType ft3 = typeManager.createFieldType(typeManager.newFieldType(rvt, ft3Name, Scope.VERSIONED_MUTABLE));
View Full Code Here

    }

    @Test
    public void testRecordNestedInItself() throws Exception {
        String namespace = "testRecordNestedInItself";
        QName rvtRTName = new QName(namespace, "rvtRT");
        QName rtName = new QName(namespace, "rt");
        QName ft1Name = new QName(namespace, "ft1");
        QName ft2Name = new QName(namespace, "ft2");

        typeManager.recordTypeBuilder().name(rvtRTName).field(fieldType1.getId(), false).create();
        ValueType rvt = typeManager.getValueType("RECORD");
        FieldType ft1 = typeManager.createFieldType(typeManager.newFieldType(rvt, ft1Name, Scope.NON_VERSIONED));
        FieldType ft2 = typeManager.createFieldType(typeManager.newFieldType(rvt, ft2Name, Scope.VERSIONED));
View Full Code Here

        }
    }

    @Test
    public void testByteArrayValueType() throws Exception {
        FieldType byteArrayValueType = typeManager.createFieldType("BYTEARRAY", new QName("testByteArrayValueType",
                "field1"), Scope.NON_VERSIONED);
        RecordType recordType = typeManager.recordTypeBuilder().defaultNamespace("testByteArrayValueType")
                .name("recordType1")
                .field(byteArrayValueType.getId(), false).create();
        Record record = repository.recordBuilder().defaultNamespace("testByteArrayValueType").recordType("recordType1")
                .field("field1", new ByteArray(Bytes.toBytes("some bytes"))).create();
        Record readRecord = repository.read(record.getId());
        ByteArray readValue = readRecord.getField(new QName("testByteArrayValueType", "field1"));
        assertEquals("some bytes", Bytes.toString(readValue.getBytesUnsafe()));
    }
View Full Code Here

    }

    @Test
    public void testFieldValueFilter() throws Exception {
        FieldType fieldType =
                typeManager.createFieldType("STRING", new QName("FieldValueFilter", "field"), Scope.NON_VERSIONED);
        RecordType rt = typeManager.recordTypeBuilder()
                .defaultNamespace("FieldValueFilter")
                .name("rt1")
                .fieldEntry()
                .use(fieldType)
View Full Code Here

        assertEquals(3, countResults(repository.getScanner(scan)));
    }

    @Test
    public void testFilterList() throws Exception {
        FieldType f1 = typeManager.createFieldType("STRING", new QName("FilterList", "field1"), Scope.NON_VERSIONED);
        FieldType f2 = typeManager.createFieldType("STRING", new QName("FilterList", "field2"), Scope.NON_VERSIONED);

        RecordType rt = typeManager.recordTypeBuilder().defaultNamespace("FilterList").name("rt")
                .fieldEntry().use(f1).add().fieldEntry().use(f2).add().create();

        repository.recordBuilder()
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.QName

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.