Package org.apache.isis.core.metamodel.adapter.version

Examples of org.apache.isis.core.metamodel.adapter.version.SerialNumberVersion


        }
    }

    @Override
    public void save(final DatabaseConnector connector, final ObjectAdapter object) {
        final SerialNumberVersion version = (SerialNumberVersion) object.getVersion();
        final long nextSequence;
        if (useVersioning) {
            nextSequence = version.getSequence() + 1;
        } else {
            nextSequence = version.getSequence();
        }

        final StringBuffer sql = new StringBuffer();
        sql.append("UPDATE " + table + " SET ");
        for (final FieldMapping mapping : fieldMappings) {
View Full Code Here


    }

    @Override
    public Version getVersion(final String id) {
        final Long sequence = Long.valueOf(id, 16);
        return new SerialNumberVersion(sequence, null, null);
    }
View Full Code Here

        return Sql.sqlName(name);
    }

    // TODO remove
    protected SerialNumberVersion createVersion(final long versionSequence) {
        return new SerialNumberVersion(versionSequence, "", new Date());
    }
View Full Code Here

    public Version getLock(final Results rs) {
        final long number = rs.getLong(versionColumn);
        final String user = rs.getString(lastActivityUserColumn);
        final Date time = rs.getJavaDateTime(lastActivityDateColumn, Defaults.getCalendar());
        final Version version = new SerialNumberVersion(number, user, time);
        return version;
    }
View Full Code Here

    public void testname() throws Exception {
        final ObjectSpecification specification =
            IsisContext.getSpecificationLoader().loadSpecification(ExampleReferencePojo.class);
        final ObjectAdapter object = IsisContext.getPersistenceSession().createInstance(specification);
        IsisContext.getPersistenceSession().makePersistent(object);
        object.setOptimisticLock(new SerialNumberVersion(3, "username", new Date(1000)));

        final long id = ((SerialOid) object.getOid()).getSerialNo();
        final String key = Long.toString(id, 16);

        final Mockery context = new Mockery();
View Full Code Here

        writer = context.mock(StateWriter.class);
        commandContext = context.mock(NoSqlCommandContext.class);
        keyCreator = context.mock(KeyCreator.class);
        versionCreator = context.mock(VersionCreator.class);

        final Version version = new SerialNumberVersion(2, "username", null);

        context.checking(new Expectations() {
            {
                one(versionCreator).newVersion("tester");
                will(returnValue(version));
View Full Code Here

    public Version getLock(final Results rs) {
        final long number = rs.getLong(versionColumn);
        final String user = rs.getString(lastActivityUserColumn);
        final Date time = rs.getJavaDateTime(lastActivityDateColumn, Defaults.getCalendar());
        final Version version = new SerialNumberVersion(number, user, time);
        return version;
    }
View Full Code Here

    public void save(final ObjectAdapter adapter) {
        pojoByOidMap.put(adapter.getOid(), adapter.getObject());
        titleByOidMap.put(adapter.getOid(), adapter.titleString().toLowerCase());

        final SerialNumberVersion version = versionByOidMap.get(adapter.getOid());
        final SerialNumberVersion nextVersion = nextVersion(version);
        versionByOidMap.put(adapter.getOid(), nextVersion);
        adapter.setOptimisticLock(nextVersion);
    }
View Full Code Here

        adapter.setOptimisticLock(nextVersion);
    }

    private synchronized SerialNumberVersion nextVersion(final SerialNumberVersion version) {
        final long sequence = (version != null ? version.getSequence() : 0) + 1;
        return new SerialNumberVersion(sequence, getAuthenticationSession().getUserName(), new Date(Clock.getTime()));
    }
View Full Code Here

    }

    @Override
    public void createObject(final DatabaseConnector connector, final ObjectAdapter object) {
        final int versionSequence = 1;
        final SerialNumberVersion version = createVersion(versionSequence);

        final StringBuffer sql = new StringBuffer();
        sql.append("insert into " + table + " (");
        idMapping.appendColumnNames(sql);
        sql.append(", ");
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.adapter.version.SerialNumberVersion

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.