Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.QName


                // the exact version stored in the record. However, this doesn't make any difference, since
                // we just need the name of the record type, which is the same for all versions. The reason
                // why reading the last version is preferred is because at the time of this writing, only
                // the last version of record types is cached, and this makes an enormous difference in
                // record read or scan speed.
                QName recordTypeName =
                        typeManager.getRecordTypeById(recordTypePair.getV1(), null).getName();
                record.setRecordType(scope, recordTypeName, recordTypePair.getV2());
                if (readContext != null) {
                    readContext.setRecordTypeId(scope, recordTypePair.getV1());
                }
View Full Code Here


        ObjectNode node = (ObjectNode)nodeNode;

        namespaces = NamespacesConverter.fromContextJson(node, namespaces);

        QName name = QNameConverter.fromJson(getString(node, "name"), namespaces);


        String scopeName = getString(node, "scope", "non_versioned");
        Scope scope = parseScope(scopeName);
View Full Code Here

        this.recordTypeIds = recordTypeIds;
    }

    @Override
    public <T> T getField(SchemaId fieldId) throws FieldNotFoundException {
        QName qname = mapping.get(fieldId);
        if (qname == null) {
            throw new FieldNotFoundException(fieldId);
        }
        // The cast to (T) is only needed for a bug in JDK's < 1.6u24
        return (T)record.getField(qname);
View Full Code Here

        return (T)record.getField(qname);
    }

    @Override
    public boolean hasField(SchemaId fieldId) {
        QName qname = mapping.get(fieldId);
        if (qname == null) {
            return false;
        }
        // Normally, we will only have a mapping for fields which are actually in the record,
        // but just to be sure:
View Full Code Here

        repoSetup.setupRepository();

        repository = repoSetup.getRepositoryManager().getDefaultRepository();
        typeManager = repository.getTypeManager();

        stringField = typeManager.createFieldType("STRING", new QName("ns", "string"), Scope.NON_VERSIONED);
        FieldType booleanField = typeManager.createFieldType("BOOLEAN", new QName("ns", "bool"), Scope.NON_VERSIONED);
        FieldType intField = typeManager.createFieldType("INTEGER", new QName("ns", "int"), Scope.NON_VERSIONED);

        typeManager.recordTypeBuilder()
                .defaultNamespace("ns1")
                .name("typeA")
                .field(stringField.getId(), false)
                .create();

        typeManager.recordTypeBuilder()
                .defaultNamespace("ns1")
                .name("typeB")
                .field(stringField.getId(), false)
                .create();

        typeManager.recordTypeBuilder()
                .defaultNamespace("ns2")
                .name("typeA")
                .field(stringField.getId(), false)
                .create();

        typeManager.recordTypeBuilder()
                .defaultNamespace("ns2")
                .name("typeB")
                .field(stringField.getId(), false)
                .create();

        vtag1 = typeManager.createFieldType("LONG", new QName("org.lilyproject.vtag", "vtag1"),
                Scope.NON_VERSIONED);

        vtag2 = typeManager.createFieldType("LONG", new QName("org.lilyproject.vtag", "vtag2"),
                Scope.NON_VERSIONED);
    }
View Full Code Here

                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record recordTypeA = newRecordOfType(new QName("ns1", "typeA"));
        Record recordTypeB = newRecordOfType(new QName("ns1", "typeB"));

        assertEquals(ImmutableSet.of(vtag1.getId()),
                idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordTypeA).getVersionTags());
        assertEquals(ImmutableSet.of(vtag2.getId()),
                idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordTypeB).getVersionTags());
View Full Code Here

                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record recordNs1TypeA = newRecordOfType(new QName("ns1", "typeA"));
        Record recordNs2TypeA = newRecordOfType(new QName("ns2", "typeA"));

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs1TypeA));
        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs2TypeA));
    }
View Full Code Here

                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record recordNs1TypeB = newRecordOfType(new QName("ns1", "typeB"));
        Record recordNs2TypeB = newRecordOfType(new QName("ns2", "typeB"));
        Record recordNs1TypeC = newRecordOfType(new QName("ns1", "typeC"));
        Record recordNs2TypeC = newRecordOfType(new QName("ns2", "typeC"));
        Record recordNs1TypeA = newRecordOfType(new QName("ns1", "typeA"));

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs1TypeA));

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs1TypeB));
        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs2TypeB));
View Full Code Here

                .field(stringField.getId(), false)
                .update();

        // Create a record of type rt3 and check that this record is instanceOf any type in the hierarchy,
        // except rt6 which is outside of the hierarchy
        Record record = newRecordOfType(new QName("ns1", "rt3"));

        for (String rt : Lists.newArrayList("rt1", "rt2", "rt3", "rt4", "rt5", "rt6")) {
            String conf = makeIndexerConf(
                    "xmlns:ns1='ns1'",
                    Lists.newArrayList(
View Full Code Here

        //
        // Test string field
        //
        Record zeus = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "zeus")
                .field(new QName("ns", "bool"), Boolean.TRUE)
                .field(new QName("ns", "int"), 5)
                .build();

        Record hera = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "hera")
                .field(new QName("ns", "int"), 10)
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, hera));
        assertEquals(ImmutableSet.of(vtag1.getId()), idxConf.getRecordFilter()
                        .getIndexCase(Table.RECORD.name, zeus).getVersionTags());

        //
        // Test boolean field
        //
        Record trueRecord = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "bool"), Boolean.TRUE)
                .build();

        Record falseRecord = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "bool"), Boolean.FALSE)
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, falseRecord));
        assertEquals(ImmutableSet.of(vtag2.getId()),
                idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, trueRecord).getVersionTags());
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.