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

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


        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

        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

    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

        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

        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

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.