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 Details

    • findByOfferCodesCodeIn

      @Policy(operationTypes=READ) List<D> findByOfferCodesCodeIn(Iterable<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all offers where Offer.offerCodes intersects with the provided codes.
      Parameters:
      codes - codes the returned Offer(s) are associated with.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      all Offers associated to the provided codes.
    • findAutomaticOffers

      @Policy(operationTypes=READ) Stream<D> findAutomaticOffers(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read all offers where Offer.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 where Offer.getCampaignTrackingIds() intersects with the provided tracking ids.
      Parameters:
      trackingIds - Tracking ids to filter by
      context - 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. See OfferCacheProperties.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 where Offer.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 against
      offerIds - offer ids the returned Offer(s) are associated with.
      trackingIds - tracking ids the returned Offer(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 against
      contextInfo - 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 (see MaxUsageStatusType) for an offer, and respond if the status was actually changed.
      Parameters:
      offerContextId - The contextId of the offer to update
      status - The status to set (see MaxUsageStatusType)
      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

      @Policy(operationTypes=READ) Set<String> findAllTenants()
      Read a list of distinct tenants for all offers
      Returns:
      List of distinct tenants