Class JpaCustomizedContentItemRepository<D extends JpaContentItem>
java.lang.Object
com.broadleafcommerce.content.provider.jpa.repository.JpaCustomizedContentItemRepository<D>
- All Implemented Interfaces:
 CustomizedContentItemRepository<D>,org.springframework.beans.factory.InitializingBean
public class JpaCustomizedContentItemRepository<D extends JpaContentItem>
extends Object
implements CustomizedContentItemRepository<D>, org.springframework.beans.factory.InitializingBean
- Author:
 - Nathan Moore (nathandmoore)
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final String - 
Constructor Summary
ConstructorsConstructorDescriptionJpaCustomizedContentItemRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, cz.jirutka.rsql.parser.ast.RSQLVisitor<jakarta.persistence.criteria.Predicate, Class<?>> rsqlVisitor, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder catalogFilterRuleCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)  - 
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddActiveDateRangePredicate(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate to filter for active items by a content item's active date rangeprotected voidaddEmbeddedFilterPredicate(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates) Adds a predicate to filter out content items marked as embeddedprotected voidaddInactiveDateRangePredicate(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate to filter for inactive items by a content item's active date rangeprotected voidaddNamePredicate(String nameQuery, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate for filtering by a content item's name "like" the passed in stringprotected voidaddPredicateForField(String field, String query, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate for filtering by a field on content item "like" the passed in stringvoidprotected LinkedRSQLQueryDetailsapplyRsqlCriteria(cz.jirutka.rsql.parser.ast.Node filters, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.CriteriaQuery<D> nativeQuery, Map<String, Object> nativeQueryParams, List<jakarta.persistence.criteria.Predicate> nativePredicates) Processes the givenfiltersto build and apply the necessaryPredicatefor RSQL.org.springframework.data.domain.Page<D>findAllActiveByName(String nameQuery, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list of all active content items that are associated with the givenmodel.org.springframework.data.domain.Page<D>findAllByQuery(String query, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list of all content items that are associate with the given queryorg.springframework.data.domain.Page<D>findAllInactiveByName(String nameQuery, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns a list of allContentItems that are currently inactive.findByCombinedModelAndItemUris(String uri, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Takes the givenuriand returns the item where the combination ofits URIand itsContentModel's URImatches.protected org.springframework.data.domain.Page<D>getActiveFilteredResults(@NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Class<D> entityType, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.CriteriaQuery<D> criteria, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) protected com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtilprotected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilderprotected jakarta.persistence.EntityManagerprotected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelpergetQuerySearchTokens(String query) Returns a list of matches from the givenqueryusing the givenregex.protected ContentItemRepository<D>protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManagerprotected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer>protected cz.jirutka.rsql.parser.ast.RSQLVisitor<jakarta.persistence.criteria.Predicate,Class<?>> voidsetRepository(ContentItemRepository<D> repository)  
- 
Field Details
- 
URI
- See Also:
 
 - 
ADDRESSABLE_BY_URI
- See Also:
 
 - 
NAME
- See Also:
 
 - 
TAGS
- See Also:
 
 - 
AUTHOR_USERNAME
- See Also:
 
 - 
AUTHOR_NAME
- See Also:
 
 - 
NOW
- See Also:
 
 - 
ACTIVE_START_DATE
- See Also:
 
 - 
ACTIVE_END_DATE
- See Also:
 
 - 
IS_EMBEDDED
- See Also:
 
 - 
TENANT
- See Also:
 
 - 
EMPTY_ARRAY
- See Also:
 
 
 - 
 - 
Constructor Details
- 
JpaCustomizedContentItemRepository
public JpaCustomizedContentItemRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, cz.jirutka.rsql.parser.ast.RSQLVisitor<jakarta.persistence.criteria.Predicate, Class<?>> rsqlVisitor, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder catalogFilterRuleCriteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager)  
 - 
 - 
Method Details
- 
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
 afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
 - 
findAllActiveByName
public org.springframework.data.domain.Page<D> findAllActiveByName(String nameQuery, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedContentItemRepositoryReturns a list of all active content items that are associated with the givenmodel.- Specified by:
 findAllActiveByNamein interfaceCustomizedContentItemRepository<D extends JpaContentItem>- Parameters:
 nameQuery- the name of the content item to search forfilters- the filters to apply to the querypage- the page to returncontextInfo- context information surrounding sandboxing and multitenant state- Returns:
 - A list of all active content items that are associated with the given 
model. 
 - 
findAllInactiveByName
public org.springframework.data.domain.Page<D> findAllInactiveByName(String nameQuery, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedContentItemRepositoryReturns a list of allContentItems that are currently inactive.- Specified by:
 findAllInactiveByNamein interfaceCustomizedContentItemRepository<D extends JpaContentItem>- Parameters:
 nameQuery- the name of the content item to search forfilters- the filters to apply to the querypage- the page to returncontextInfo- context information surrounding sandboxing and multitenant state- Returns:
 - a list of all 
ContentItems that are currently inactive. 
 - 
findByCombinedModelAndItemUris
public Optional<D> findByCombinedModelAndItemUris(String uri, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedContentItemRepositoryTakes the givenuriand returns the item where the combination ofits URIand itsContentModel's URImatches.- Specified by:
 findByCombinedModelAndItemUrisin interfaceCustomizedContentItemRepository<D extends JpaContentItem>- Parameters:
 uri- The URI to match againstcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
 - A 
ContentItemif the combination of its and its parent model's URIs matchuri. 
 - 
findAllByQuery
public org.springframework.data.domain.Page<D> findAllByQuery(String query, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedContentItemRepositoryReturns a list of all content items that are associate with the given query- Specified by:
 findAllByQueryin interfaceCustomizedContentItemRepository<D extends JpaContentItem>- Parameters:
 query- the name of the content item to search forfilters- the filters to apply to the querypage- the page to returncontextInfo- context information surrounding sandboxing and multitenant state- Returns:
 - A list of all content items that are associate with the given query
 
 - 
addNamePredicate
protected void addNamePredicate(String nameQuery, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate for filtering by a content item's name "like" the passed in string- Parameters:
 nameQuery- the name string to query againstbuilder- the criteria builderroot- the criteria rootpredicates- the list of existing predicates to add toparams- the list of existing narrowing params to add to
 - 
addPredicateForField
protected void addPredicateForField(String field, String query, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate for filtering by a field on content item "like" the passed in string- Parameters:
 field- the field to query againstquery- the name string to query againstbuilder- the criteria builderroot- the criteria rootpredicates- the list of existing predicates to add toparams- the list of existing narrowing params to add to
 - 
addActiveDateRangePredicate
protected void addActiveDateRangePredicate(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate to filter for active items by a content item's active date range- Parameters:
 builder- the criteria builderroot- the criteria rootpredicates- the list of existing predicates to add toparams- the list of existing narrowing params to add to
 - 
addInactiveDateRangePredicate
protected void addInactiveDateRangePredicate(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params) Adds a predicate to filter for inactive items by a content item's active date range- Parameters:
 builder- the criteria builderroot- the criteria rootpredicates- the list of existing predicates to add toparams- the list of existing narrowing params to add to
 - 
addEmbeddedFilterPredicate
protected void addEmbeddedFilterPredicate(jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, List<jakarta.persistence.criteria.Predicate> predicates) Adds a predicate to filter out content items marked as embedded- Parameters:
 builder- the criteria builderroot- the criteria rootpredicates- the list of existing predicates to add to
 - 
getActiveFilteredResults
protected org.springframework.data.domain.Page<D> getActiveFilteredResults(@NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Class<D> entityType, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.CriteriaQuery<D> criteria, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params)  - 
applyRsqlCriteria
protected LinkedRSQLQueryDetails applyRsqlCriteria(cz.jirutka.rsql.parser.ast.Node filters, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.CriteriaQuery<D> 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. 
 - 
getQuerySearchTokens
Returns a list of matches from the givenqueryusing the givenregex.- Parameters:
 query- the query to match against- Returns:
 - a list of matches from the given 
queryusing the givenregex 
 - 
getManagedType
 - 
getRepository
 - 
setRepository
 - 
getHelper
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper getHelper() - 
getRsqlQueryTransformers
protected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> getRsqlQueryTransformers() - 
getRsqlVisitor
protected cz.jirutka.rsql.parser.ast.RSQLVisitor<jakarta.persistence.criteria.Predicate,Class<?>> getRsqlVisitor() - 
getBehaviorUtil
protected com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil getBehaviorUtil() - 
getCriteriaBuilder
protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder getCriteriaBuilder() - 
getRepositoryEntityTypeManager
protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager getRepositoryEntityTypeManager() - 
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager() 
 -