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

Examples of org.apache.isis.core.metamodel.adapter.ResolveState


            CallbackUtils.callCallback(adapter, PersistingCallbackFacet.class);
            toPersistObjectSet.remapAsPersistent(adapter);
           
            // was previously to SERIALIZING_RESOLVED, but
            // after refactoring simplifications this is now equivalent to UPDATING
            final ResolveState stateWhilePersisting = ResolveState.UPDATING;
           
            adapter.changeState(stateWhilePersisting)

            for (int i = 0; i < associations.size(); i++) {
                final ObjectAssociation objectAssoc = associations.get(i);
                if (objectAssoc.isNotPersisted()) {
                    continue;
                }
                if (objectAssoc.isOneToManyAssociation()) {
                    final ObjectAdapter collection = objectAssoc.get(adapter);
                    if (collection == null) {
                        throw new ObjectPersistenceException("Collection " + objectAssoc.getName() + " does not exist in " + adapter.getSpecification().getFullIdentifier());
                    }
                    makePersistent(collection, toPersistObjectSet);
                } else {
                    final ObjectAdapter fieldValue = objectAssoc.get(adapter);
                    if (fieldValue == null) {
                        continue;
                    }
                    persist(fieldValue, toPersistObjectSet);
                }
            }
            toPersistObjectSet.addCreateObjectCommand(adapter);
            CallbackUtils.callCallback(adapter, PersistedCallbackFacet.class);
            adapter.changeState(stateWhilePersisting.getEndState());
        }

    }
View Full Code Here


    }


    @Override
    public boolean isTitleAvailable() {
        final ResolveState resolveState = aggregateResolveState();
        return resolveState.isValue() || resolveState.isResolved();
    }
View Full Code Here

            toPersistObjectSet.remapAsPersistent(adapter);
           
            // was previously to SERIALIZING_RESOLVED, but
            // after refactoring simplifications this is now equivalent to UPDATING
            final ResolveState stateWhilePersisting = ResolveState.UPDATING;
           
            adapter.changeState(stateWhilePersisting)

            for (int i = 0; i < associations.size(); i++) {
                final ObjectAssociation objectAssoc = associations.get(i);
                if (objectAssoc.isNotPersisted()) {
                    continue;
                }
                if (objectAssoc.isOneToManyAssociation()) {
                    final ObjectAdapter collection = objectAssoc.get(adapter);
                    if (collection == null) {
                        throw new ObjectPersistenceException("Collection " + objectAssoc.getName() + " does not exist in " + adapter.getSpecification().getFullIdentifier());
                    }
                    makePersistent(collection, toPersistObjectSet);
                } else {
                    final ObjectAdapter fieldValue = objectAssoc.get(adapter);
                    if (fieldValue == null) {
                        continue;
                    }
                    persist(fieldValue, toPersistObjectSet);
                }
            }
            toPersistObjectSet.addCreateObjectCommand(adapter);

            // this is now a responsibility of the objectstore
            // CallbackFacet.Util.callCallback(adapter, PersistedCallbackFacet.class);
           
            adapter.changeState(stateWhilePersisting.getEndState());
        }

    }
View Full Code Here

    }


    @Override
    public boolean isTitleAvailable() {
        final ResolveState resolveState = aggregateResolveState();
        return resolveState.isValue() || resolveState.isResolved();
    }
View Full Code Here

    public void update(final StateReader reader, final VersionCreator versionCreator, final Map<String, DataEncryption> dataEncrypters, final ObjectAdapter object) {
        loadState(reader, versionCreator, dataEncrypters, object);
    }

    private void loadState(final StateReader reader, 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);
        }
        final String encryptionType = reader.readEncrytionType();
        readFields(reader, object, dataEncrypters.get(encryptionType));
        object.setVersion(version);
        object.changeState(resolveState.getEndState());
    }
View Full Code Here

        association.initAssociation(parentAdapter, fieldObject);
    }

    private ObjectAdapter restoreAggregatedObject(final StateReader aggregateReader, final AggregatedOid aggregatedOid, final DataEncryption dataEncrypter) {
        final ObjectAdapter fieldObject = getAdapter(aggregatedOid);
        final ResolveState resolveState = ResolveState.RESOLVING;
        fieldObject.changeState(resolveState);
        readFields(aggregateReader, fieldObject, dataEncrypter);
        fieldObject.changeState(resolveState.getEndState());

        return fieldObject;
    }
View Full Code Here

    public void update(final StateReader reader, final KeyCreator keyCreator, final VersionCreator versionCreator, final Map<String, DataEncryption> dataEncrypters, final ObjectAdapter object) {
        loadState(reader, keyCreator, versionCreator, dataEncrypters, object);
    }

    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);
        }
        final String encryptionType = reader.readEncrytionType();
        readFields(reader, object, keyCreator, dataEncrypters.get(encryptionType));
        object.setOptimisticLock(version);
        object.changeState(resolveState.getEndState());
    }
View Full Code Here

    private ObjectAdapter restoreAggregatedObject(final StateReader aggregateReader, final Oid oid, final KeyCreator keyCreator, final DataEncryption dataEncrypter) {
        final String objectType = aggregateReader.readObjectType();
        final ObjectSpecification specification = IsisContext.getSpecificationLoader().loadSpecification(objectType);
        final ObjectAdapter fieldObject = getAdapter(specification, oid);
        if (fieldObject.getResolveState().isGhost()) {
            final ResolveState resolveState = ResolveState.RESOLVING;
            fieldObject.changeState(resolveState);
            readFields(aggregateReader, fieldObject, keyCreator, dataEncrypter);
            fieldObject.changeState(resolveState.getEndState());
        }
        return fieldObject;
    }
View Full Code Here

     * Marks the specified object as loaded: resolved, partly resolve or updated
     * as specified by the second parameter. Attempting to specify any other
     * state throws a run time exception.
     */
    public static void end(final ObjectAdapter object) {
        final ResolveState endState = object.getResolveState().getEndState();
        Assert.assertNotNull("end state required", endState);
        if (LOG.isTraceEnabled()) {
            LOG.trace("end " + object + " as " + endState.name());
        }
        object.changeState(endState);
    }
View Full Code Here

        factory = new AdapterFactoryAbstract() {
            @Override
            public ObjectAdapter createAdapter(final Object pojo, final Oid oid) {
                final ObjectSpecification specification = reflector.loadSpecification(pojo.getClass());
                final ResolveState state = oid == null ? ResolveState.VALUE : oid.isTransient() ? ResolveState.TRANSIENT : ResolveState.GHOST;

                final TestProxyAdapter objectAdapter = new TestProxyAdapter();
                objectAdapter.setupResolveState(state);
                objectAdapter.setupObject(pojo);
                objectAdapter.setupOid(oid);
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.adapter.ResolveState

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.