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

Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter.changeState()


    @Override
    public void loadInternalCollection(final DatabaseConnector connector, final ObjectAdapter parent) {
        final ObjectAdapter collection = field.get(parent);
        if (collection.getResolveState().canChangeTo(ResolveState.RESOLVING)) {
            LOG.debug("loading internal collection " + field);
            collection.changeState(ResolveState.RESOLVING);

            final StringBuffer sql = new StringBuffer();
            sql.append("select ");
            idMapping.appendColumnNames(sql);
            sql.append(", ");
View Full Code Here


        }

        @Override
        public void execute(final Workspace workspace, final View view, final Location at) {
            final ObjectAdapter object = view.getContent().getAdapter();
            object.changeState(ResolveState.GHOST);
        }
    }

    @Override
    public abstract Consent canClear();
View Full Code Here

    @Test
    public void testRestoreUpdatesExistingAdapter() {
        final Movie movie = new Movie();
        final ObjectAdapter adapter = system.createPersistentTestObject(movie);
        adapter.changeState(ResolveState.RESOLVED);

        final DummyObjectData data =
            new DummyObjectData(adapter.getOid(), Movie.class.getName(), true, new TestProxyVersion(3));
        final DummyEncodeableObjectData name = new DummyEncodeableObjectData("ET", "java.lang.String");
        final DummyNullValue reference = new DummyNullValue(Person.class.getName());
View Full Code Here

    @Test
    public void testRestoreIgnoredIfNoFieldData() {
        final Movie movie = new Movie();
        final ObjectAdapter adapter = system.createPersistentTestObject(movie);
        adapter.changeState(ResolveState.RESOLVED);

        final DummyObjectData data =
            new DummyObjectData(adapter.getOid(), Movie.class.getName(), false, new TestProxyVersion(3));

        final ObjectAdapter object = encoder.decode(data);
View Full Code Here

                    || collection.getResolveState() == ResolveState.GHOST);
            }

            @Override
            public void execute(final Workspace workspace, final View view, final Location at) {
                collection.changeState(ResolveState.GHOST);
            }
        });

    }
View Full Code Here

        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

        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;
    }

    private void readValue(
View Full Code Here

        final Object pojo = objectSpec.createObject();
        final ObjectAdapter adapter = getAdapterManager().adapterFor(pojo, parentAdapter);
        // returned adapter's ResolveState will either be TRANSIENT or GHOST
        objectSpec.initialize(adapter);
        if (adapter.isGhost()) {
            adapter.changeState(ResolveState.RESOLVING);
            adapter.changeState(ResolveState.RESOLVED);
        }
        return adapter;
    }
View Full Code Here

        final ObjectAdapter adapter = getAdapterManager().adapterFor(pojo, parentAdapter);
        // returned adapter's ResolveState will either be TRANSIENT or GHOST
        objectSpec.initialize(adapter);
        if (adapter.isGhost()) {
            adapter.changeState(ResolveState.RESOLVING);
            adapter.changeState(ResolveState.RESOLVED);
        }
        return adapter;
    }

    // ///////////////////////////////////////////////////////////////////////////
View Full Code Here

     * {@link #getAdapterFor(Object) mapped}, and for immutable value types
     * referenced.
     */
    private ObjectAdapter createStandaloneAdapterAndSetResolveState(final Object pojo) {
        final ObjectAdapter adapter = getObjectAdapterFactory().createAdapter(pojo, null, this);
        adapter.changeState(ResolveState.VALUE);
        return adapter;
    }

    /**
     * Creates (but does not {@link #mapAndInjectServices(ObjectAdapter) map}) a new
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.