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

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


public class InMemoryObjectStore_serviceRegistry extends AbstractInMemoryObjectStoreTest {

    private TestProxyOid oid14;

    public void noServicesRegisteredWhenEmpty() throws Exception {
        final Oid oidForService = store.getOidForService("service name");
        assertEquals(null, oidForService);
    }
View Full Code Here


    }

    public void testOidForService() throws Exception {
        registerService14();

        final Oid oidForService = store.getOidForService("service name");
        assertEquals(oid14, oidForService);
    }
View Full Code Here

        assertEquals(reference, serialKeyCreator.reference(object));
    }

    @Test
    public void oid() throws Exception {
        final Oid oid = serialKeyCreator.oidFromReference(reference);
        assertEquals(SerialOid.createPersistent(3), oid);
    }
View Full Code Here

        getTransactionManager().startTransaction();
        for (final Object service : servicesInjector.getRegisteredServices()) {
            final ObjectSpecification serviceNoSpec = specificationLoader.loadSpecification(service.getClass());
            serviceNoSpec.markAsService();
            final String serviceId = ServiceUtil.id(service);
            final Oid existingOid = getOidForService(serviceId);
            ObjectAdapter adapter;
            if (existingOid == null) {
                adapter = getAdapterManager().adapterFor(service);
            } else {
                adapter = getAdapterManager().recreateRootAdapter(existingOid, service);
            }

            if (adapter.getOid().isTransient()) {
                adapterManager.remapAsPersistent(adapter);
            }

            if (adapter.getResolveState().canChangeTo(ResolveState.RESOLVING)) {
                adapter.changeState(ResolveState.RESOLVING);
                adapter.changeState(ResolveState.RESOLVED);
            }
            if (existingOid == null) {
                final Oid persistentOid = adapter.getOid();
                registerService(serviceId, persistentOid);
            }

        }
        getTransactionManager().endTransaction();
View Full Code Here

        }
        return serviceAdapters;
    }

    private ObjectAdapter getService(final Object service) {
        final Oid oid = getOidForService(ServiceUtil.id(service));
        return recreateAdapterForExistingService(oid, service);
    }
View Full Code Here

        debug.appendTitle("Services");
        for (final Object service : servicesInjector.getRegisteredServices()) {
            final String id = ServiceUtil.id(service);
            final String serviceClassName = service.getClass().getName();
            final Oid oidForService = getOidForService(id);
            final String serviceId = id + (id.equals(serviceClassName) ? "" : " (" + serviceClassName + ")");
            debug.appendln(oidForService != null ? oidForService.toString() : "[NULL]", serviceId);
        }
        debug.appendln();

    }
View Full Code Here

        return serviceOidByIdMap.get(name);
    }

    @Override
    public void registerService(final String name, final Oid oid) {
        final Oid oidLookedUpByName = serviceOidByIdMap.get(name);
        if (oidLookedUpByName != null) {
            if (oidLookedUpByName.equals(oid)) {
                throw new IsisException("Already another service registered as name: " + name + " (existing Oid: " + oidLookedUpByName + ", " + "intended: " + oid + ")");
            }
        } else {
            serviceOidByIdMap.put(name, oid);
        }
View Full Code Here

    public ObjectAdapter load(final StateReader reader, final KeyCreator keyCreator, final VersionCreator versionCreator, final Map<String, DataEncryption> dataEncrypters) {
        final String className = reader.readObjectType();
        final ObjectSpecification specification = IsisContext.getSpecificationLoader().loadSpecification(className);
        final String id = reader.readId();
        final Oid oid = keyCreator.oid(id);

        final ObjectAdapter object = getAdapter(specification, oid);
        if (object.getResolveState().isResolved()) {
            Version version = null;
            final String versionString = reader.readVersion();
View Full Code Here

            fieldObject = null;
        } else {
            if (ref.equals("")) {
                throw new NoSqlStoreException("Invalid reference field (an empty string) in data for " + association.getName() + "  in " + object);
            }
            final Oid oid = keyCreator.oidFromReference(ref);
            final ObjectSpecification specification = keyCreator.specificationFromReference(ref);
            fieldObject = getAdapter(specification, oid);
        }
        try {
            association.initAssociation(object, fieldObject);
View Full Code Here

    private ObjectAdapter[] restoreElements(final String referencesList, final KeyCreator keyCreator) {
        final String[] references = referencesList.split("\\|");
        final ObjectAdapter[] elements = new ObjectAdapter[references.length];
        for (int i = 0; i < references.length; i++) {
            final ObjectSpecification specification = keyCreator.specificationFromReference(references[i]);
            final Oid oid = keyCreator.oidFromReference(references[i]);
            elements[i] = getAdapter(specification, oid);
        }
        return elements;
    }
View Full Code Here

TOP

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

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.