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

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


        final CollectionFacet collectionFacet = field.getFacet(CollectionFacet.class);
        for (final ObjectAdapter element : collectionFacet.iterable(collection)) {
            final StringBuffer insert = new StringBuffer(sql);
            insert.append(values(connector, element));
            final Version version = SerialNumberVersion.create(0, "", new Date());
            insert.append(versionMapping.insertValues(connector, version));
            insert.append(") ");

            connector.insert(insert.toString());
            element.setVersion(version);
View Full Code Here


    }

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

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

        }
    }

    @Override
    public void save(final DatabaseConnector connector, final ObjectAdapter adapter) {
        final Version version = adapter.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 : fieldMappingByField.values()) {
View Full Code Here

                    collection.addElement(oidFrom(attributes));
                }
            } 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);
                   
                    collection = new CollectionData(oid, fileVersion);
                } else {
                    throw new SAXException("Invalid data");
                }
View Full Code Here

    }

    private static Version fileVersionFrom(final Attributes attributes) {
        final String user = attributes.getValue("user");
        final long version = Long.valueOf(attributes.getValue("ver"), 16).longValue();
        final Version fileVersion = FileVersion.create(user, version);
        return fileVersion;
    }
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 = SerialNumberVersion.create(number, user, time);
        return version;
    }
View Full Code Here

        final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(resourceContext, null, JsonRepresentation.newMap());
        renderer.with(objectAdapter).includesSelf();

        final ResponseBuilder responseBuilder = Responses.ofOk(renderer, Caching.NONE);

        final Version version = objectAdapter.getVersion();
        if (version != null && version.getTime() != null) {
            responseBuilder.tag(ETAG_FORMAT.format(version.getTime()));
        }
        return buildResponse(responseBuilder);
    }
View Full Code Here

           
            try {
                if(concurrencyChecking.isChecking()) {
                   
                    // check for exception, but don't throw if suppressed through thread-local
                    final Version otherVersion = originalOid.getVersion();
                    final Version thisVersion = recreatedOid.getVersion();
                    if(thisVersion != null &&
                       otherVersion != null &&
                       thisVersion.different(otherVersion)) {
                       
                        if(isConcurrencyCheckingGloballyEnabled() && ConcurrencyChecking.isCurrentlyEnabled()) {
                            LOG.info("concurrency conflict detected on " + recreatedOid + " (" + otherVersion + ")");
                            final String currentUser = getAuthenticationSession().getUserName();
                            throw new ConcurrencyException(currentUser, recreatedOid, thisVersion, otherVersion);
                        } else {
                            LOG.warn("concurrency conflict detected but suppressed, on " + recreatedOid + " (" + otherVersion + ")");
                        }
                    }
                }
            } finally {
                final Version originalVersion = originalOid.getVersion();
                final Version recreatedVersion = recreatedOid.getVersion();
                if(recreatedVersion != null && (
                        originalVersion == null ||
                        recreatedVersion.different(originalVersion))
                    ) {
                    if(LOG.isDebugEnabled()) {
                        LOG.debug("updating version in oid, on " + originalOid + " (" + originalVersion + ") to (" + recreatedVersion +")");
                    }
                    originalOid.setVersion(recreatedVersion);
View Full Code Here

            getAggregateRoot().checkLock(otherVersion);
            return;
        }
       
        Oid thisOid = getOid();
        final Version thisVersion = thisOid.getVersion();
       
        // check for exception, but don't throw if suppressed through thread-local
        if(thisVersion != null &&
           otherVersion != null &&
           thisVersion.different(otherVersion)) {
           
            if(ConcurrencyChecking.isCurrentlyEnabled()) {
                LOG.info("concurrency conflict detected on " + thisOid + " (" + otherVersion + ")");
                final String currentUser = getAuthenticationSession().getUserName();
                throw new ConcurrencyException(currentUser, thisOid, thisVersion, otherVersion);
View Full Code Here

            rootOid.setVersion(version);
        }
    }

    private boolean shouldSetVersion(final Version otherVersion) {
        final Version version = getOid().getVersion();
        return version == null || otherVersion == null || otherVersion.different(version);
    }
View Full Code Here

TOP

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

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.