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

Examples of org.apache.isis.core.metamodel.adapter.oid.AggregatedOid


        final StateReader aggregateReader = reader.readAggregate(id);
       
        final ObjectAdapter fieldObject;
        if (aggregateReader != null) {
            final String oidStr = aggregateReader.readOid();
            final AggregatedOid aggregatedOid = getOidMarshaller().unmarshal(oidStr, AggregatedOid.class);
            fieldObject = restoreAggregatedObject(aggregateReader, aggregatedOid, dataEncrypter);
        } else {
            fieldObject = null;
        }
       
View Full Code Here


            final ObjectAdapter[] elementAdapters = new ObjectAdapter[readers.size()];
            int i = 0;
            for (final StateReader elementReader : readers) {
               
                final String oidStr = elementReader.readOid();
                final AggregatedOid aggregatedOid = getOidMarshaller().unmarshal(oidStr, AggregatedOid.class);
               
                elementAdapters[i++] = restoreAggregatedObject(elementReader, aggregatedOid, dataEncrypter);
            }
            facet.init(collectionAdapter, elementAdapters);
        } else {
View Full Code Here

        }
        final Oid referencedOid = referencedAdapter.getOid();
        if (!(referencedOid instanceof AggregatedOid)) {
            throw new NoSqlStoreException("Object type is inconsistent with it OID - it should have an AggregatedOid: " + referencedAdapter);
        }
        final AggregatedOid aggregatedOid = (AggregatedOid) referencedOid;
       
        final String associationId = otoa.getId();
        final StateWriter aggregateWriter = writer.addAggregate(associationId);
        //aggregateWriter.writeId(aggregatedOid.getLocalId());
        aggregateWriter.writeOid(aggregatedOid);
View Full Code Here

    private void writeCollectionOfAggregated(final StateWriter writer, final ObjectAssociation association, final ObjectAdapter collectionAdapter) {
        final List<StateWriter> elementWriters = Lists.newArrayList();
        final CollectionFacet collectionFacet = collectionAdapter.getSpecification().getFacet(CollectionFacet.class);
        for (final ObjectAdapter referencedAdapter : collectionFacet.iterable(collectionAdapter)) {
            final AggregatedOid elementOid = (AggregatedOid) referencedAdapter.getOid();
            final StateWriter elementWriter = writer.createElementWriter();
           
            //elementWriter.writeId(elementOid.getLocalId());
            elementWriter.writeOid(elementOid);
           
View Full Code Here

        final Oid oid = adapter.getOid();
        if (oid instanceof AggregatedOid) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("; aggregated - resolving parent");
            }
            final AggregatedOid aggregatedOid = (AggregatedOid) oid;
            final TypedOid parentOid = aggregatedOid.getParentOid();
            final ObjectAdapter parentAdapter = loadInstanceAndAdapt(parentOid);
            resolveImmediately(parentAdapter);
            return;
        }
View Full Code Here

    private void readAggregate(final StateReader reader, final KeyCreator keyCreator, final DataEncryption dataEncrypter, final OneToOneAssociation association, final ObjectAdapter object) {
        final String id = association.getId();
        final StateReader aggregateReader = reader.readAggregate(id);
        if (aggregateReader != null) {
            final String id2 = aggregateReader.readId();
            final AggregatedOid oid = new AggregatedOid(object.getOid(), id2);
            final ObjectAdapter fieldObject = restoreAggregatedObject(aggregateReader, oid, keyCreator, dataEncrypter);
            association.initAssociation(object, fieldObject);
        } else {
            association.initAssociation(object, null);
        }
View Full Code Here

            // String id = association.getId();
            final ObjectAdapter[] elements = new ObjectAdapter[readers.size()];
            int i = 0;
            for (final StateReader elementReader : readers) {
                final String id = elementReader.readId();
                final AggregatedOid oid = new AggregatedOid(object.getOid(), id);
                elements[i++] = restoreAggregatedObject(elementReader, oid, keyCreator, dataEncrypter);
            }
            facet.init(collection, elements);
        } else {
            final String referencesList = reader.readField(association.getId());
View Full Code Here

        final ObjectAdapter adapter = getAdapterFor(pojo);
        if (adapter != null) {
            return adapter;
        }
        final String id = getOidGenerator().createAggregateId(pojo);
        final Oid aggregatedOid = new AggregatedOid(parent.getOid(), id);
        final AggregateAdapters aggregatedAdapter = createOrRecreateRootAdapter(pojo, aggregatedOid);
        return map(aggregatedAdapter);
    }
View Full Code Here

    private AggregateAdapters aggregateAdaptersFor(final ObjectAdapter rootAdapter) {
        final AggregateAdapters aggregateAdapters = new AggregateAdapters(rootAdapter);
        final Oid rootOid = rootAdapter.getOid();

        for (final OneToManyAssociation otma : rootAdapter.getSpecification().getCollections()) {
            final AggregatedOid aggregatedOid = new AggregatedOid(rootOid, otma.getName());
            final ObjectAdapter collectionAdapter = getAdapterFor(aggregatedOid);
            if (collectionAdapter != null) {
                // collection adapters are lazily created and so there may not
                // be one.
                aggregateAdapters.addCollectionAdapter(otma, collectionAdapter);
View Full Code Here

        // re-map the collection adapters
        if (LOG.isDebugEnabled()) {
            LOG.debug("re-adding collection adapter(s) to oid map");
        }
        for (final ObjectAdapter collectionAdapter : aggregateAdapters) {
            final AggregatedOid previousCollectionOid = (AggregatedOid) collectionAdapter.getOid();
            getOidAdapterMap().add(previousCollectionOid, collectionAdapter);
        }

        // replace any pojos if required, remapping in the pojo map
        if (LOG.isDebugEnabled()) {
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.adapter.oid.AggregatedOid

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.