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

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


        epvSpecification = iswf.loadSpecification(SimpleEntity.class);
    }

    @Test
    public void getObject_whenDoesNotExist() {
        final TypedOid oid = RootOidDefault.deString("SMPL:10", new OidMarshaller());
        try {
            getStore().loadInstanceAndAdapt(oid);
            fail();
        } catch (final ObjectNotFoundException expected) {
        }
View Full Code Here


          adapter = getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
            populateCollection(adapter, (CollectionData) data);
           
        } else {
          Assert.assertTrue("oid must be a TypedOid representing an object because spec is not a collection and cannot be a value", oid instanceof TypedOid);
          TypedOid typedOid = (TypedOid) oid;
         
      adapter = getAdapterManager().adapterFor(typedOid);
            updateObject(adapter, data);
        }
View Full Code Here

        // reference to entity
       
        Oid oid = data.getOid();
        Assert.assertTrue("can only create a reference to an entity", oid instanceof TypedOid);
       
    final TypedOid typedOid = (TypedOid) oid;
        if (typedOid == null) {
            return null;
        }
       
        final ObjectAdapter referencedAdapter = getAdapterManager().adapterFor(typedOid);

        if (data instanceof ObjectData) {
         
          // no longer needed
          //final ObjectSpecification spec = getSpecificationLoader().loadSpecification(data.getClassName());
          if(typedOid instanceof ParentedOid) { // equiv to spec.isParented()), I think
           
            // rather than the following, is it equivalent to pass in RESOLVING? (like everywhere else)
//            final ResolveState targetState = ResolveState.GHOST;
//            if (referencedAdapter.getResolveState().isValidToChangeTo(targetState)) {
//                referencedAdapter.changeState(targetState);
//            }
           
            updateObject(referencedAdapter, data);
          } else if (typedOid.isTransient()) {
            updateObject(referencedAdapter, data);
          }
        }
        return referencedAdapter;
    }
View Full Code Here

            final ObjectSpecification itemSpecification = reflector.loadSpecification(rs.getString(classColumnName));
            idMapping.setObjectSpecification(itemSpecification);

            // Load new recordSet for the actual class
            final ObjectMapping itemMapper = objectMappingLookup.getMapping(itemSpecification, connector);
            final TypedOid oid = idMapping.recreateOid(rs, itemSpecification);
            final ObjectAdapter loadedObject = itemMapper.getObject(connector, oid);

            LOG.debug("  element  " + loadedObject.getOid());

            list.add(loadedObject);
View Full Code Here

        epvSpecification = iswf.loadSpecification(SimpleEntity.class);
    }

    @Test
    public void getObject_whenDoesNotExist() {
        final TypedOid oid = RootOidDefault.deString("SMPL:10", new OidMarshaller());
        try {
            getStore().loadInstanceAndAdapt(oid);
            fail();
        } catch (final ObjectNotFoundException expected) {
        }
View Full Code Here

    public static String getDomainType(final ObjectAdapter objectAdapter) {
        Oid oid = objectAdapter.getOid();
        if (oid == null || !(oid instanceof TypedOid)) {
            return null;
        }
        TypedOid typedOid = (TypedOid) oid;
        return typedOid.getObjectSpecId().asString();
    }
View Full Code Here

          adapter = getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
            populateCollection(adapter, (CollectionData) data);
           
        } else {
          Assert.assertTrue("oid must be a TypedOid representing an object because spec is not a collection and cannot be a value", oid instanceof TypedOid);
          TypedOid typedOid = (TypedOid) oid;
         
      adapter = getAdapterManager().adapterFor(typedOid);
            updateObject(adapter, data);
        }
View Full Code Here

        // reference to entity
       
        Oid oid = data.getOid();
        Assert.assertTrue("can only create a reference to an entity", oid instanceof TypedOid);
       
    final TypedOid typedOid = (TypedOid) oid;
        if (typedOid == null) {
            return null;
        }
       
        final ObjectAdapter referencedAdapter = getAdapterManager().adapterFor(typedOid);

        if (data instanceof ObjectData) {
         
          // no longer needed
          //final ObjectSpecification spec = getSpecificationLoader().loadSpecification(data.getClassName());
          if(typedOid instanceof ParentedOid) { // equiv to spec.isParented()), I think
           
            // rather than the following, is it equivalent to pass in RESOLVING? (like everywhere else)
//            final ResolveState targetState = ResolveState.GHOST;
//            if (referencedAdapter.getResolveState().isValidToChangeTo(targetState)) {
//                referencedAdapter.changeState(targetState);
//            }
           
            updateObject(referencedAdapter, data);
          } else if (typedOid.isTransient()) {
            updateObject(referencedAdapter, data);
          }
        }
        return referencedAdapter;
    }
View Full Code Here

        referencingEntity3.setName("Referencing 3");
        referencingEntity3.setReferenced(referencedEntity2);

        iswf.commitTran();

        TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();

        TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
        TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();


        // when ...
        iswf.bounceSystem();
       
View Full Code Here

        referencingEntity3.setName("Referencing 3");
        referencingEntity3.setReferenced(referencedEntity2);

        iswf.commitTran();

        TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();

        TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
        TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();


        // when ...
        iswf.bounceSystem();
       
View Full Code Here

TOP

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

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.