Class JpaCustomizedPriceDataRepository<D extends JpaPriceData>
java.lang.Object
com.broadleafcommerce.pricing.provider.jpa.repository.JpaCustomizedPriceDataRepository<D>
- All Implemented Interfaces:
CustomizedPriceDataRepository<D>,org.springframework.beans.factory.InitializingBean
public class JpaCustomizedPriceDataRepository<D extends JpaPriceData>
extends Object
implements CustomizedPriceDataRepository<D>, org.springframework.beans.factory.InitializingBean
Repository fragment for
JpaPriceDataRepository that includes custom JPA query methods.- Author:
- Nick Crum ncrum
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJpaCustomizedPriceDataRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder criteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor rsqlVisitor) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPriceListIdPredicate(String priceListId, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root) protected voidaddTargetTypePredicate(String targetType, List<jakarta.persistence.criteria.Predicate> predicates, Map<String, Object> params, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root) voidprotected voidapplyRsqlCriteria(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, Class<?> type) org.springframework.data.domain.Page<D>findByPriceListIdAndTarget(String priceListId, String targetType, Collection<String> targetIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) org.springframework.data.domain.Page<D>findByPriceListIdAndTarget(String priceListId, String targetType, Collection<String> targetIds, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.findByTargetAndPriceListId(com.broadleafcommerce.pricing.client.domain.PriceableTargetRef target, String priceListId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) findByTargetInAndPriceListIdsIn(Collection<com.broadleafcommerce.pricing.client.domain.PriceableTargetRef> targets, Collection<String> priceListIds, boolean filterByVendor, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a list of price data by the givenPriceableTargetRefsand price list ids.findIdsByPriceListId(AtomicReference<String> startingIdField, String priceListId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a list ofJpaPriceData.get_id()from the given starting id, pricelist id, filters, and paging details.protected com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtilprotected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilderprotected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelpergetPriceDataFromIds(List<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.common.jpa.RepositoryEntityTypeManagerprotected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer>protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitorprotected jakarta.persistence.criteria.PredicategetVendorRefPredicate(com.broadleafcommerce.pricing.client.domain.PriceableTargetRef targetRef, String vendorRefFieldName, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<D> root, Map<String, Object> params) readAllByPriceListId(String priceListId, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allJpaPriceDataby the given price list id.voidsetRepository(PriceDataRepository<D> repository) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.pricing.repository.CustomizedPriceDataRepository
findByTargetInAndPriceListIdsIn
-
Constructor Details
-
JpaCustomizedPriceDataRepository
public JpaCustomizedPriceDataRepository(com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil behaviorUtil, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder criteriaBuilder, com.broadleafcommerce.common.jpa.RepositoryEntityTypeManager repositoryEntityTypeManager, List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> rsqlQueryTransformers, com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor rsqlVisitor)
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
setRepository
-
findByPriceListIdAndTarget
@NonNull @Deprecated(since="1.7.2", forRemoval=true) public org.springframework.data.domain.Page<D> findByPriceListIdAndTarget(@Nullable String priceListId, @Nullable String targetType, Collection<String> targetIds, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
findByPriceListIdAndTargetin interfaceCustomizedPriceDataRepository<D extends JpaPriceData>
-
findByPriceListIdAndTarget
@NonNull public org.springframework.data.domain.Page<D> findByPriceListIdAndTarget(@Nullable String priceListId, @Nullable String targetType, Collection<String> targetIds, @Nullable cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
findByPriceListIdAndTargetin interfaceCustomizedPriceDataRepository<D extends JpaPriceData>
-
findByTargetInAndPriceListIdsIn
@NonNull public List<D> findByTargetInAndPriceListIdsIn(@NonNull Collection<com.broadleafcommerce.pricing.client.domain.PriceableTargetRef> targets, @NonNull Collection<String> priceListIds, boolean filterByVendor, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CustomizedPriceDataRepositoryFinds a list of price data by the givenPriceableTargetRefsand price list ids.- Specified by:
findByTargetInAndPriceListIdsInin interfaceCustomizedPriceDataRepository<D extends JpaPriceData>- Parameters:
targets- a list ofPriceableTargetRefsto matchpriceListIds- a list of price list ids to look forfilterByVendor- whether to also filter the price data based on the {@link {@link PriceableTargetRef#getVendorRef()}contextInfo- the current context- Returns:
- a list of price data by the given
PriceableTargetRefsand price list ids
-
getVendorRefPredicate
-
findByTargetAndPriceListId
@NonNull public Optional<D> findByTargetAndPriceListId(@NonNull com.broadleafcommerce.pricing.client.domain.PriceableTargetRef target, @NonNull String priceListId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
findByTargetAndPriceListIdin interfaceCustomizedPriceDataRepository<D extends JpaPriceData>
-
readAllByPriceListId
public Stream<D> readAllByPriceListId(String priceListId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:CustomizedPriceDataRepositoryReads allJpaPriceDataby the given price list id.This method explicitly fetches the ids and then fetches the entities by the ids to avoid using the SQL
offsetfor the sake of performance, which is used under the hood inJpaNarrowExecutorwhen the query is a page query.- Specified by:
readAllByPriceListIdin interfaceCustomizedPriceDataRepository<D extends JpaPriceData>
-
findIdsByPriceListId
protected List<String> findIdsByPriceListId(AtomicReference<String> startingIdField, String priceListId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a list ofJpaPriceData.get_id()from the given starting id, pricelist id, filters, and paging details.The query uses the starting id condition and order by price list id and price data id for the sake of performance.
-
getPriceDataFromIds
-
applyRsqlCriteria
protected void 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, Class<?> type) -
addPriceListIdPredicate
-
addTargetTypePredicate
-
getManagedType
-
getJpaNarrowingHelper
protected com.broadleafcommerce.data.tracking.jpa.filtering.narrow.JpaNarrowingHelper getJpaNarrowingHelper() -
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() -
getRsqlQueryTransformers
protected List<com.broadleafcommerce.data.tracking.core.service.RsqlQueryTransformer> getRsqlQueryTransformers() -
getRsqlVisitor
protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaCriteriaBuilderRsqlVisitor getRsqlVisitor()
-