Class DefaultMarketingMessageResolver<P extends MarketingMessage,​O extends Offer>

    • Method Detail

      • buildMarketingMessageResponse

        @NotNull
        protected @NotNull MarketingMessageResponse<P> buildMarketingMessageResponse​(org.springframework.util.MultiValueMap<String,​String> associatedTargetProductOfferIds,
                                                                                     org.springframework.util.MultiValueMap<String,​String> associatedQualifierProductOfferIds,
                                                                                     List<P> messages,
                                                                                     Integer maxResults)
      • mergeProductMessageMaps

        protected void mergeProductMessageMaps​(Map<String,​List<P>> map,
                                               Map<String,​P> productToMessageMap,
                                               Integer maxResults)
      • findAllMessagesForItemAsQualifierOrTarget

        protected List<P> findAllMessagesForItemAsQualifierOrTarget​(MarketingMessageRequest request,
                                                                    Set<O> candidateOffers,
                                                                    org.springframework.util.MultiValueMap<String,​String> associatedTargetProductOfferIds,
                                                                    org.springframework.util.MultiValueMap<String,​String> associatedQualifierProductOfferIds,
                                                                    @Nullable
                                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Find all marketing messages from offers where the line item is used either as the target of the offer, or used to qualify for the offer.
        Parameters:
        request - an MarketingMessageRequest containing the parameters by which the results will be filtered
        candidateOffers - the candidate offers to filter on
        associatedTargetProductOfferIds - map of associated offers to target product id
        associatedQualifierProductOfferIds - map of associated offers to qualifier product id
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        the list of marketing messages that qualify based on the associated offers and message type.
      • isItemOffer

        protected boolean isItemOffer​(Offer offer)
        Checks if the Offer targets an order or fulfillment group item.
        Parameters:
        offer - the Offer to check
        Returns:
        true if the offer targets an order or fulfillment group item
      • isItemQualifier

        protected boolean isItemQualifier​(Offer offer,
                                          EnhancedLineItem item)
        Checks if any of the rules in Offer.getItemQualifierCriteria() matches the line item on this request in order to determine if the line item can be used to qualify for the offer.
        Parameters:
        offer - the Offer to check
        item - the EnhancedLineItem to check
        Returns:
        true if a match is found in the qualifier criteria
      • isItemTarget

        protected boolean isItemTarget​(Offer offer,
                                       EnhancedLineItem item)
        If this is an item offer, checks if any of the rules in Offer.getTargetItemCriteria() matches the line item on this request in order to determine if the line item can be used as the target for the offer. If the offer discount cannot apply to the sales price and the line item is on sale, then the item will not qualify as the offer target.
        Parameters:
        offer - the Offer to check
        item - the EnhancedLineItem to check
        Returns:
        true if the line item can qualify as the target of the offer
      • modifyItemCriteria

        protected ItemCriteria modifyItemCriteria​(Offer offer,
                                                  @Nullable
                                                  ItemCriteria itemCriteria)
        In certain cases (i.e. Fulfillment Group Item Offers) we need modify the rules so that they can be evaluated.
        Parameters:
        offer - the Offer to check
        itemCriteria - the ItemCriteria to modify
        Returns:
        the potentially modified item criteria