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 TypeMethodDescriptionvoidprotected LinkedRSQLQueryDetailsapplyRsqlCriteria(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 givenfiltersto build and apply the necessaryPredicatefor RSQL.protected jakarta.persistence.criteria.PredicatebuildContextIdInFilter(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.EntityManagerprotected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelperprotected DataDrivenEnumRepository<D>protected cz.jirutka.rsql.parser.RSQLParservoidsetRepository(DataDrivenEnumRepository<D> repository) voidsetRsqlParser(cz.jirutka.rsql.parser.RSQLParser rsqlParser) voidsetRsqlQueryTransformers(List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers) voidsetRsqlVisitor(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:
afterPropertiesSetin 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:CustomizedDataDrivenEnumRepositoryRetrieves all data driven enums whose context IDs match any of the given IDs.- Specified by:
findAllByContextIdInin 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:
findAllByContextIdInin 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:CustomizedDataDrivenEnumRepositoryRetrieves all distinct data driven enum types.- Specified by:
findDistinctTypesin 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 givenfiltersto build and apply the necessaryPredicatefor RSQL.- Parameters:
filters- RSQL filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.criteriaBuilder- the criteria builder used to generate parameters/predicates. Only used as an argument to populate theCriteriaContextinCriteriaContext.withBuilder(CriteriaBuilder).nativeQuery- the native query for the original request. Only used as an argument to populate theCriteriaContextinCriteriaContext.withCriteriaQuery(AbstractQuery).nativeQueryParams- the parameter values for thenativeQuery. Only used as an argument to populate theCriteriaContextinCriteriaContext.withNarrowingParams(Map).nativePredicates- the list of predicates that will be applied onnativeQuery. If thefiltersare not for linked fields, then thePredicatewill 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
-