Class AbstractSpecificationInterceptor<T,R>
java.lang.Object
io.micronaut.data.runtime.intercept.AbstractQueryInterceptor<T,R>
io.micronaut.data.runtime.intercept.criteria.AbstractSpecificationInterceptor<T,R>
- Type Parameters:
T
- The declaring typeR
- The return type
- All Implemented Interfaces:
DataInterceptor<T,
R>
- Direct Known Subclasses:
AbstractAsyncSpecificationInterceptor
,AbstractReactiveSpecificationInterceptor
,CountSpecificationInterceptor
,DeleteAllSpecificationInterceptor
,ExistsSpecificationInterceptor
,FindAllSpecificationInterceptor
,FindOneSpecificationInterceptor
,FindPageSpecificationInterceptor
,UpdateAllSpecificationInterceptor
@Internal
public abstract class AbstractSpecificationInterceptor<T,R>
extends AbstractQueryInterceptor<T,R>
Abstract specification interceptor.
- Since:
- 3.2
- Author:
- Denis Stepanov
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final jakarta.persistence.criteria.CriteriaBuilder
protected final CriteriaRepositoryOperations
protected static final String
Fields inherited from class io.micronaut.data.runtime.intercept.AbstractQueryInterceptor
conversionService, operations, preparedQueryResolver
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractSpecificationInterceptor
(RepositoryOperations operations) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected final Pageable
applyPaginationAndSort
(Pageable pageable, jakarta.persistence.criteria.CriteriaQuery<?> criteriaQuery, boolean singleResult) protected final @NonNull jakarta.persistence.criteria.CriteriaQuery<Long>
buildCountQuery
(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) protected final <E> @NonNull jakarta.persistence.criteria.CriteriaDelete<E>
buildDeleteQuery
(io.micronaut.aop.MethodInvocationContext<?, ?> context) protected final <E> @NonNull jakarta.persistence.criteria.CriteriaQuery<E>
buildExistsQuery
(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) protected final jakarta.persistence.criteria.CriteriaQuery<jakarta.persistence.Tuple>
buildIdsQuery
(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context, Sort sort) protected final <N> @NonNull jakarta.persistence.criteria.CriteriaQuery<N>
buildQuery
(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) protected final <E> @NonNull jakarta.persistence.criteria.CriteriaUpdate<E>
buildUpdateQuery
(io.micronaut.aop.MethodInvocationContext<?, ?> context) protected final <T> List<T>
findAll
(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context, Pageable pageable, jakarta.persistence.criteria.CriteriaQuery<T> criteriaQuery) protected <K> @NonNull CriteriaDeleteBuilder<K>
getCriteriaDeleteBuilder
(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindCriteriaDeleteBuilder
orQuerySpecification
in context.protected final <K> @NonNull CriteriaQueryBuilder<K>
getCriteriaQueryBuilder
(io.micronaut.aop.MethodInvocationContext<?, ?> context, Set<JoinPath> joinPaths) FindCriteriaQueryBuilder
orQuerySpecification
in context.protected <K> @NonNull CriteriaUpdateBuilder<K>
getCriteriaUpdateBuilder
(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindCriteriaUpdateBuilder
orQuerySpecification
in context.protected <K> @Nullable DeleteSpecification<K>
getDeleteSpecification
(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindDeleteSpecification
in context.protected final jakarta.persistence.criteria.Expression<?>
getIdExpression
(jakarta.persistence.criteria.Root<?> root) protected final @NonNull CriteriaQueryBuilder<jakarta.persistence.Tuple>
getIdsCriteriaQueryBuilder
(io.micronaut.aop.MethodInvocationContext<?, ?> context, Set<JoinPath> joinPaths, Sort sort) getMethodJoinPaths
(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) protected @NonNull Pageable
getPageable
(io.micronaut.aop.MethodInvocationContext<?, ?> context) Resolves thePageable
for the given context.protected final @NonNull QueryBuilder
getQueryBuilder
(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) protected <K> @Nullable QuerySpecification<K>
getQuerySpecification
(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindQuerySpecification
in context.protected <K> @Nullable UpdateSpecification<K>
getUpdateSpecification
(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindUpdateSpecification
in context.Methods inherited from class io.micronaut.data.runtime.intercept.AbstractQueryInterceptor
convertOne, convertOne, count, findEntitiesParameter, findEntityParameter, getDeleteAllBatchOperation, getDeleteBatchOperation, getDeleteBatchOperation, getDeleteOperation, getDeleteReturningBatchOperation, getDeleteReturningOperation, getEntitiesParameter, getEntityParameter, getInsertBatchOperation, getInsertBatchOperation, getInsertOperation, getInsertOperation, getLimit, getOffset, getPageableInRole, getPagedQuery, getParameterInRole, getParameterValueMap, getRequiredEntity, getRequiredParameterInRole, getRequiredRootEntity, getReturnType, getUpdateAllBatchOperation, getUpdateOperation, getUpdateOperation, instantiateEntity, isNullable, isNumber, prepareCountQuery, prepareQuery, validateNullArguments
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.data.intercept.DataInterceptor
intercept
-
Field Details
-
PREPARED_QUERY_KEY
- See Also:
-
criteriaRepositoryOperations
-
criteriaBuilder
protected final jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder
-
-
Constructor Details
-
AbstractSpecificationInterceptor
Default constructor.- Parameters:
operations
- The operations
-
-
Method Details
-
findAll
protected final <T> List<T> findAll(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context, Pageable pageable, jakarta.persistence.criteria.CriteriaQuery<T> criteriaQuery) -
getMethodJoinPaths
protected final Set<JoinPath> getMethodJoinPaths(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) -
getPageable
@NonNull protected @NonNull Pageable getPageable(io.micronaut.aop.MethodInvocationContext<?, ?> context) Description copied from class:AbstractQueryInterceptor
Resolves thePageable
for the given context.- Overrides:
getPageable
in classAbstractQueryInterceptor<T,
R> - Parameters:
context
- The pageable- Returns:
- The pageable or null
-
getQueryBuilder
@NonNull protected final @NonNull QueryBuilder getQueryBuilder(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) -
buildExistsQuery
@NonNull protected final <E> @NonNull jakarta.persistence.criteria.CriteriaQuery<E> buildExistsQuery(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) -
buildUpdateQuery
@NonNull protected final <E> @NonNull jakarta.persistence.criteria.CriteriaUpdate<E> buildUpdateQuery(io.micronaut.aop.MethodInvocationContext<?, ?> context) -
buildDeleteQuery
@NonNull protected final <E> @NonNull jakarta.persistence.criteria.CriteriaDelete<E> buildDeleteQuery(io.micronaut.aop.MethodInvocationContext<?, ?> context) -
buildCountQuery
@NonNull protected final @NonNull jakarta.persistence.criteria.CriteriaQuery<Long> buildCountQuery(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) -
buildQuery
@NonNull protected final <N> @NonNull jakarta.persistence.criteria.CriteriaQuery<N> buildQuery(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context) -
applyPaginationAndSort
-
buildIdsQuery
protected final jakarta.persistence.criteria.CriteriaQuery<jakarta.persistence.Tuple> buildIdsQuery(RepositoryMethodKey methodKey, io.micronaut.aop.MethodInvocationContext<?, ?> context, Sort sort) -
getQuerySpecification
@Nullable protected <K> @Nullable QuerySpecification<K> getQuerySpecification(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindQuerySpecification
in context.- Type Parameters:
K
- the specification entity root type- Parameters:
context
- The context- Returns:
- found specification
-
getCriteriaQueryBuilder
@NonNull protected final <K> @NonNull CriteriaQueryBuilder<K> getCriteriaQueryBuilder(io.micronaut.aop.MethodInvocationContext<?, ?> context, Set<JoinPath> joinPaths) FindCriteriaQueryBuilder
orQuerySpecification
in context.- Type Parameters:
K
- the result type- Parameters:
context
- The contextjoinPaths
- The join fetch paths- Returns:
- found specification
-
getIdsCriteriaQueryBuilder
@NonNull protected final @NonNull CriteriaQueryBuilder<jakarta.persistence.Tuple> getIdsCriteriaQueryBuilder(io.micronaut.aop.MethodInvocationContext<?, ?> context, Set<JoinPath> joinPaths, Sort sort) -
getIdExpression
protected final jakarta.persistence.criteria.Expression<?> getIdExpression(jakarta.persistence.criteria.Root<?> root) -
getDeleteSpecification
@Nullable protected <K> @Nullable DeleteSpecification<K> getDeleteSpecification(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindDeleteSpecification
in context.- Type Parameters:
K
- the specification entity root type- Parameters:
context
- The context- Returns:
- found specification
-
getCriteriaDeleteBuilder
@NonNull protected <K> @NonNull CriteriaDeleteBuilder<K> getCriteriaDeleteBuilder(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindCriteriaDeleteBuilder
orQuerySpecification
in context.- Type Parameters:
K
- the result type- Parameters:
context
- The context- Returns:
- found specification
-
getUpdateSpecification
@Nullable protected <K> @Nullable UpdateSpecification<K> getUpdateSpecification(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindUpdateSpecification
in context.- Type Parameters:
K
- the specification entity root type- Parameters:
context
- The context- Returns:
- found specification
-
getCriteriaUpdateBuilder
@NonNull protected <K> @NonNull CriteriaUpdateBuilder<K> getCriteriaUpdateBuilder(io.micronaut.aop.MethodInvocationContext<?, ?> context) FindCriteriaUpdateBuilder
orQuerySpecification
in context.- Type Parameters:
K
- the result type- Parameters:
context
- The context- Returns:
- found specification
-