Package org.apache.isis.core.metamodel.spec

Examples of org.apache.isis.core.metamodel.spec.ObjectSpecId


     * <p>
     * This is used by {@link Aggregated} references (either referenced by properties or by
     * collections).
     */
    public AggregatedOid createAggregateOid(final Object pojo, final ObjectAdapter parentAdapter) {
        final ObjectSpecId objectSpecId = objectSpecIdFor(pojo);
        final String aggregateLocalId = identifierGenerator.createAggregateLocalId(objectSpecId, pojo, parentAdapter);
        return new AggregatedOid(objectSpecId, (TypedOid) parentAdapter.getOid(), aggregateLocalId);
    }
View Full Code Here


     * @param pojo - being persisted
     * @param transientRootOid - the oid for the pojo when transient.
     */
    public final RootOid createPersistentOrViewModelOid(Object pojo, RootOid transientRootOid) {

        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

        assertThat(marshal, equalTo("CUS:123^90807:joebloggs:"));
    }

    @Test
    public void rootOid_versionSequenceAndUserThatHasAnAtSymbol() {
        final ObjectSpecId objectSpecId = ObjectSpecId.of("CUS");
        final RootOidDefault oid = RootOidDefault.create(objectSpecId,  "123", 90807L, "joebloggs@foo.bar");
        final String marshal = oidMarshaller.marshal(oid);
        assertThat(marshal, equalTo("CUS:123^90807:joebloggs@foo.bar:"));
    }
View Full Code Here

public class RootOidDefaultTest_create  {


    @Test
    public void create() throws Exception {
        ObjectSpecId objectSpecId = ObjectSpecId.of("CUS");
        RootOidDefault oid = RootOidDefault.create(objectSpecId, "123");
        assertThat(oid.getObjectSpecId(), is(objectSpecId));
        assertThat(oid.getIdentifier(), is("123"));
        assertThat(oid.getVersion(), is(nullValue()));
       
View Full Code Here

        assertThat(oid.isTransient(), is(false));
    }
   
    @Test
    public void createTransient() throws Exception {
        ObjectSpecId objectSpecId = ObjectSpecId.of("CUS");
        RootOidDefault oid = RootOidDefault.createTransient(objectSpecId, "123");
        assertThat(oid.getObjectSpecId(), is(objectSpecId));
        assertThat(oid.getIdentifier(), is("123"));
        assertThat(oid.getVersion(), is(nullValue()));
       
View Full Code Here

    }

   
    @Test
    public void createWithVersion() throws Exception {
        ObjectSpecId objectSpecId = ObjectSpecId.of("CUS");
        RootOidDefault oid = RootOidDefault.create(objectSpecId, "123", 456L);
        assertThat(oid.getObjectSpecId(), is(objectSpecId));
        assertThat(oid.getIdentifier(), is("123"));
        assertThat(oid.getVersion().getSequence(), is(456L));
       
View Full Code Here

        assertThat(oid.isTransient(), is(false));
    }
   
    @Test
    public void createTransientNoVersion() throws Exception {
        ObjectSpecId objectSpecId = ObjectSpecId.of("CUS");
        RootOidDefault oid = RootOidDefault.createTransient(objectSpecId, "123");
        assertThat(oid.getObjectSpecId(), is(objectSpecId));
        assertThat(oid.getIdentifier(), is("123"));
        assertThat(oid.getVersion(), is(nullValue()));
       
View Full Code Here

    public boolean hasServices() {
        return servicesInjector.getRegisteredServices().size() > 0;
    }

    private RootOid getOidForServiceFromPersistenceLayer(ObjectSpecification serviceSpecification) {
        final ObjectSpecId objectSpecId = serviceSpecification.getSpecId();
        RootOid oid = servicesByObjectType.get(objectSpecId);
        if (oid == null) {
            oid = objectStore.getOidForService(serviceSpecification);
            servicesByObjectType.put(objectSpecId, oid);
        }
View Full Code Here

        final RootOid persistedRootOid;
        if(hintRootOid != null) {
            if(hintRootOid.isTransient()) {
                throw new IsisAssertException("hintRootOid must be persistent");
            }
            final ObjectSpecId hintRootOidObjectSpecId = hintRootOid.getObjectSpecId();
            final ObjectSpecId adapterObjectSpecId = adapter.getSpecification().getSpecId();
            if(!hintRootOidObjectSpecId.equals(adapterObjectSpecId)) {
                throw new IsisAssertException("hintRootOid's objectType must be same as that of adapter " +
                    "(was: '" + hintRootOidObjectSpecId + "'; adapter's is " + adapterObjectSpecId + "'");
            }
            // ok
View Full Code Here

    private RootOidDefault oid;
    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();
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.spec.ObjectSpecId

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.