Interface CustomizedPriceDataRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
- All Known Subinterfaces:
JpaPriceDataRepository<D>,PriceDataRepository<D>
- All Known Implementing Classes:
JpaCustomizedPriceDataRepository
- Author:
- Nick Crum ncrum
-
Method Summary
Modifier and TypeMethodDescriptionintdecrementAvailableQuantity(String priceDataId, String priceListId, Instant usageDate, int quantityToDecrement, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Decrements thePriceData.getAvailableQuantity().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> listIds, boolean filterByVendor, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a list of price data by the givenPriceableTargetRefsand price list ids.findByTargetInAndPriceListIdsIn(Collection<com.broadleafcommerce.pricing.client.domain.PriceableTargetRef> targets, Collection<String> listIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) intincrementAvailableQuantity(String priceDataId, int quantityToIncrement, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Increments thePriceData.getAvailableQuantity(), typically used as part of the rollback.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.
-
Method Details
-
findByPriceListIdAndTarget
@Deprecated(since="1.7.2", forRemoval=true) @Policy(operationTypes=READ) 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. -
findByPriceListIdAndTarget
@NonNull @Policy(operationTypes=READ) 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) -
findByTargetInAndPriceListIdsIn
@NonNull @Policy(operationTypes=READ) default List<D> findByTargetInAndPriceListIdsIn(@NonNull Collection<com.broadleafcommerce.pricing.client.domain.PriceableTargetRef> targets, @NonNull Collection<String> listIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
findByTargetInAndPriceListIdsIn
@NonNull @Policy(operationTypes=READ) List<D> findByTargetInAndPriceListIdsIn(@NonNull Collection<com.broadleafcommerce.pricing.client.domain.PriceableTargetRef> targets, @NonNull Collection<String> listIds, boolean filterByVendor, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds a list of price data by the givenPriceableTargetRefsand price list ids.- Parameters:
targets- a list ofPriceableTargetRefsto matchlistIds- 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
-
findByTargetAndPriceListId
-
readAllByPriceListId
@Policy(operationTypes=READ) Stream<D> readAllByPriceListId(String priceListId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads 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. -
incrementAvailableQuantity
@Policy(operationTypes=UPDATE) int incrementAvailableQuantity(String priceDataId, int quantityToIncrement, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Increments thePriceData.getAvailableQuantity(), typically used as part of the rollback.This method updates the quantity based on the current
PriceData.getAvailableQuantity()to prevent causing stale data (e.g. read entity and then update the entity separately could cause the data to be stale).This method should be used to increment the
PriceData.getAvailableQuantity()to prevent race condition and cause the quantity to be stale.- Parameters:
priceDataId- thePriceData.getId()to incrementquantityToIncrement- the quantity to incrementcontextInfo- the context info- Returns:
- the count of records updated
-
decrementAvailableQuantity
@Policy(operationTypes=UPDATE) int decrementAvailableQuantity(String priceDataId, String priceListId, Instant usageDate, int quantityToDecrement, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Decrements thePriceData.getAvailableQuantity().This method only updates the quantity if the
PriceData.getAvailableQuantity()is enough to cover thequantityToDecrement.This method should be used to decrement the
PriceData.getAvailableQuantity()to prevent race condition and decrement more quantity than actually available.- Parameters:
priceDataId- thePriceData.getId()to decrementpriceListId- thePriceList.getId()that it belongs tousageDate- theInstantused to check against the active start and end datesquantityToDecrement- the quantity to decrementcontextInfo- the context info- Returns:
- the count of records updated
-