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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected org.broadleafcommerce.profile.core.service.CustomerServiceprotected org.broadleafcommerce.common.extensibility.cache.JCacheUtilprotected intstatic final longprotected javax.cache.Cacheprotected AdvancedOfferPromotionMessageService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddMessagesToCache(org.broadleafcommerce.core.catalog.domain.Product product, Map<String, List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> promotionMessages) protected StringbuildKey(org.broadleafcommerce.core.catalog.domain.Product product) Products can vary by site.voidEvicts all PromotionMessage maps from the cachefilterMessageDTOsByCustomerRules(Map<String, List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> promotionMessageDTOMap) generatePromotionMessages(org.broadleafcommerce.core.catalog.domain.Product product) generatePromotionMessages(org.broadleafcommerce.core.order.domain.OrderItem orderItem) getMessagesFromCache(org.broadleafcommerce.core.catalog.domain.Product product) protected javax.cache.Cacheprotected intgetSecondsToClosestEndDate(Map<String, List<org.broadleafcommerce.core.promotionMessage.dto.PromotionMessageDTO>> promotionMessageMap) protected booleanvoidremoveCacheElement(org.broadleafcommerce.core.catalog.domain.Product product) Evicts the given PromotionMessage map from the cache
-
Field Details
-
MILLISECONDS_PER_SECOND
public static final long MILLISECONDS_PER_SECOND- See Also:
-
CACHE_NAME
- See Also:
-
promotionMessageCache
protected javax.cache.Cache promotionMessageCache -
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:
generatePromotionMessagesin interfaceorg.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:
generatePromotionMessagesin interfaceorg.broadleafcommerce.core.promotionMessage.service.PromotionMessageGenerator
-
filterMessageDTOsByCustomerRules
-
addMessagesToCache
-
getSecondsToClosestEndDate
-
getMessagesFromCache
-
clearPromotionMessageCache
public void clearPromotionMessageCache()Description copied from interface:AdvancedOfferPromotionMessageGeneratorEvicts all PromotionMessage maps from the cache- Specified by:
clearPromotionMessageCachein interfaceAdvancedOfferPromotionMessageGenerator
-
removeCacheElement
public void removeCacheElement(org.broadleafcommerce.core.catalog.domain.Product product) Description copied from interface:AdvancedOfferPromotionMessageGeneratorEvicts the given PromotionMessage map from the cache- Specified by:
removeCacheElementin interfaceAdvancedOfferPromotionMessageGenerator
-
buildKey
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()
-