Examples of ObjectData


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

            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

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

        });
    }

    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

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

            } 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

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

        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

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

        if (LOG.isDebugEnabled()) {
            LOG.debug("  create object " + onAdapter());
        }
        final String user = getAuthenticationSession().getUserName();
        onAdapter().setVersion(FileVersion.create(user));
        final ObjectData data = createObjectData(onAdapter(), true);
        getDataManager().insertObject(data);
    }
View Full Code Here

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

        assertEquals(data.get("Name"), read.get("Name"));
    }

    @Test
    public void testInsertObjectWithEmptyOneToManyAssociations() throws ObjectPersistenceException {
        final ObjectData data = createData(Team.class, 99, FileVersion.create("user", 13));

        data.initCollection("Members");

        manager.insertObject(data);

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

        final ListOfRootOid c = read.elements("Members");
        assertNull(c);
    }
View Full Code Here

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

        assertNull(c);
    }

    @Test
    public void testInsertObjectWithOneToManyAssociations() throws ObjectPersistenceException {
        final ObjectData data = createData(Team.class, 99, FileVersion.create("user", 13));

        data.initCollection("Members");
        final RootOidDefault oid[] = new RootOidDefault[3];
        for (int i = 0; i < oid.length; i++) {
            oid[i] = RootOidDefault.create(ObjectSpecId.of("TEA"), ""+ (104 + i));
            data.addElement("Members", oid[i]);
        }
        manager.insertObject(data);

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

        final ListOfRootOid c = read.elements("Members");
        for (int i = 0; i < oid.length; i++) {
            assertEquals(oid[i], c.elementAt(i));
        }
    }
View Full Code Here

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

    private ObjectData createData(final Class<?> type, final long id, final Version version) {

        final ObjectSpecification objSpec = IsisContext.getSpecificationLoader().loadSpecification(type);
        final ObjectSpecId objectSpecId = objSpec.getSpecId();
        final RootOidDefault oid = RootOidDefault.create(objectSpecId, ""+id);
        return new ObjectData(oid, version);
    }
View Full Code Here

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

        FileVersion.setClock(new DefaultClock());

        oids = new RootOid[SIZE];
        data = new ObjectData[SIZE];

        pattern = new ObjectData(RootOidDefault.deString("RLE:1", new OidMarshaller()), FileVersion.create("user", 13));
        for (int i = 0; i < SIZE; i++) {
            oids[i] = RootOidDefault.create(ObjectSpecId.of("RLE"), ""+i);
            data[i] = new ObjectData(oids[i], FileVersion.create("user", 13));
            manager.insertObject(data[i]);
        }
    }
View Full Code Here

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

        data[2].set("Person", RootOidDefault.create(ObjectSpecId.of("PER"), ""+231));
        data[2].set("Name", "Fred");
        manager.save(data[2]);

        assertTrue(manager.getInstances(pattern).contains(data[2]));
        final ObjectData read = (ObjectData) manager.loadData(oids[2]);
        assertEquals(data[2], read);
        assertEquals(data[2].get("Name"), read.get("Name"));
        assertEquals(data[2].get("Person"), read.get("Person"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.