Package org.apache.isis.core.runtime.system.persistence

Examples of org.apache.isis.core.runtime.system.persistence.PersistenceSession


        return adapter;
    }

    @SuppressWarnings("unchecked")
    public <T extends ObjectStoreSpi> T getObjectStore(Class<T> cls) {
        final PersistenceSession persistenceSession = getPersistenceSession();
        return (T) persistenceSession.getObjectStore();
    }
View Full Code Here


            }
        } catch (final NotLoggedInException e) {
            redirectToLoginPage(context);
        } catch (final Throwable e) {
            ErrorCollator error = new ErrorCollator();
            final PersistenceSession checkSession = IsisContext.getPersistenceSession();
            final IsisTransactionManager transactionManager = checkSession.getTransactionManager();
            if (transactionManager.getTransaction() != null && transactionManager.getTransaction().getState().canAbort()) {
                transactionManager.abortTransaction();
                transactionManager.startTransaction();
            }
View Full Code Here

            // eg "NONEXISTENT:123"
            return null;
        }

        // TODO: the logic to figure out which PersistenceSession API to call should be pushed down into PersistenceSession itself.
        final PersistenceSession persistenceSession = rendererContext.getPersistenceSession();

        if(spec.containsFacet(ViewModelFacet.class)) {

            // this is a hack; the RO viewer when rendering the URL for the view model loses the "view model" indicator
            // ("*") from the specId, meaning that the marshalling logic above in RootOidDefault.deString() creates an
            // oid in the wrong state.  The code below checks for this and recreates the oid with the current state of 'view model'
            if(!rootOid.isViewModel()) {
                rootOid = new RootOidDefault(rootOid.getObjectSpecId(), rootOid.getIdentifier(), Oid.State.VIEWMODEL);
            }

            try {
                return persistenceSession.getAdapterManager().adapterFor(rootOid);
            } catch(final ObjectNotFoundException ex) {
                return null;
            } catch(final PojoRecreationException ex) {
                return null;
            }
        } else {
            try {
                ObjectAdapter objectAdapter = persistenceSession.loadObject(rootOid);
                return objectAdapter.isTransient() ? null : objectAdapter;
            } catch(final ObjectNotFoundException ex) {
                return null;
            }
        }
View Full Code Here

        return adapter;
    }

    @SuppressWarnings("unchecked")
    public <T extends ObjectStoreSpi> T getObjectStore(Class<T> cls) {
        final PersistenceSession persistenceSession = getPersistenceSession();
        return (T) persistenceSession.getObjectStore();
    }
View Full Code Here

    }


    @Override
    public IsisSession openSession(final AuthenticationSession authenticationSession) {
        final PersistenceSession persistenceSession = persistenceSessionFactory.createPersistenceSession();
        ensureThatArg(persistenceSession, is(not(nullValue())));

        final UserProfile userProfile = userProfileLoader.getProfile(authenticationSession);
        ensureThatArg(userProfile, is(not(nullValue())));
View Full Code Here

        if (getConfiguration().getBoolean(LOGGING_PROPERTY, false)) {
            final String level = getConfiguration().getString(LOGGING_PROPERTY + ".level", "debug");
            objectStore = new IsisObjectStoreLogger(objectStore, level);
        }
       
        final PersistenceSession persistenceSession =
                new PersistenceSession(persistenceSessionFactory, adapterFactory, objectFactory, servicesInjector, identifierGenerator, adapterManager, persistAlgorithm, objectStore);
       
        final IsisTransactionManager transactionManager = createTransactionManager(persistenceSession, objectStore, servicesInjector);
       
        ensureThatArg(persistenceSession, is(not(nullValue())));
        ensureThatArg(transactionManager, is(not(nullValue())));
       
        persistenceSession.setDirtiableSupport(true);
        persistenceSession.setTransactionManager(transactionManager);
       
        return persistenceSession;
    }
View Full Code Here

        servicesInjector = new ServicesInjectorDefault();
        servicesInjector.setContainer(container);

        adapterManager = new AdapterManagerDefault(new PojoRecreatorDefault());
        adapterFactory = new PojoAdapterFactory();
        persistenceSession = new PersistenceSession(mockPersistenceSessionFactory, adapterFactory, objectFactory, servicesInjector, new OidGenerator(new IdentifierGeneratorDefault()), adapterManager, mockPersistAlgorithm, mockObjectStore) {
            @Override
            protected SpecificationLoaderSpi getSpecificationLoader() {
                return isisMetaModel.getSpecificationLoader();
            }
           
View Full Code Here

   
    protected ObjectAdapter epv2Adapter;
    protected ObjectSpecification epvSpecification;

    protected ObjectStoreSpi getStore() {
        PersistenceSession psos = IsisContext.getPersistenceSession();
        return (ObjectStoreSpi) psos.getObjectStore();
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.runtime.system.persistence.PersistenceSession

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.