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

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


        iswf.persist(iswf.fixtures.smpl1);
        iswf.tearDownSystem();
        iswf.setUpSystem();
       
        // when
        final RootOidDefault oid = RootOidDefault.deString("SMPL:1", new OidMarshaller());
        final ObjectAdapter adapter = iswf.recreateAdapter(oid);
       
        // then
        assertEquals(oid, adapter.getOid());
        assertEquals(ResolveState.GHOST, adapter.getResolveState());
View Full Code Here


    public final RootOid createTransientOrViewModelOid(final Object pojo) {
        ObjectSpecification spec = getSpecificationLookup().loadSpecification(pojo.getClass());
        final ObjectSpecId objectSpecId = spec.getSpecId();
        final String transientIdentifier = identifierGenerator.createTransientIdentifierFor(objectSpecId, pojo);
        final State state = spec.containsFacet(ViewModelFacet.class)? State.VIEWMODEL:State.TRANSIENT;
        return new RootOidDefault(objectSpecId, transientIdentifier, state);
    }
View Full Code Here

        final ObjectSpecId objectSpecId = objectSpecIdFor(pojo);
        final String persistentIdentifier = identifierGenerator.createPersistentIdentifierFor(objectSpecId, pojo, transientRootOid);
       
        final ObjectSpecification spec = getSpecificationLookup().lookupBySpecId(objectSpecId);
        final State state = spec != null && spec.containsFacet(ViewModelFacet.class)? State.VIEWMODEL:State.PERSISTENT;
        return new RootOidDefault(objectSpecId, persistentIdentifier, state);
    }
View Full Code Here

    private Version version;

    @Before
    public void setUp() throws Exception {
        final ObjectSpecId objectSpecId = ObjectSpecId.of(objectType);
        oid = new RootOidDefault(objectSpecId, ""+1, State.TRANSIENT);

        spec = new ObjectSpecificationStub(this.getClass());
        spec.fields = Collections.emptyList();

        version = FileVersion.create("", System.currentTimeMillis());
View Full Code Here

    @Test
    public void testInsertObjectWithOneToManyAssociations() throws ObjectPersistenceException {
        final ObjectData data = createData(Team.class, 99, FileVersion.create("user", 13));

        data.initCollection("Members");
        final RootOidDefault oid[] = new RootOidDefault[3];
        for (int i = 0; i < oid.length; i++) {
            oid[i] = RootOidDefault.create(ObjectSpecId.of("TEA"), ""+ (104 + i));
            data.addElement("Members", oid[i]);
        }
        manager.insertObject(data);
View Full Code Here

    private ObjectData createData(final Class<?> type, final long id, final Version version) {

        final ObjectSpecification objSpec = IsisContext.getSpecificationLoader().loadSpecification(type);
        final ObjectSpecId objectSpecId = objSpec.getSpecId();
        final RootOidDefault oid = RootOidDefault.create(objectSpecId, ""+id);
        return new ObjectData(oid, version);
    }
View Full Code Here

                   
                    collection.addElement(oidFrom(attributes));
                }
            } else {
                if (tagName.equals("isis")) {
                    final RootOidDefault oid = oidFrom(attributes);
                    final Version fileVersion = fileVersionFrom(attributes);
                   
                    object = new ObjectData(oid, fileVersion);
                } else if (tagName.equals("collection")) {
                   
                    final RootOidDefault oid = oidFrom(attributes);
                    final Version fileVersion = fileVersionFrom(attributes);
                   
                    collection = new CollectionData(oid, fileVersion);
                } else {
                    throw new SAXException("Invalid data");
View Full Code Here

        @Override
        public void startElement(final String ns, final String name, final String tagName, final Attributes attrs) throws SAXException {
            if (tagName.equals("instance")) {
               
                final String oidStr = attrs.getValue("oid");
                final RootOidDefault oid = RootOidDefault.deString(oidStr, getOidMarshaller());
               
                instances.addElement(oid);
            }
        }
View Full Code Here

        // manually recreate the adapter in order to be able to query state via the metamodel
        ObjectAdapter viewModelAdapter = adapterManager.getAdapterFor(viewModelPojo);
        if(viewModelAdapter == null) {
            final ObjectSpecification objectSpecification = specificationLoader.loadSpecification(viewModelPojo.getClass());
            final ObjectSpecId objectSpecId = objectSpecification.getSpecId();
            viewModelAdapter = adapterManager.mapRecreatedPojo(new RootOidDefault(objectSpecId, mementoStr, Oid.State.VIEWMODEL), viewModelPojo);
        }

        final ObjectSpecification spec = viewModelAdapter.getSpecification();
        final List<OneToOneAssociation> properties = spec.getProperties(Contributed.EXCLUDED);
        for (OneToOneAssociation property : properties) {
View Full Code Here

    @Override
    public void execute(final PersistenceCommandContext context) throws ObjectPersistenceException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("  destroy object " + onAdapter());
        }
        final RootOidDefault oid = (RootOidDefault) onAdapter().getOid();
        getDataManager().remove(oid);
        onAdapter().setVersion(null);
    }
View Full Code Here

TOP

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

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.