Class CriteriaAggregateQueryBuilder
java.lang.Object
ch.tocco.nice2.persist.core.impl.hibernate.query.QueryBuilderBaseImpl<AggregateQueryBuilder, AggregateQueryWrapper>
ch.tocco.nice2.persist.core.impl.hibernate.query.AbstractCriteriaBuilder<AggregateQueryBuilder, Object[], AggregateQueryWrapper>
ch.tocco.nice2.persist.core.impl.hibernate.query.CriteriaAggregateQueryBuilder
- All Implemented Interfaces:
AggregateQueryBuilder, QueryBuilderBase<AggregateQueryBuilder, AggregateQueryWrapper>
public class CriteriaAggregateQueryBuilder
extends AbstractCriteriaBuilder<AggregateQueryBuilder, Object[], AggregateQueryWrapper>
implements AggregateQueryBuilder
A criteria builder that calculates all its
Aggregate with a single query.
The aggregates are calculated by the database, therefore the permissions of an aggregated field cannot be
evaluated per row afterwards (normally done by SecureQueryInterceptor.SecureSelectionInterceptor#handlePermissions,
which nullifies the value of a field the current user may not read). The QueryBuilderInterceptor are
therefore called manually, and their conditions are applied to the aggregated expression itself
(sum(case when <condition> then <field> end)) instead of the where clause: aggregate functions ignore
null values, so every aggregate keeps its own row filter even though all of them share one query.
A field that may not be used in a query at all (privileged access only) is rejected by the interceptor itself.-
Field Summary
Fields inherited from class AbstractCriteriaBuilder
criteriaBuilder, jdbcFunctions, parameterProviders, parameters, predicateFactory, query, queryRoot, session, subqueryFactoryFields inherited from class QueryBuilderBaseImpl
collector, conditionFactory, dataModel, fieldResolver, insecureEnabled, interceptors, predicates, queryHints, typeManager -
Constructor Summary
ConstructorsConstructorDescriptionCriteriaAggregateQueryBuilder(org.hibernate.Session session, Class<? extends Entity> entityClass, List<Aggregate<?>> requestedAggregates, List<QueryBuilderInterceptor> interceptors, TypeManager typeManager, DataModel dataModel, ConditionFactory conditionFactory, FieldResolver fieldResolver, Map<String, JdbcFunction> jdbcFunctions, Map<String, ParameterProvider<?>> parameterProviders, Map<String, ?> queryHints, InsecureOrderPathsRegistry insecureOrderPathsRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected AggregateQueryWrapperdoBuild()protected QueryBuilderInterceptor.QueryBuilderTypeprotected AggregateQueryBuilderself()Methods inherited from class AbstractCriteriaBuilder
addParameter, applyParametersToQuery, createQuery, getCriteriaBuilder, getPredicateFactory, getQueryRoot, getSubqueryFactoryMethods inherited from class QueryBuilderBaseImpl
build, doInsecure, getPredicates, initializationCompleted, where, where, where, where, whereInsecure, whereInsecure, whereInsecureMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface QueryBuilderBase
addParameter, build, getCriteriaBuilder, getPredicates, getQueryRoot, getSubqueryFactory, where, where, where, where, where, whereInsecure, whereInsecure, whereInsecure
-
Constructor Details
-
CriteriaAggregateQueryBuilder
public CriteriaAggregateQueryBuilder(org.hibernate.Session session, Class<? extends Entity> entityClass, List<Aggregate<?>> requestedAggregates, List<QueryBuilderInterceptor> interceptors, TypeManager typeManager, DataModel dataModel, ConditionFactory conditionFactory, FieldResolver fieldResolver, Map<String, JdbcFunction> jdbcFunctions, Map<String, ParameterProvider<?>> parameterProviders, Map<String, ?> queryHints, InsecureOrderPathsRegistry insecureOrderPathsRegistry)
-
-
Method Details
-
getPermission
- Specified by:
getPermissionin classQueryBuilderBaseImpl<AggregateQueryBuilder, AggregateQueryWrapper>
-
self
- Specified by:
selfin classQueryBuilderBaseImpl<AggregateQueryBuilder, AggregateQueryWrapper>
-
doBuild
- Specified by:
doBuildin classQueryBuilderBaseImpl<AggregateQueryBuilder, AggregateQueryWrapper>
-