Examples of AggregatedOid


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

        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
View Full Code Here

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

            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

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

        value = new Object();
        aggregatedAdapter = getAdapterManager().adapterForAggregated(value, parent);
    }

    public void testOidKnowsParent() throws Exception {
        final AggregatedOid aggregatedOid = (AggregatedOid) aggregatedAdapter.getOid();
        assertEquals(parent.getOid(), aggregatedOid.getParentOid());
    }
View Full Code Here

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

        final AggregatedOid aggregatedOid = (AggregatedOid) aggregatedAdapter.getOid();
        assertEquals(parent.getOid(), aggregatedOid.getParentOid());
    }

    public void testOidHasSubId() throws Exception {
        final AggregatedOid aggregatedOid = (AggregatedOid) aggregatedAdapter.getOid();
        assertEquals("8", aggregatedOid.getId());
    }
View Full Code Here

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

        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

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

            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

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

        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

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

                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

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

                    final ObjectAdapter parent = object.getAggregateRoot();
                    LOG.debug("change to internal collection being persisted through parent");

                    final Oid oid = object.getOid();
                    if (oid instanceof AggregatedOid) {
                        final AggregatedOid aoid = (AggregatedOid) oid;
                        final ObjectMapping mapping2 = objectMappingLookup.getMapping(parent, connection);

                        if (mapping2.saveCollection(connection, parent, aoid.getId()) == false) {
                            final ObjectMapping mapping = objectMappingLookup.getMapping(parent, connection);
                            mapping.save(connection, object);
                        }
                        connectionPool.release(connection);
                    } else {
View Full Code Here

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

        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
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.