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

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


        services = handler.services;
    }

    @Override
    public void registerService(final RootOid rootOid) {
        final RootOidDefault soid = (RootOidDefault) rootOid;
        final ServiceElement element = new ServiceElement(soid);
        services.add(element);
        saveServices();
    }
View Full Code Here


        if (size > 0) {
            writer.append("  <multiple-association field=\"" + field + "\" ");
            writer.append(">\n");
            for (int i = 0; i < size; i++) {
                final Object oid = references.elementAt(i);
                final RootOidDefault rootOidDefault = (RootOidDefault) oid;
                if (rootOidDefault.isTransient()) {
                    throw new ObjectPersistenceException("Can't add tranisent OID (" + oid + ") to " + field + " element.");
                }
                writer.append("    <element ");
                Utils.appendAttribute(writer, "oid", rootOidDefault.enString(getOidMarshaller()));
                writer.append("/>\n");
            }
            writer.append("  </multiple-association>\n");
            writer.flush();
        }
View Full Code Here

        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

        sql.append(Defaults.getPkIdLabel());
        sql.append(", ");
        sql.append(Defaults.getIdColumn());
        sql.append(") values (?,?)");

        final RootOidDefault sqlOid = (RootOidDefault) rootOid;
        connector.addToQueryValues(sqlOid.getIdentifier());
        connector.addToQueryValues(rootOid.getObjectSpecId().asString());

        connector.insert(sql.toString());
        connectionPool.release(connector);
    }
View Full Code Here

        final Object object = rs.getObject(column);
        if (object == null) {
            return null;
        }
        final int id = ((Integer) object).intValue();
        return new RootOidDefault(specification.getSpecId(), "" + id, Oid.State.PERSISTENT);
    }
View Full Code Here

    public void whenJavaxJdoIntIdentity() throws Exception {
        Object jdoObjectId = new javax.jdo.identity.IntIdentity(Customer.class, 123);
        String id = JdoObjectIdSerializer.toOidIdentifier(jdoObjectId);
        assertThat(id, is("i_123"));
       
        RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
        Object jdoObjectIdRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
       
        assertThat(jdoObjectIdRecreated, is(jdoObjectId));
    }
View Full Code Here

    public void whenJavaxJdoStringIdentity() throws Exception {
        Object jdoObjectId = new javax.jdo.identity.StringIdentity(Customer.class, "123");
        String id = JdoObjectIdSerializer.toOidIdentifier(jdoObjectId);
        assertThat(id, is("s_123"));
       
        RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
        Object jdoObjectIdRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
       
        assertThat(jdoObjectIdRecreated, is(jdoObjectId));
    }
View Full Code Here

    public void whenJavaxJdoLongIdentity() throws Exception {
        Object jdoObjectId = new javax.jdo.identity.LongIdentity(Customer.class, 123L);
        String id = JdoObjectIdSerializer.toOidIdentifier(jdoObjectId);
        assertThat(id, is("l_123"));
       
        RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
        Object jdoObjectIdRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
       
        assertThat(jdoObjectIdRecreated, is(jdoObjectId));
    }
View Full Code Here

    public void whenLong() throws Exception {
        Object jdoOid = new OIDImpl(Customer.class.getName(), 123L);
        String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
        assertThat(id, is("L_123"));
       
        RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
        Object jdoOidRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);

        assertThat(jdoOidRecreated, is((Object)("123"+ "[OID]" + Customer.class.getName())));
    }
View Full Code Here

    public void whenDataNucleusOidAndLong() throws Exception {
        Object jdoOid = new OIDImpl(Customer.class.getName(), 123L);
        String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
        assertThat(id, is("L_123"));
       
        RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
        Object jdoOidRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);

        assertThat(jdoOidRecreated, is((Object)("123"+ "[OID]" + Customer.class.getName())));
    }
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.