Class JpaCustomizedProductTagRepository<D extends JpaProductTag>
java.lang.Object
com.broadleafcommerce.catalog.provider.jpa.repository.tag.JpaCustomizedProductTagRepository<D>
- All Implemented Interfaces:
CustomizedProductTagRepository<D>
,org.springframework.beans.factory.InitializingBean
public class JpaCustomizedProductTagRepository<D extends JpaProductTag>
extends Object
implements CustomizedProductTagRepository<D>, org.springframework.beans.factory.InitializingBean
- Author:
- Nathan Moore (nathandmoore)
-
Constructor Summary
ConstructorDescriptionJpaCustomizedProductTagRepository
(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 TypeMethodDescriptionvoid
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 givenfilters
to build and apply the necessaryPredicate
for RSQL.protected jakarta.persistence.criteria.Predicate
buildProductContextIdFilter
(jakarta.persistence.criteria.Root<D> productTagEntity, String productContextId, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) long
countNonProductionRecordsByProductIdsInTenant
(@NonNull Iterable<String> productContextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Returns the count of non-production records that match the givenproductContextIds
and the given tenant context.org.springframework.data.domain.Page<D>
findAllByProductContextIdAndIsSorted
(String productContextId, boolean isSorted, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns allProductTags
for the givenproductContextId
that are either all sorted or not sorted (e.g., sorted is whereProductTag.getSorting()
is notSortable.DEFAULT_VALUE
or null).org.springframework.data.domain.Page<D>
findAllByProductContextIdAndIsSortedAndVariantIdIsNull
(String productContextId, boolean isSorted, @NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns allProductTags
for the givenproductContextId
that are either all sorted or not sorted (e.g., sorted is whereProductTag.getSorting()
is notSortable.DEFAULT_VALUE
or null).org.springframework.data.domain.Page<D>
findAllByVariantIdAndSorted
(String variantId, boolean isSorted, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns allProductTags
for the givenproductContextId
and variantId that are either all sorted or not sorted (e.g., sorted is whereProductTag.getSorting()
is notSortable.DEFAULT_VALUE
or null).protected com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil
protected JpaCatalogQueryHelper
protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder
protected jakarta.persistence.EntityManager
getEm()
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper
protected ProductTagRepository<D>
protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager
protected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer>
protected cz.jirutka.rsql.parser.ast.RSQLVisitor<jakarta.persistence.criteria.Predicate,
Class<?>> void
setCatalogQueryHelper
(JpaCatalogQueryHelper catalogQueryHelper) void
setRepository
(ProductTagRepository<D> repository) protected jakarta.persistence.criteria.Predicate
variantIdEquals
(jakarta.persistence.criteria.Root<D> productTagEntity, String variantId, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) protected jakarta.persistence.criteria.Predicate
variantIdIsNull
(jakarta.persistence.criteria.Root<D> productTagEntity, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
-
Constructor Details
-
JpaCustomizedProductTagRepository
public JpaCustomizedProductTagRepository(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:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
setRepository
-
findAllByProductContextIdAndIsSorted
@Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> findAllByProductContextIdAndIsSorted(String productContextId, boolean isSorted, @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:CustomizedProductTagRepository
Returns allProductTags
for the givenproductContextId
that are either all sorted or not sorted (e.g., sorted is whereProductTag.getSorting()
is notSortable.DEFAULT_VALUE
or null).- Specified by:
findAllByProductContextIdAndIsSorted
in interfaceCustomizedProductTagRepository<D extends JpaProductTag>
- Parameters:
productContextId
- Id of the product to matchisSorted
- Whether to fetch only the sorted or only the unsorted tagsfilters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.page
- the requested page of results from the databasecontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- all
ProductTags
for the givenproductContextId
that are either all sorted or not sorted depending onisSorted
.
-
findAllByProductContextIdAndIsSortedAndVariantIdIsNull
@Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> findAllByProductContextIdAndIsSortedAndVariantIdIsNull(String productContextId, boolean isSorted, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedProductTagRepository
Returns allProductTags
for the givenproductContextId
that are either all sorted or not sorted (e.g., sorted is whereProductTag.getSorting()
is notSortable.DEFAULT_VALUE
or null).- Specified by:
findAllByProductContextIdAndIsSortedAndVariantIdIsNull
in interfaceCustomizedProductTagRepository<D extends JpaProductTag>
- Parameters:
productContextId
- Id of the product to matchisSorted
- Whether to fetch only the sorted or only the unsorted tagsfilters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.page
- the requested page of results from the databasecontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- all
ProductTags
for the givenproductContextId
that are either all sorted or not sorted depending onisSorted
.
-
findAllByVariantIdAndSorted
@Policy(operationTypes=READ) public org.springframework.data.domain.Page<D> findAllByVariantIdAndSorted(String variantId, boolean isSorted, @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:CustomizedProductTagRepository
Returns allProductTags
for the givenproductContextId
and variantId that are either all sorted or not sorted (e.g., sorted is whereProductTag.getSorting()
is notSortable.DEFAULT_VALUE
or null).- Specified by:
findAllByVariantIdAndSorted
in interfaceCustomizedProductTagRepository<D extends JpaProductTag>
isSorted
- Whether to fetch only the sorted or only the unsorted tagsfilters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.page
- the requested page of results from the databasecontextInfo
- context surrounding sandboxing and multitenant state- Returns:
- all
ProductTags
for the givenproductContextId
that are either all sorted or not sorted depending onisSorted
.
-
countNonProductionRecordsByProductIdsInTenant
public long countNonProductionRecordsByProductIdsInTenant(@NonNull @NonNull Iterable<String> productContextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizedProductTagRepository
Returns the count of non-production records that match the givenproductContextIds
and the given tenant context.- Specified by:
countNonProductionRecordsByProductIdsInTenant
in interfaceCustomizedProductTagRepository<D extends JpaProductTag>
- Parameters:
productContextIds
- IDs of parent Products to match againstcontext
- Request context information around sandbox and multitenant state- Returns:
- the count of non-production records that match the given
productContextIds
and the given tenant context
-
buildProductContextIdFilter
-
variantIdEquals
-
variantIdIsNull
protected jakarta.persistence.criteria.Predicate variantIdIsNull(jakarta.persistence.criteria.Root<D> productTagEntity, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) -
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 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 toJpaCriterias
.
-
getManagedType
-
getRepository
-
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() -
getEm
protected jakarta.persistence.EntityManager getEm() -
getCatalogQueryHelper
-
setCatalogQueryHelper
-