Interface CustomizedOfferCodeRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>

Type Parameters:
D - The type of the persistent version of OfferCode for a specific data store implementation
All Known Subinterfaces:
JpaOfferCodeRepository<D>, OfferCodeRepository<D>
All Known Implementing Classes:
JpaCustomizedOfferCodeRepository

public interface CustomizedOfferCodeRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
Provides advanced functionality for OfferCodes that require manually implemented queries rather than through Spring Data.
Author:
Karan Jariwala (karan-j-blc)
  • Method Details

    • findAllByCode

      @Policy(operationTypes=READ) default List<D> findAllByCode(String code, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Parameters:
      code - Code to match
      context - Request context information around sandbox and multitenant state
      Returns:
      all OfferCodes by OfferCode.getCode().
    • findAllByCodes

      @Policy(operationTypes=READ) List<D> findAllByCodes(Set<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Parameters:
      codes - The set of codes to match
      context - Request context information around sandbox and multitenant state
      Returns:
      all OfferCodes by OfferCode.getCode().
    • findAllCodesForFullCache

      @Policy(operationTypes=READ) List<String> findAllCodesForFullCache(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Retrieve all the codes in the system based on full cache configuration. See OfferCacheProperties.getFullCodeCacheType() for more information on how the configuration will influence the results of this method.
      Parameters:
      context - Request context information around sandbox and multitenant state
      Returns:
      All the codes in the system limited by the cache type configuration.
    • findAllByCodesIncludingInactive

      @Policy(operationTypes=READ) Stream<D> findAllByCodesIncludingInactive(List<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • findAllDuplicatesForCodesInCampaign

      @Policy(operationTypes=READ) List<D> findAllDuplicatesForCodesInCampaign(@NonNull @NonNull String campaignId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Finds all duplicates OfferCodes by OfferCode.getId(). Typically, this will be used to check for duplicate offer codes of campaign.
      Parameters:
      campaignId - the campaign id
      context - Request context information around sandbox and multitenant state
      Returns:
      all duplicates OfferCodes by OfferCode.getId()
    • findExistingByCodesIncludeExpiredForCampaignId

      @Policy(operationTypes=READ) List<D> findExistingByCodesIncludeExpiredForCampaignId(Set<String> codes, String campaignId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Search all non-expired offer codes or expired but belonging to the specified campaignId. This is useful to validate that the offer codes can be added or updated. NOTE: This method is used during import of OfferCode and because different DBs has a different limitation on how many entries can be in "in" statement please make sure that the property "broadleaf.dataimport.processor.batch-size" not exited this limitation.
      Parameters:
      codes - The set of codes to match
      campaignId - the campaign id
      context - Request context information around sandbox and multitenant state
      Returns:
      all OfferCodes by OfferCode.getCode() that are also active or belonging to the specified campaignId
      See Also:
      • com.broadleafcommerce.promotion.offer.dataimport.CampaignCodeImportBatchHandler
    • findExistingByCodesIncludeExpiredForOfferId

      @Policy(operationTypes=READ) List<D> findExistingByCodesIncludeExpiredForOfferId(Set<String> codes, String offerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Search all non-expired offer codes or expired but belonging to the specified offerId. This is useful to validate that the offer codes can be added or updated. NOTE: This method is used during import of OfferCode and because different DBs has a different limitation on how many entries can be in "in" statement please make sure that the property "broadleaf.dataimport.processor.batch-size" not exited this limitation.
      Parameters:
      codes - The set of codes to match
      offerId - the offer id
      context - Request context information around sandbox and multitenant state
      Returns:
      all OfferCodes by OfferCode.getCode() that are also active or belonging to the specified offerId
      See Also:
      • com.broadleafcommerce.promotion.offer.dataimport.CampaignCodeImportBatchHandler
    • readAllByCampaignId

      @Policy(operationTypes=READ) Stream<D> readAllByCampaignId(String campaignId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Reads the offer codes for the specified campaign id matching the given filters.
      Parameters:
      campaignId - the campaign id
      filters - additional filters to apply in the query
      context - Request context information around sandbox and multitenant state
      Returns:
      the offer codes for the specified campaign id matching the given filters
    • readAllByCampaignId

      @Policy(operationTypes=READ) Stream<D> readAllByCampaignId(String campaignId, int pageSize, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads the offer codes for the specified campaign id matching the given page size and filters.
      Parameters:
      campaignId - the campaign id
      pageSize - the page size to use when querying for records within the stream
      filters - additional filters to apply in the query
      context - Request context information around sandbox and multitenant state
      Returns:
      the offer codes for the specified campaign id matching the given filters and page size
    • readAllByOfferId

      @Policy(operationTypes=READ) Stream<D> readAllByOfferId(String offerId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Reads the offer codes for the specified offer id matching the given filters.
      Parameters:
      offerId - the offer id
      filters - additional filters to apply in the query
      context - Request context information around sandbox and multitenant state
      Returns:
      the offer codes for the specified offer id matching the given filters
    • updateMaxUsageStatus

      @Policy(operationTypes=UPDATE) @Transactional("offerTransactionManager") int updateMaxUsageStatus(String offerCodeId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Update the status (see MaxUsageStatusType) for an offercode, and respond if the status was actually changed.
      Parameters:
      offerContextId - The contextId of the offercode 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 offer codes
      Returns:
      List of distinct tenants