Package org.apache.isis.runtimes.dflt.objectstores.xml.internal.version

Examples of org.apache.isis.runtimes.dflt.objectstores.xml.internal.version.FileVersion


    public void execute(final PersistenceCommandContext context) throws ObjectPersistenceException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("  create object " + onObject());
        }
        final String user = getAuthenticationSession().getUserName();
        onObject().setOptimisticLock(new FileVersion(user));
        final ObjectData data = createObjectData(onObject(), true);
        getDataManager().insertObject(data);
    }
View Full Code Here


    public void execute(final PersistenceCommandContext context) throws ObjectPersistenceException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("  save object " + onObject());
        }
        final String user = getAuthenticationSession().getUserName();
        onObject().setOptimisticLock(new FileVersion(user));

        final Data data = createObjectData(onObject(), true);
        getDataManager().save(data);
    }
View Full Code Here

                    final long version = Long.valueOf(attributes.getValue("ver"), 16).longValue();
                    final String user = attributes.getValue("user");
                    final long id = Long.valueOf(attributes.getValue("id"), 16).longValue();
                    final ObjectSpecification spec = IsisContext.getSpecificationLoader().loadSpecification(typeName);
                    final SerialOid oid = SerialOid.createPersistent(id);
                    object = new ObjectData(spec, oid, new FileVersion(user, version));
                } else if (tagName.equals("collection")) {
                    final String type = attributes.getValue("type");
                    final long version = Long.valueOf(attributes.getValue("ver"), 16).longValue();
                    final String user = attributes.getValue("user");
                    final long id = Long.valueOf(attributes.getValue("id"), 16).longValue();
                    final ObjectSpecification spec = IsisContext.getSpecificationLoader().loadSpecification(type);
                    final SerialOid oid = SerialOid.createPersistent(id);
                    collection = new CollectionData(spec, oid, new FileVersion(user, version));
                } else {
                    throw new SAXException("Invalid data");
                }
            }
        }
View Full Code Here

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

        final ObjectSpecification type = system.getSpecification(Object.class);
        pattern = new ObjectData(type, null, new FileVersion("user", 13));
        for (int i = 0; i < SIZE; i++) {
            oids[i] = SerialOid.createPersistent(i);
            data[i] = new ObjectData(type, oids[i], new FileVersion("user", 13));
            manager.insertObject(data[i]);
        }

        LOG.debug("test starting...");
    }
View Full Code Here

        oid = isTransient ? SerialOid.createTransient(serialNum) : SerialOid.createPersistent(serialNum);

        spec = new TestProxySpecification(this.getClass());
        spec.fields = Collections.emptyList();

        version = new FileVersion("", System.currentTimeMillis());
        objectData = new ObjectData(spec, oid, version);
        objectDataVector = new ObjectDataVector();
    }
View Full Code Here

    public void testValueField() {
        FileVersion.setClock(new DefaultClock());

        final TestProxySpecification type = new TestProxySpecification("test");
        final ObjectData objectData = new ObjectData(type, SerialOid.createPersistent(13), new FileVersion(""));

        assertEquals(null, objectData.get("name"));
        objectData.set("name", "value");
        assertEquals("value", objectData.get("name"));
View Full Code Here

            }
        }
    }

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

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

        assertEquals(data.getOid(), read.getOid());
View Full Code Here

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

    public void testInsertObjectWithFields() throws ObjectPersistenceException {
        final ObjectData data = createData(Role.class, 99, new FileVersion("user", 13));
        data.set("Person", SerialOid.createPersistent(101));
        assertNotNull(data.get("Person"));
        data.set("Name", "Harry");
        assertNotNull(data.get("Name"));
View Full Code Here

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

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

        data.initCollection("Members");

        manager.insertObject(data);
View Full Code Here

        final ReferenceVector c = read.elements("Members");
        assertNull(c);
    }

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

        data.initCollection("Members");
        final SerialOid oid[] = new SerialOid[3];
        for (int i = 0; i < oid.length; i++) {
            oid[i] = SerialOid.createPersistent(104 + i);
View Full Code Here

TOP

Related Classes of org.apache.isis.runtimes.dflt.objectstores.xml.internal.version.FileVersion

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.