Interface OfferService<P extends Offer>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
All Known Implementing Classes:
DefaultOfferService

public interface OfferService<P extends Offer> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Author:
Nathan Moore (nathanmoore).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    existsById(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns whether the offer with the given id exists in the data store
    boolean
    existsByIdAndActive(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns whether the offer with the given id exists and is active in the data store.
     
    readActiveByIds(Iterable<String> offerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all active offers filtering where contextId in offerIds.
    readAllActiveByCodesIn(Iterable<String> codes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all active offers where Offer.getOfferCodes() intersects with the provided codes.
    readAllByContextIdInOrExternalIdIn(Iterable<String> contextIds, Iterable<String> externalIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    org.springframework.data.domain.Page<P>
    readAllByName(String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    readAllCustomerOffersIn(Iterable<UserTarget> userTargets, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all active offers where Offer.userTargets intersects with the provided UserTargets, or the offer has no UserTargets
    readAutomaticAndCodeAndCustomerOffersIn(Iterable<String> offerIdsToFilterOn, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    readAutomaticAndCodeAndCustomerOffersIn(Iterable<String> offerIdsToFilterOn, Iterable<String> trackingIds, EnhancedOrder order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all active offers where Offer.isAutomaticallyConsidered() is true or the offers match the passed in offerIds or contain the passed in campaign trackingIds.
    readByIds(Iterable<String> offerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all offers filtering where contextId in offerIds.
    readByTrackingIds(Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all active offers filtering where trackingId in trackingIds.
    readVoucherOffersIn(Iterable<UserTarget> userTargets, Iterable<String> offerIdsForCodes, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all voucher offers based on the provided user targets, codes, or tracking ids.
    Call to launch an async process to warm the full offer cache, if enabled.

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

    readAll, readAll, readAll, readAll
  • Method Details

    • readAllByName

      org.springframework.data.domain.Page<P> readAllByName(@Nullable String name, cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • readAutomaticAndCodeAndCustomerOffersIn

      Stream<P> readAutomaticAndCodeAndCustomerOffersIn(Iterable<String> offerIdsToFilterOn, Iterable<String> trackingIds, @Nullable EnhancedOrder order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all active offers where Offer.isAutomaticallyConsidered() is true or the offers match the passed in offerIds or contain the passed in campaign trackingIds.
      Parameters:
      offerIdsToFilterOn - offerIds the returned Offer(s) are associated with.
      trackingIds - tracking ids the returned Offer(s) are associated with.
      order - the order for this request
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      the offers matching the given criteria
    • readAutomaticAndCodeAndCustomerOffersIn

      Stream<P> readAutomaticAndCodeAndCustomerOffersIn(Iterable<String> offerIdsToFilterOn, Iterable<String> trackingIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • readActiveByIds

      List<P> readActiveByIds(Iterable<String> offerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all active offers filtering where contextId in offerIds.
      Parameters:
      offerIds - The context ids to filter on
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      All active offers filtering where contextId in offerIds.
    • readByIds

      List<P> readByIds(Iterable<String> offerIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all offers filtering where contextId in offerIds.
      Parameters:
      offerIds - The context ids to filter on
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      All active offers filtering where contextId in offerIds.
    • readByTrackingIds

      List<P> readByTrackingIds(Iterable<String> trackingIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all active offers filtering where trackingId in trackingIds.
      Parameters:
      trackingIds - The tracking ids to filter on
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      All active offers filtering where trackingId in trackingIds.
    • readAllCustomerOffersIn

      Stream<P> readAllCustomerOffersIn(Iterable<UserTarget> userTargets, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all active offers where Offer.userTargets intersects with the provided UserTargets, or the offer has no UserTargets
      Parameters:
      userTargets - users the returned Offer(s) should target
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      the offers matching the given criteria
    • readAllActiveByCodesIn

      List<P> readAllActiveByCodesIn(Iterable<String> codes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all active offers where Offer.getOfferCodes() 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 active Offers associated to the provided codes.
    • readVoucherOffersIn

      Stream<P> readVoucherOffersIn(Iterable<UserTarget> userTargets, Iterable<String> offerIdsForCodes, Iterable<String> trackingIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all voucher offers based on the provided user targets, codes, or tracking ids. Skips the active date narrowing to retrieve offers that may have been validly applied in the past.
      Parameters:
      userTargets - users the returned Offer(s) should target
      offerIdsForCodes - 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 based on the provided user targets, codes, or tracking ids
    • readAllByContextIdInOrExternalIdIn

      List<P> readAllByContextIdInOrExternalIdIn(Iterable<String> contextIds, Iterable<String> externalIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • existsById

      boolean existsById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns whether the offer with the given id exists in the data store
      Parameters:
      id - the id of the offer to find
      contextInfo - context information surrounding sandboxing and multi tenant state
      Returns:
      whether the offer with the given id exists in the data store
    • existsByIdAndActive

      boolean existsByIdAndActive(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns whether the offer with the given id exists and is active in the data store.
      Parameters:
      id - the id of the offer to find
      contextInfo - context information surrounding sandboxing and multi tenant state
      Returns:
      whether the offer with the given id exists and is active in the data store
    • getRepositoryDomain

      String getRepositoryDomain()
    • warmCache

      Call to launch an async process to warm the full offer cache, if enabled. This method may be safely called repeatedly. If it is determined the cache has not been warmed yet, a new thread will spawn to fully populate the cache. Otherwise, the status of the cache warm process will simply be returned. For callers interested in the status, this method may be called repeatedly until the status FullCacheInitializationStatus.READY is returned, indicating the cache is fully warm.

      This method should only be called prior to the service accepting traffic. It is most useful as part of a readiness probe, for example, as part of a kubernetes pod readiness check.
      Returns:
      The status of the cache warm process.