Package info.archinnov.achilles.internal.context

Examples of info.archinnov.achilles.internal.context.PersistenceContext$DaoFacade


    @Test
    public void should_init_persistence_context_with_entity() throws Exception {
        // Given
        Object entity = new Object();
        Options options = OptionsBuilder.noOptions();
        PersistenceContext context = mock(PersistenceContext.class);
        PersistenceContext.PersistenceManagerFacade operations = mock(PersistenceContext.PersistenceManagerFacade.class);

        when(contextFactory.newContextWithFlushContext(entity, options, flushContext)).thenReturn(context);
        when(context.getPersistenceManagerFacade()).thenReturn(operations);

        // When
        PersistenceManagerOperations actual = batch.initPersistenceContext(entity, options);

        // Then
View Full Code Here


    @Test
    public void should_init_persistence_context_with_primary_key() throws Exception {
        // Given
        Object primaryKey = new Object();
        Options options = OptionsBuilder.noOptions();
        PersistenceContext context = mock(PersistenceContext.class);
        PersistenceContext.PersistenceManagerFacade operations = mock(PersistenceContext.PersistenceManagerFacade.class);

        when(contextFactory.newContextWithFlushContext(Object.class, primaryKey, options, flushContext)).thenReturn(context);
        when(context.getPersistenceManagerFacade()).thenReturn(operations);

        // When
        PersistenceManagerOperations actual = batch.initPersistenceContext(Object.class, primaryKey, options);

        // Then
View Full Code Here

        final ListenableFuture<Iterator<Row>> futureIterator = asyncUtils.transformFuture(resultSetFuture, RESULTSET_TO_ITERATOR, executorService);

        Function<Iterator<Row>, Iterator<T>> rowToIterator = new Function<Iterator<Row>, Iterator<T>>() {
            @Override
            public Iterator<T> apply(Iterator<Row> rowIterator) {
                PersistenceContext context = buildContextForQuery(sliceQueryProperties);
                return new SliceQueryIterator<>(sliceQueryProperties, context, rowIterator);
            }
        };
        final ListenableFuture<Iterator<T>> listenableFuture = asyncUtils.transformFuture(futureIterator, rowToIterator, executorService);
        asyncUtils.maybeAddAsyncListeners(listenableFuture, sliceQueryProperties.getAsyncListeners(), executorService);
View Full Code Here

        return new Function<List<T>, List<T>>() {
            @Override
            public List<T> apply(List<T> clusteredEntities) {
                final List<T> proxies = new ArrayList<>();
                for (T clusteredEntity : clusteredEntities) {
                    PersistenceContext context = contextFactory.newContext(clusteredEntity);
                    proxies.add(proxifier.buildProxyWithAllFieldsLoadedExceptCounters(clusteredEntity, context.getEntityFacade()));
                }
                return proxies;
            }
        };
    }
View Full Code Here

            propertiesMap.put(cql3ColumnName, pm);
        }
        return propertiesMap;
    }
    private T buildProxy(T entity) {
        PersistenceContext context = contextFactory.newContext(entity);
        entity = proxifier.buildProxyWithAllFieldsLoadedExceptCounters(entity, context.getEntityFacade());
        return entity;
    }
View Full Code Here

    public void remove() {
        throw new UnsupportedOperationException("Cannot remove clustered entity with iterator");
    }

    private T proxify(T clusteredEntity) {
        PersistenceContext duplicate = context.duplicate(clusteredEntity);
        return proxifier.buildProxyWithAllFieldsLoadedExceptCounters(clusteredEntity, duplicate.getEntityFacade());
    }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.internal.context.PersistenceContext$DaoFacade

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.