Interface CustomizedOfferRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
- All Known Subinterfaces:
JpaOfferRepository<D>
,OfferRepository<D>
- All Known Implementing Classes:
JpaCustomizedOfferRepository
public interface CustomizedOfferRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
Advanced functionality related to offer maintenance and filtering.
- Author:
- Chad Harchar (charchar)
-
Method Summary
Modifier and TypeMethodDescriptionfindAllCustomerOffers
(Iterable<? extends UserTarget> userTargets, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all offers that have no user targets or contain the provided user targets.findAllOfferIdsForFullCache
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all contextIds for offer in the system based on full cache configuration.Read a list of distinct tenants for all offersfindAutomaticOffers
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all offers whereOffer.isAutomaticallyConsidered()
is true excluding any offers whose getActiveEndDate() is more than 30 days ago.findByOfferCodesCodeIn
(Iterable<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all offers whereOffer.offerCodes
intersects with the provided codes.findByTrackingIds
(Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all offers whereOffer.getCampaignTrackingIds()
intersects with the provided tracking ids.findVoucherOffers
(Iterable<? extends UserTarget> userTargets, Iterable<String> offerIds, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all voucher offers whereOffer.isAutomaticallyConsidered()
is true,Offer.getCampaignTrackingIds()
intersects with the provided tracking ids,Offer.getOfferCodes()
intersects with the provided codes, or offers that contain the provided user targets.int
updateMaxUsageStatus
(String offerContextId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update the status (seeMaxUsageStatusType
) for an offer, and respond if the status was actually changed.
-
Method Details
-
findByOfferCodesCodeIn
@Policy(operationTypes=READ) List<D> findByOfferCodesCodeIn(Iterable<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all offers whereOffer.offerCodes
intersects with the provided codes. -
findAutomaticOffers
@Policy(operationTypes=READ) Stream<D> findAutomaticOffers(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all offers whereOffer.isAutomaticallyConsidered()
is true excluding any offers whose getActiveEndDate() is more than 30 days ago.- Parameters:
contextInfo
- Context information around sandbox and multitenant state.- Returns:
- all offers where
Offer.isAutomaticallyConsidered()
is true
-
findByTrackingIds
@Policy(operationTypes=READ) List<D> findByTrackingIds(Iterable<String> trackingIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all offers whereOffer.getCampaignTrackingIds()
intersects with the provided tracking ids.- Parameters:
trackingIds
- Tracking ids to filter bycontext
- Context information around sandbox and multitenant state.- Returns:
- All matched offers
-
findAllOfferIdsForFullCache
@Policy(operationTypes=READ) List<String> findAllOfferIdsForFullCache(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all contextIds for offer in the system based on full cache configuration. SeeOfferCacheProperties.getFullOfferCacheType()
for more information on how the configuration will influence the results of this method.- Parameters:
context
- Context information around sandbox and multitenant state.- Returns:
- All contextIds for offers in the system limited by the cache type configuration.
-
findVoucherOffers
@Policy(operationTypes=READ) Stream<D> findVoucherOffers(Iterable<? extends UserTarget> userTargets, Iterable<String> offerIds, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all voucher offers whereOffer.isAutomaticallyConsidered()
is true,Offer.getCampaignTrackingIds()
intersects with the provided tracking ids,Offer.getOfferCodes()
intersects with the provided codes, or offers that contain the provided user targets. Skips active date narrowing to fetch voucher offers for validation against submitted orders.- Parameters:
userTargets
- The targets to match offers againstofferIds
- offer ids the returnedOffer
(s) are associated with.trackingIds
- tracking ids the returnedOffer
(s) are associated with.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- all voucher offers where
Offer.isAutomaticallyConsidered()
is true, or the offer is associated with the provided codes, tracking ids, or user targets.
-
findAllCustomerOffers
@Policy(operationTypes=READ) Stream<D> findAllCustomerOffers(Iterable<? extends UserTarget> userTargets, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all offers that have no user targets or contain the provided user targets.- Parameters:
userTargets
- The targets to match offers againstcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- all offers that have no user targets or contain the provided user targets.
-
updateMaxUsageStatus
@Policy(operationTypes=UPDATE) @Transactional("offerTransactionManager") int updateMaxUsageStatus(String offerContextId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update the status (seeMaxUsageStatusType
) for an offer, and respond if the status was actually changed.- Parameters:
offerContextId
- The contextId of the offer to updatestatus
- The status to set (seeMaxUsageStatusType
)contextInfo
- Context containing tenant related information (specifically tenantId and applicationId) to use to further discriminate the change- Returns:
- The number of records updated, if any. It is expected this method is called under load, so the response is a useful measure to detect when the value is actually updated. This is in contrast to other possible duplicate and ineffectual attempts.
-
findAllTenants
Read a list of distinct tenants for all offers- Returns:
- List of distinct tenants
-