org.broadleafcommerce.core.offer.service.processor
Class AbstractBaseProcessor

java.lang.Object
  extended by 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 Summary
protected  OfferTimeZoneProcessor offerTimeZoneProcessor
           
 
Constructor Summary
AbstractBaseProcessor()
           
 
Method Summary
protected  void checkForItemRequirements(CandidatePromotionItems candidates, OfferItemCriteria criteria, List<PromotableOrderItem> promotableOrderItems, boolean isQualifier)
           
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.
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.
protected  CandidatePromotionItems couldOfferApplyToOrderItems(Offer offer, List<PromotableOrderItem> promotableOrderItems)
           
protected  boolean couldOfferApplyToRequestDTO(Offer offer, RequestDTO requestDTO)
           
protected  boolean couldOfferApplyToTimePeriod(Offer offer)
           
protected  boolean couldOrderItemMeetOfferRequirement(OfferItemCriteria criteria, PromotableOrderItem orderItem)
           
 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.
 List<Offer> filterOffers(List<Offer> offers, Customer customer)
           
protected  void finalizeQuantities(List<PromotableOrderItemPriceDetail> priceDetails)
          Updates the finalQuanties for the PromotionDiscounts and PromotionQualifiers.
 OfferTimeZoneProcessor getOfferTimeZoneProcessor()
           
protected  boolean meetsItemQualifierSubtotal(Offer offer, CandidatePromotionItems candidateItem)
           
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.
protected  List<Offer> removeInvalidRequestOffers(List<Offer> offers)
           
protected  List<Offer> removeOutOfDateOffers(List<Offer> offers)
          Removes all out of date offers.
protected  List<Offer> removeTimePeriodOffers(List<Offer> offers)
          Removes all offers that are not within the timezone and timeperiod of the offer.
 void setOfferTimeZoneProcessor(OfferTimeZoneProcessor offerTimeZoneProcessor)
           
protected  void splitDetailsIfNecessary(List<PromotableOrderItemPriceDetail> priceDetails)
          Checks to see if the discountQty matches the detailQty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

offerTimeZoneProcessor

protected OfferTimeZoneProcessor offerTimeZoneProcessor
Constructor Detail

AbstractBaseProcessor

public AbstractBaseProcessor()
Method Detail

couldOfferApplyToOrderItems

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

meetsItemQualifierSubtotal

protected boolean meetsItemQualifierSubtotal(Offer offer,
                                             CandidatePromotionItems candidateItem)

checkForItemRequirements

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

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

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

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)


Copyright © 2013. All Rights Reserved.