Class JpaCustomizedDataDrivenEnumRepository<D extends JpaDataDrivenEnum>
java.lang.Object
com.broadleafcommerce.catalog.provider.jpa.repository.enumeration.JpaCustomizedDataDrivenEnumRepository<D>
- All Implemented Interfaces:
CustomizedDataDrivenEnumRepository<D>
,org.springframework.beans.factory.InitializingBean
public class JpaCustomizedDataDrivenEnumRepository<D extends JpaDataDrivenEnum>
extends Object
implements CustomizedDataDrivenEnumRepository<D>, org.springframework.beans.factory.InitializingBean
- Author:
- Sunny Yu
-
Constructor Summary
ConstructorsConstructorDescriptionJpaCustomizedDataDrivenEnumRepository
(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filterRulesCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected LinkedRSQLQueryDetails
applyRsqlCriteria
(cz.jirutka.rsql.parser.ast.Node filters, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.CriteriaQuery<?> nativeQuery, Map<String, Object> nativeQueryParams, List<jakarta.persistence.criteria.Predicate> nativePredicates) Processes the givenfilters
to build and apply the necessaryPredicate
for RSQL.protected jakarta.persistence.criteria.Predicate
buildContextIdInFilter
(Collection<String> contextIds, jakarta.persistence.criteria.Root<D> dataDrivenEnumEntity, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) findAllByContextIdIn
(Collection<String> contextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves all data driven enums whose context IDs match any of the given IDs.findAllByContextIdIn
(Collection<String> contextIds, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) findDistinctTypes
(@NonNull cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves all distinct data driven enum types.protected jakarta.persistence.EntityManager
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper
protected DataDrivenEnumRepository<D>
protected cz.jirutka.rsql.parser.RSQLParser
void
setRepository
(DataDrivenEnumRepository<D> repository) void
setRsqlParser
(cz.jirutka.rsql.parser.RSQLParser rsqlParser) void
setRsqlQueryTransformers
(List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers) void
setRsqlVisitor
(com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor rsqlVisitor)
-
Constructor Details
-
JpaCustomizedDataDrivenEnumRepository
public JpaCustomizedDataDrivenEnumRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filterRulesCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
setRepository
-
setRsqlQueryTransformers
@Autowired @Lazy public void setRsqlQueryTransformers(List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers) -
setRsqlVisitor
@Autowired @Lazy public void setRsqlVisitor(com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor rsqlVisitor) -
findAllByContextIdIn
public Stream<D> findAllByContextIdIn(Collection<String> contextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedDataDrivenEnumRepository
Retrieves all data driven enums whose context IDs match any of the given IDs.- Specified by:
findAllByContextIdIn
in interfaceCustomizedDataDrivenEnumRepository<D extends JpaDataDrivenEnum>
- Parameters:
contextIds
- the context IDs to query forcontextInfo
- context information around sandbox and multitenant state- Returns:
- all data driven enums whose context IDs match any of the given IDs
-
findAllByContextIdIn
public Stream<D> findAllByContextIdIn(Collection<String> contextIds, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
findAllByContextIdIn
in interfaceCustomizedDataDrivenEnumRepository<D extends JpaDataDrivenEnum>
-
findDistinctTypes
public List<String> findDistinctTypes(@NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedDataDrivenEnumRepository
Retrieves all distinct data driven enum types.- Specified by:
findDistinctTypes
in interfaceCustomizedDataDrivenEnumRepository<D extends JpaDataDrivenEnum>
- Parameters:
filters
- additional filters to apply in the querycontextInfo
- context information around sandbox and multitenant state- Returns:
- all distinct data driven enum types
-
buildContextIdInFilter
-
applyRsqlCriteria
protected LinkedRSQLQueryDetails applyRsqlCriteria(cz.jirutka.rsql.parser.ast.Node filters, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.CriteriaQuery<?> nativeQuery, Map<String, Object> nativeQueryParams, List<jakarta.persistence.criteria.Predicate> nativePredicates) Processes the givenfilters
to build and apply the necessaryPredicate
for RSQL.- Parameters:
filters
- RSQL filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.criteriaBuilder
- the criteria builder used to generate parameters/predicates. Only used as an argument to populate theCriteriaContext
inCriteriaContext.withBuilder(CriteriaBuilder)
.nativeQuery
- the native query for the original request. Only used as an argument to populate theCriteriaContext
inCriteriaContext.withCriteriaQuery(AbstractQuery)
.nativeQueryParams
- the parameter values for thenativeQuery
. Only used as an argument to populate theCriteriaContext
inCriteriaContext.withNarrowingParams(Map)
.nativePredicates
- the list of predicates that will be applied onnativeQuery
. If thefilters
are not for linked fields, then thePredicate
will be added to this list.- Returns:
- the
CriteriaContext.getLinkedQuery()
andCriteriaContext.getLinkedNarrowingParams()
that were produced during processing. While the wrapper object will not be null, any/all of its fields can be (for example, if the filters were not on linked fields). These values are useful for ultimately being supplied toJpaNarrowingHelper.JpaCriterias
.
-
getManagedType
-
getNarrowingHelper
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper getNarrowingHelper() -
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager() -
getRsqlParser
protected cz.jirutka.rsql.parser.RSQLParser getRsqlParser() -
setRsqlParser
public void setRsqlParser(cz.jirutka.rsql.parser.RSQLParser rsqlParser) -
getRepository
-