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

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


        prnt1.getHomogeneousCollection().add(smpl1);
        prnt1.getHomogeneousCollection().add(smpl2);
       
        prnt1Adapter = iswf.remapAsPersistent(prnt1, RootOidDefault.deString("PRNT:1", new OidMarshaller()));

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

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


                    throw new NotLoggedInException();
                }
            }

            final FormState entryState = validateObject(context, adapter, fields);
            final Version adapterVersion = adapter.getVersion();
            final Version formVersion = context.getVersion(version);
            if (formVersion != null && adapterVersion.different(formVersion)) {

                IsisContext.getMessageBroker().addMessage("The " + adapter.getSpecification().getSingularName() + " was edited " + "by another user (" + adapterVersion.getUser() + "). Please  make your changes based on their changes.");

                final String view = context.getParameter("_" + ERROR);
View Full Code Here

        withLogging(pojo, new Runnable() {
            @Override
            public void run() {
                final PersistenceCapable pc = pojo;
                final Version datastoreVersion = getVersionIfAny(pc);
               
                final RootOid originalOid ;
                ObjectAdapter originalAdapter = getAdapterManager().getAdapterFor(pojo);
                if(originalAdapter != null) {
                    ensureRootObject(pojo);
                    originalOid = (RootOid) originalAdapter.getOid();

                    final Version originalVersion = originalAdapter.getVersion();

                    // sync the pojo held by the adapter with that just loaded
                    getPersistenceSession().remapRecreatedPojo(originalAdapter, pojo);
                   
                    // since there was already an adapter, do concurrency check
                    // (but don't set abort cause if checking is suppressed through thread-local)
                    final RootOid thisOid = originalOid;
                    final Version thisVersion = originalVersion;
                    final Version otherVersion = datastoreVersion;
                   
                    if(thisVersion != null &&
                       otherVersion != null &&
                       thisVersion.different(otherVersion)) {
View Full Code Here

                    // already called in preDirty and the post value is captured lazily
                }
               
                Utils.clearDirtyFor(adapter);
               
                Version versionIfAny = getVersionIfAny(pojo);
                adapter.setVersion(versionIfAny);
                CallbackUtils.callCallback(adapter, callbackFacetClass);

               
                ensureFrameworksInAgreement(pojo);
View Full Code Here

        final String id = reader.readId();
        final Oid oid = keyCreator.oid(id);

        final ObjectAdapter object = getAdapter(specification, oid);
        if (object.getResolveState().isResolved()) {
            Version version = null;
            final String versionString = reader.readVersion();
            if (!versionString.equals("")) {
                final String user = reader.readUser();
                final String time = reader.readTime();
                version = versionCreator.version(versionString, user, time);
            }
            if (version.different(object.getVersion())) {
                // TODO - do we need to CHECK version and update
                throw new UnexpectedCallException();
            } else {
                return object;
            }
View Full Code Here

    }

    private void loadState(final StateReader reader, final KeyCreator keyCreator, final VersionCreator versionCreator, final Map<String, DataEncryption> dataEncrypters, final ObjectAdapter object) {
        final ResolveState resolveState = ResolveState.RESOLVING;
        object.changeState(resolveState);
        Version version = null;
        final String versionString = reader.readVersion();
        if (!versionString.equals("")) {
            final String user = reader.readUser();
            final String time = reader.readTime();
            version = versionCreator.version(versionString, user, time);
View Full Code Here

        final String key = keyCreator.key(object.getOid());
        writer.writeId(key);
        writeFields(writer, specName, object);
        final String user = IsisContext.getAuthenticationSession().getUserName();

        final Version currentVersion = object.getVersion();
        final Version newVersion = isUpdate ? versionCreator.nextVersion(currentVersion) : versionCreator.newVersion(user);
        object.setOptimisticLock(newVersion);
        if (newVersion != null) {
            final String version = currentVersion == null ? null : versionCreator.versionString(currentVersion);
            writer.writeVersion(version, versionCreator.versionString(newVersion));
            writer.writeUser(newVersion.getUser());
            writer.writeTime(versionCreator.timeString(newVersion));
            writer.writeEncryptionType(dataEncrypter.getType());
        }

        if (isUpdate) {
View Full Code Here

                throw new IsisException("A mapping already exists for " + oid + ": " + existingAdapterLookedUpByOid);
            }

            final ObjectAdapter recreatedAdapter = getHydrator().recreateAdapter(oid, pojo);

            final Version version = objectStoreInstances.getVersion(oid);
            recreatedAdapter.setOptimisticLock(version);
        }
    }
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

    @Override
    public ObjectData encodeMadePersistentGraph(final ObjectData data, final ObjectAdapter object) {
        final Oid objectsOid = object.getOid();
        Assert.assertNotNull(objectsOid);
        if (objectsOid.hasPrevious()) {
            final Version version = object.getVersion();
            final String type = data.getType();
            final ObjectData persistedData = dataFactory.createObjectData(type, objectsOid, true, version);

            final Data[] allContents = data.getFieldContent();
            if (allContents != null) {
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.