Class AbstractBaseProcessor

java.lang.Object
org.broadleafcommerce.core.offer.service.processor.AbstractBaseProcessor
All Implemented Interfaces:
BaseProcessor
Direct Known Subclasses:
OrderOfferProcessorImpl

public abstract class AbstractBaseProcessor extends Object implements BaseProcessor
Author:
jfischer
  • Field Details

  • Constructor Details

  • Method Details

    • couldOfferApplyToOrderItems

      protected CandidatePromotionItems couldOfferApplyToOrderItems(Offer offer, List<PromotableOrderItem> promotableOrderItems)
    • findQualifyingItemForPriceData

      protected PromotableOrderItem findQualifyingItemForPriceData(OfferPriceData offerPriceData, List<PromotableOrderItem> promotableOrderItems)
    • isEmpty

      protected boolean isEmpty(Collection<? extends Object> collection)
    • hasPositiveValue

      protected boolean hasPositiveValue(Money money)
    • meetsItemQualifierSubtotal

      protected boolean meetsItemQualifierSubtotal(Offer offer, CandidatePromotionItems candidateItem)
    • checkForItemRequirements

      protected void checkForItemRequirements(Offer offer, CandidatePromotionItems candidates, OfferItemCriteria criteria, List<PromotableOrderItem> promotableOrderItems, boolean isQualifier)
    • addChildOrderItemsToCandidates

      protected void addChildOrderItemsToCandidates(Offer offer, CandidatePromotionItems candidates, OfferItemCriteria criteria, List<PromotableOrderItem> promotableOrderItems, PromotableOrderItem item)
    • couldOrderItemMeetOfferRequirement

      protected boolean couldOrderItemMeetOfferRequirement(OfferItemCriteria criteria, PromotableOrderItem orderItem)
    • executeExpression

      public Boolean executeExpression(String expression, Map<String,Object> vars)
      Private method used by couldOfferApplyToOrder to execute the MVEL expression in the appliesToOrderRules to determine if this offer can be applied.
      Parameters:
      expression -
      vars -
      Returns:
      a Boolean object containing the result of executing the MVEL expression
    • usePriceBeforeAdjustments

      protected String usePriceBeforeAdjustments(String expression)
    • clearAllNonFinalizedQuantities

      protected void clearAllNonFinalizedQuantities(List<PromotableOrderItemPriceDetail> priceDetails)
      We were not able to meet all of the ItemCriteria for a promotion, but some of the items were marked as qualifiers or targets. This method removes those items from being used as targets or qualifiers so they are eligible for other promotions.
      Parameters:
      priceDetails -
    • finalizeQuantities

      protected void finalizeQuantities(List<PromotableOrderItemPriceDetail> priceDetails)
      Updates the finalQuanties for the PromotionDiscounts and PromotionQualifiers. Called after we have confirmed enough qualifiers and targets for the promotion.
      Parameters:
      priceDetails -
    • splitDetailsIfNecessary

      protected void splitDetailsIfNecessary(List<PromotableOrderItemPriceDetail> priceDetails)
      Checks to see if the discountQty matches the detailQty. If not, splits the priceDetail.
      Parameters:
      priceDetails -
    • filterOffers

      public List<Offer> filterOffers(List<Offer> offers, Customer customer)
      Specified by:
      filterOffers in interface BaseProcessor
    • removeInvalidRequestOffers

      protected List<Offer> removeInvalidRequestOffers(List<Offer> offers)
    • couldOfferApplyToRequestDTO

      protected boolean couldOfferApplyToRequestDTO(Offer offer, RequestDTO requestDTO)
    • removeTimePeriodOffers

      protected List<Offer> removeTimePeriodOffers(List<Offer> offers)
      Removes all offers that are not within the timezone and timeperiod of the offer. If an offer does not fall within the timezone or timeperiod rule, that offer will be removed.
      Parameters:
      offers -
      Returns:
      List of Offers within the timezone or timeperiod of the offer
    • couldOfferApplyToTimePeriod

      protected boolean couldOfferApplyToTimePeriod(Offer offer)
    • removeOutOfDateOffers

      protected List<Offer> removeOutOfDateOffers(List<Offer> offers)
      Removes all out of date offers. If an offer does not have a start date, or the start date is a later date, that offer will be removed. Offers without a start date should not be processed. If the offer has a end date that has already passed, that offer will be removed. Offers without a end date will be processed if the start date is prior to the transaction date.
      Parameters:
      offers -
      Returns:
      List of Offers with valid dates
    • dateToCalendar

      protected Calendar dateToCalendar(Date date, TimeZone offerTimeZone)
    • removeInvalidCustomerOffers

      protected List<Offer> removeInvalidCustomerOffers(List<Offer> offers, Customer customer)
      Private method that takes in a list of Offers and removes all Offers from the list that does not apply to this customer.
      Parameters:
      offers -
      customer -
      Returns:
      List of Offers that apply to this customer
    • couldOfferApplyToCustomer

      protected boolean couldOfferApplyToCustomer(Offer offer, Customer customer)
      Private method which executes the appliesToCustomerRules in the Offer to determine if this Offer can be applied to the Customer.
      Parameters:
      offer -
      customer -
      Returns:
      true if offer can be applied, otherwise false
    • getOfferTimeZoneProcessor

      public OfferTimeZoneProcessor getOfferTimeZoneProcessor()
    • setOfferTimeZoneProcessor

      public void setOfferTimeZoneProcessor(OfferTimeZoneProcessor offerTimeZoneProcessor)