Package org.apache.isis.objectstore.xml.internal.data

Examples of org.apache.isis.objectstore.xml.internal.data.ObjectData


        }
    }

    @Test
    public void testWriteReadTypeOidAndVersion() {
        final ObjectData data = createData(Role.class, 99, FileVersion.create("user", 19));
        manager.insertObject(data);

        final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());

        assertEquals(data.getRootOid(), read.getRootOid());
        assertEquals(data.getObjectSpecId(), read.getObjectSpecId());
        assertEquals(data.getVersion(), read.getVersion());
    }
View Full Code Here


        assertEquals(first + 3, manager.nextId());
    }

    @Test
    public void testInsertObjectWithFields() throws ObjectPersistenceException {
        final ObjectData data = createData(Role.class, 99, FileVersion.create("user", 13));
        data.set("Person", RootOidDefault.create(ObjectSpecId.of("RLE"), ""+101));
        assertNotNull(data.get("Person"));
        data.set("Name", "Harry");
        assertNotNull(data.get("Name"));

        manager.insertObject(data);

        final ObjectData read = (ObjectData) manager.loadData(data.getRootOid());
        assertEquals(data.getRootOid(), read.getRootOid());
        assertEquals(data.getObjectSpecId(), read.getObjectSpecId());

        assertEquals(data.get("Person"), read.get("Person"));
        assertEquals(data.get("Name"), read.get("Name"));
    }
View Full Code Here

    // /////////////////////////////////////////////////////////

    @Override
    public boolean hasInstances(final ObjectSpecification cls) {
        LOG.debug("checking instance of " + cls);
        final ObjectData data = new ObjectData(RootOidDefault.create(cls.getSpecId(), "---dummy-value-never-used---"), null);
        return dataManager.numberOfInstances(data) > 0;
    }
View Full Code Here

        resolveImmediately(reference);
    }

    @Override
    public void resolveImmediately(final ObjectAdapter object) {
        final ObjectData data = (ObjectData) dataManager.loadData((RootOidDefault) object.getOid());
        Assert.assertNotNull("Not able to read in data during resolve", object, data);
        initObject(object, data);
    }
View Full Code Here

        final PersistenceQueryBuiltIn builtIn = (PersistenceQueryBuiltIn) persistenceQuery;

        final ObjectSpecification objSpec = builtIn.getSpecification();
        LOG.debug("getInstances of " + objSpec + " where " + builtIn);
        final RootOid oid = RootOidDefault.create(objSpec.getSpecId(), "dummy");
        final ObjectData patternData = new ObjectData(oid, null);
        return getInstances(patternData, builtIn);
    }
View Full Code Here

    private List<ObjectAdapter> getInstances(final ObjectData patternData, final PersistenceQueryBuiltIn persistenceQuery) {
        final ObjectDataVector data = dataManager.getInstances(patternData);
        final List<ObjectAdapter> instances = Lists.newArrayList();
       
        for (int i = 0; i < data.size(); i++) {
            final ObjectData instanceData = data.element(i);
            if(LOG.isDebugEnabled()) {
                LOG.debug("instance data " + instanceData);
            }

            final RootOid oid = instanceData.getRootOid();

            final ObjectAdapter adapter = getAdapterManager().adapterFor(oid);
            if(LOG.isDebugEnabled()) {
                LOG.debug("recreated instance " + adapter);
            }
View Full Code Here

            return new ObjectDataVector();
        }

        final ObjectDataVector matches = new ObjectDataVector();
        for (final RootOid oid : instances) {
            final ObjectData instanceData = (ObjectData) loadData(oid);
            // TODO check loader first
            if (instanceData == null) {
                throw new IsisException("No data found for " + oid + " (possible missing file)");
            }
            if (matchesPattern(pattern, instanceData)) {
View Full Code Here

        });
    }

    private void writeObject(final Data data, final Writer writer) throws IOException {
        final ObjectData object = (ObjectData) data;
        for (final String field : object.fields()) {
            writeField(writer, object, field);
        }
    }
View Full Code Here

            } else {
                if (tagName.equals("isis")) {
                    final RootOidDefault oid = oidFrom(attributes);
                    final Version fileVersion = fileVersionFrom(attributes);
                   
                    object = new ObjectData(oid, fileVersion);
                } else if (tagName.equals("collection")) {
                   
                    final RootOidDefault oid = oidFrom(attributes);
                    final Version fileVersion = fileVersionFrom(attributes);
                   
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("compiling object data for " + adapter);
        }

        final ObjectSpecification adapterSpec = adapter.getSpecification();
        final ObjectData data = new ObjectData((RootOidDefault) adapter.getOid(), adapter.getVersion());

        final List<ObjectAssociation> associations = adapterSpec.getAssociations(Contributed.EXCLUDED);
        for (final ObjectAssociation association : associations) {
            if (association.isNotPersisted()) {
                continue;
View Full Code Here

TOP

Related Classes of org.apache.isis.objectstore.xml.internal.data.ObjectData

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.