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

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


    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

        if (!(identifiedHolder instanceof OneToManyAssociation)) {
            throw new IsisException("only applicable to collections " + pojo + " in " + identifiedHolder);
        }

        // persistence of aggregated follows the parent
        final Oid aggregatedOid = new AggregatedOid(ownerAdapter.getOid(), identifier.getMemberName());
        final ObjectAdapter aggregatedAdapter = createOrRecreateAdapter(pojo, aggregatedOid);

        // we copy over the type onto the adapter itself
        // [not sure why this is really needed, surely we have enough info in the adapter
        // to look this up on the fly?]
View Full Code Here

            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 parentObject = objectMapping.mappedObject(idParts[0] + "@" + idParts[1]);
            if (parentObject instanceof ObjectAdapter) {
                IsisContext.getPersistenceSession().resolveImmediately(parentObject);
            }

            final AggregatedOid aggregatedOid = new AggregatedOid(parentObject.getOid(), idParts[2]);

            ObjectAdapter aggregatedAdapter = null;
            outer: for (final ObjectAssociation association : parentObject.getSpecification().getAssociations()) {
                if (association.getSpecification().isAggregated()) {
                    final ObjectAdapter objectAdapter = association.get(parentObject);
View Full Code Here

        data.put("_class", specification.getFullIdentifier());

        final Oid oid = object.getOid();
        String encodedOid;
        if (oid instanceof AggregatedOid) {
            final AggregatedOid aoid = (AggregatedOid) oid;
            final Oid parentOid = aoid.getParentOid();
            final String aggregatedId = aoid.getId();
            encodedOid = Long.toString(((SerialOid) parentOid).getSerialNo(), 16) + "@" + aggregatedId;
        } else if (oid instanceof SerialOid) {
            encodedOid = Long.toString(((SerialOid) oid).getSerialNo(), 16);
        } else {
            throw new ScimpiException("Unsupportred OID type " + oid);
View Full Code Here

            oidType = oid.getClass();
        }

        String encodedOid;
        if (oid instanceof AggregatedOid) {
            final AggregatedOid aoid = (AggregatedOid) oid;
            final Oid parentOid = aoid.getParentOid();
            object = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(parentOid);
            final String aggregatedId = aoid.getId();
            encodedOid = Long.toString(((SerialOid) parentOid).getSerialNo(), 16) + "@" + aggregatedId;
        } else if (oid instanceof SerialOid) {
            encodedOid = Long.toString(((SerialOid) oid).getSerialNo(), 16);
        } else {
            encodedOid = IsisContext.getPersistenceSession().getOidGenerator().getOidStringifier().enString(oid);
View Full Code Here

        ObjectAdapter object;
        final ObjectSpecification specification = IsisContext.getSpecificationLoader().loadSpecification(cls);
        if (specification.isAggregated() && !specification.isCollection()) {
            final String[] split = id.split("@");
            final SerialOid parentOid = SerialOid.createTransient(Long.parseLong(split[0], 16));
            final AggregatedOid oid = new AggregatedOid(parentOid, split[1]);
            object = IsisContext.getPersistenceSession().recreateAdapter(oid, specification);
        } else {
            object = mappedObject("T" + cls + "@" + id);
        }
View Full Code Here

                if (oidType == null) {
                    oidType = IsisContext.getPersistenceSession().getServices().get(0).getOid().getClass();
                }
                if (split.length > 2) {
                    final SerialOid parentOid = SerialOid.createPersistent(Long.parseLong(oidData, 16));
                    oid = new AggregatedOid(parentOid, split[2]);
                    IsisContext.getPersistenceSession().loadObject(parentOid, spec);
                    loadObject = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(oid);
                } else if (oidType.isAssignableFrom(SerialOid.class)) {
                    oid = SerialOid.createPersistent(Long.parseLong(oidData, 16));
                    loadObject = IsisContext.getPersistenceSession().loadObject(oid, spec);
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.