Class AdvancedOfferPromotionMessageGeneratorImpl

java.lang.Object
com.broadleafcommerce.advancedoffer.service.AdvancedOfferPromotionMessageGeneratorImpl
All Implemented Interfaces:
AdvancedOfferPromotionMessageGenerator, org.broadleafcommerce.core.promotionMessage.service.PromotionMessageGenerator

@Component("blAdvancedOfferPromotionMessageGenerator") public class AdvancedOfferPromotionMessageGeneratorImpl extends Object implements AdvancedOfferPromotionMessageGenerator
The AdvancedOfferPromotionMessageGeneratorImpl knows how to gather PromotionMessages from Offers that are targeting the given Product.
Author:
Chris Kittrell
  • Field Details

    • MILLISECONDS_PER_SECOND

      public static final long MILLISECONDS_PER_SECOND
      See Also:
    • CACHE_NAME

      public static final String CACHE_NAME
      See Also:
    • promotionMessageCache

      protected javax.cache.Cache promotionMessageCache
    • promotionMessageService

      protected AdvancedOfferPromotionMessageService promotionMessageService
    • customerService

      protected org.broadleafcommerce.profile.core.service.CustomerService customerService
    • messageDefaultCacheSeconds

      @Value("${promotion.message.default.cache.seconds:600}") protected int messageDefaultCacheSeconds
    • jcacheUtil

      protected org.broadleafcommerce.common.extensibility.cache.JCacheUtil jcacheUtil
  • Constructor Details

    • AdvancedOfferPromotionMessageGeneratorImpl

      public AdvancedOfferPromotionMessageGeneratorImpl()
  • Method Details

    • generatePromotionMessages

      public List<String> generatePromotionMessages(org.broadleafcommerce.core.order.domain.OrderItem orderItem)
      Specified by:
      generatePromotionMessages in interface org.broadleafcommerce.core.promotionMessage.service.PromotionMessageGenerator
    • generatePromotionMessages

      public Map<String,List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> generatePromotionMessages(org.broadleafcommerce.core.catalog.domain.Product product)
      Specified by:
      generatePromotionMessages in interface org.broadleafcommerce.core.promotionMessage.service.PromotionMessageGenerator
    • filterMessageDTOsByCustomerRules

      protected Map<String,List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> filterMessageDTOsByCustomerRules(Map<String,List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> promotionMessageDTOMap)
    • addMessagesToCache

      protected void addMessagesToCache(org.broadleafcommerce.core.catalog.domain.Product product, Map<String,List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> promotionMessages)
    • getSecondsToClosestEndDate

      protected int getSecondsToClosestEndDate(Map<String,List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> promotionMessageMap)
    • getMessagesFromCache

      protected Map<String,List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> getMessagesFromCache(org.broadleafcommerce.core.catalog.domain.Product product)
    • clearPromotionMessageCache

      public void clearPromotionMessageCache()
      Description copied from interface: AdvancedOfferPromotionMessageGenerator
      Evicts all PromotionMessage maps from the cache
      Specified by:
      clearPromotionMessageCache in interface AdvancedOfferPromotionMessageGenerator
    • removeCacheElement

      public void removeCacheElement(org.broadleafcommerce.core.catalog.domain.Product product)
      Description copied from interface: AdvancedOfferPromotionMessageGenerator
      Evicts the given PromotionMessage map from the cache
      Specified by:
      removeCacheElement in interface AdvancedOfferPromotionMessageGenerator
    • buildKey

      protected String buildKey(org.broadleafcommerce.core.catalog.domain.Product product)
      Products can vary by site. If a site is found on the request, use the site's id as part of the cache-key.
      Parameters:
      product -
      Returns:
    • getPromotionMessageCache

      protected javax.cache.Cache getPromotionMessageCache()
    • isProductionRequest

      protected boolean isProductionRequest()