Class JpaCustomizedVariantRepository<D extends JpaVariant>
java.lang.Object
com.broadleafcommerce.catalog.provider.jpa.repository.product.JpaCustomizedVariantRepository<D>
- All Implemented Interfaces:
CustomizedVariantRepository<D>
,org.springframework.beans.factory.InitializingBean
public class JpaCustomizedVariantRepository<D extends JpaVariant>
extends Object
implements CustomizedVariantRepository<D>, org.springframework.beans.factory.InitializingBean
- Author:
- Samarth Dhruva (samarthd)
-
Constructor Summary
ConstructorDescriptionJpaCustomizedVariantRepository
(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 javax.persistence.criteria.Predicate
buildContextIdInFilter
(Collection<String> contextIds, javax.persistence.criteria.Root<D> variantEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) protected javax.persistence.criteria.Predicate
buildProductContextIdInFilter
(Collection<String> productContextIds, javax.persistence.criteria.Root<D> variantEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) findAllByContextIdIn
(Collection<String> contextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves all variants whose context IDs match any of the given IDs.findAllByProductContextIdIn
(Collection<String> productContextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the variants which are associated with any of the givenproductContextIds
.findAllByVariantOrProductContextId
(@NonNull Iterable<String> variantContextIds, @NonNull Iterable<String> productContextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected javax.persistence.EntityManager
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper
void
setRepository
(VariantRepository<D> repository)
-
Constructor Details
-
JpaCustomizedVariantRepository
public JpaCustomizedVariantRepository(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
-
findAllByContextIdIn
public Stream<D> findAllByContextIdIn(Collection<String> contextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedVariantRepository
Retrieves all variants whose context IDs match any of the given IDs.- Specified by:
findAllByContextIdIn
in interfaceCustomizedVariantRepository<D extends JpaVariant>
- Parameters:
contextIds
- the context IDs to query forcontextInfo
- context information around sandbox and multitenant state- Returns:
- all variants whose context IDs match any of the given IDs
-
findAllByProductContextIdIn
public Stream<D> findAllByProductContextIdIn(Collection<String> productContextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedVariantRepository
Reads all of the variants which are associated with any of the givenproductContextIds
.- Specified by:
findAllByProductContextIdIn
in interfaceCustomizedVariantRepository<D extends JpaVariant>
- Parameters:
productContextIds
- a collection of product context IDs which the results must be associated withcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- all of the variants which are associated with any of the given
productContextIds
-
findAllByVariantOrProductContextId
public List<D> findAllByVariantOrProductContextId(@NonNull @NonNull Iterable<String> variantContextIds, @NonNull @NonNull Iterable<String> productContextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizedVariantRepository
- Specified by:
findAllByVariantOrProductContextId
in interfaceCustomizedVariantRepository<D extends JpaVariant>
- Parameters:
variantContextIds
- Variant IDs to match againstproductContextIds
- IDs of parent Products to match againstcontext
- Request context information around sandbox and multitenant state- Returns:
- A stream of all the
Variants
that match eithervariantContextIds
orproductContextIds
.
-
buildContextIdInFilter
-
buildProductContextIdInFilter
-
getNarrowingHelper
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper getNarrowingHelper() -
getEntityManager
protected javax.persistence.EntityManager getEntityManager()
-