org.broadleafcommerce.core.offer.service
Class OfferServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.core.offer.service.OfferServiceImpl
All Implemented Interfaces:
OfferService

@Service(value="blOfferService")
public class OfferServiceImpl
extends java.lang.Object
implements OfferService

The Class OfferServiceImpl.


Field Summary
protected  CustomerOfferDao customerOfferDao
           
protected  FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor
           
protected  ItemOfferProcessor itemOfferProcessor
           
protected  OfferCodeDao offerCodeDao
           
protected  OfferDao offerDao
           
protected  OrderOfferProcessor orderOfferProcessor
           
protected  PromotableItemFactory promotableItemFactory
           
 
Constructor Summary
OfferServiceImpl()
           
 
Method Summary
 void applyFulfillmentGroupOffersToOrder(java.util.List<Offer> offers, Order order)
           
 void applyOffersToOrder(java.util.List<Offer> offers, Order order)
          Apply offers to order.
 java.util.List<Offer> buildOfferListForOrder(Order order)
          Creates a list of offers that applies to this order.
 java.util.List<Offer> findAllOffers()
          Returns all offers
 CustomerOfferDao getCustomerOfferDao()
           
 FulfillmentGroupOfferProcessor getFulfillmentGroupOfferProcessor()
           
 ItemOfferProcessor getItemOfferProcessor()
           
 OfferCodeDao getOfferCodeDao()
           
 OfferDao getOfferDao()
           
 OrderOfferProcessor getOrderOfferProcessor()
           
 PromotableItemFactory getPromotableItemFactory()
           
protected  java.util.List<Offer> lookupAutomaticDeliveryOffers()
          Private method used to retrieve all offers with DeliveryType of AUTOMATIC
 Offer lookupOfferByCode(java.lang.String code)
          Creates a list of offers that applies to this order.
 OfferCode lookupOfferCodeByCode(java.lang.String code)
          Lookup OfferCode by code.
protected  java.util.List<CustomerOffer> lookupOfferCustomerByCustomer(Customer customer)
          Private method used to retrieve all offers assigned to this customer.
protected  java.util.List<OfferCode> removeOutOfDateOfferCodes(java.util.List<OfferCode> offerCodes)
          Removes all out of date offerCodes based on the offerCode and its offer's start and end date.
 Offer save(Offer offer)
          Save a new offer or updates an existing offer
 OfferCode saveOfferCode(OfferCode offerCode)
          Saves a new Offer or updates an existing Offer that belongs to an OfferCode, then saves or updates the OfferCode
 void setCustomerOfferDao(CustomerOfferDao customerOfferDao)
           
 void setFulfillmentGroupOfferProcessor(FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor)
           
 void setItemOfferProcessor(ItemOfferProcessor itemOfferProcessor)
           
 void setOfferCodeDao(OfferCodeDao offerCodeDao)
           
 void setOfferDao(OfferDao offerDao)
           
 void setOrderOfferProcessor(OrderOfferProcessor orderOfferProcessor)
           
 void setPromotableItemFactory(PromotableItemFactory promotableItemFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customerOfferDao

protected CustomerOfferDao customerOfferDao

offerCodeDao

protected OfferCodeDao offerCodeDao

offerDao

protected OfferDao offerDao

orderOfferProcessor

protected OrderOfferProcessor orderOfferProcessor

itemOfferProcessor

protected ItemOfferProcessor itemOfferProcessor

fulfillmentGroupOfferProcessor

protected FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor

promotableItemFactory

protected PromotableItemFactory promotableItemFactory
Constructor Detail

OfferServiceImpl

public OfferServiceImpl()
Method Detail

findAllOffers

public java.util.List<Offer> findAllOffers()
Description copied from interface: OfferService
Returns all offers

Specified by:
findAllOffers in interface OfferService
Returns:
all offers

save

public Offer save(Offer offer)
Description copied from interface: OfferService
Save a new offer or updates an existing offer

Specified by:
save in interface OfferService
Returns:
the offer

saveOfferCode

public OfferCode saveOfferCode(OfferCode offerCode)
Description copied from interface: OfferService
Saves a new Offer or updates an existing Offer that belongs to an OfferCode, then saves or updates the OfferCode

Specified by:
saveOfferCode in interface OfferService
Returns:
the offerCode

lookupOfferByCode

public Offer lookupOfferByCode(java.lang.String code)
Creates a list of offers that applies to this order. All offers that are assigned to the customer, entered during checkout, or has a delivery type of automatic are added to the list. The same offer cannot appear more than once in the list.

Specified by:
lookupOfferByCode in interface OfferService
Parameters:
code -
Returns:
a List of offers that may apply to this order

lookupOfferCodeByCode

public OfferCode lookupOfferCodeByCode(java.lang.String code)
Description copied from interface: OfferService
Lookup OfferCode by code.

Specified by:
lookupOfferCodeByCode in interface OfferService
Parameters:
code - the code
Returns:
the offer

buildOfferListForOrder

public java.util.List<Offer> buildOfferListForOrder(Order order)
Creates a list of offers that applies to this order. All offers that are assigned to the customer, entered during checkout, or has a delivery type of automatic are added to the list. The same offer cannot appear more than once in the list.

Specified by:
buildOfferListForOrder in interface OfferService
Parameters:
order -
Returns:
a List of offers that may apply to this order

lookupOfferCustomerByCustomer

protected java.util.List<CustomerOffer> lookupOfferCustomerByCustomer(Customer customer)
Private method used to retrieve all offers assigned to this customer. These offers have a DeliveryType of MANUAL and are programmatically assigned to the customer.

Parameters:
customer -
Returns:
a List of offers assigned to the customer

lookupAutomaticDeliveryOffers

protected java.util.List<Offer> lookupAutomaticDeliveryOffers()
Private method used to retrieve all offers with DeliveryType of AUTOMATIC

Returns:
a List of automatic delivery offers

removeOutOfDateOfferCodes

protected java.util.List<OfferCode> removeOutOfDateOfferCodes(java.util.List<OfferCode> offerCodes)
Removes all out of date offerCodes based on the offerCode and its offer's start and end date. If an offerCode has a later start date, that offerCode will be removed. OfferCodes without a start date will still be processed. If the offerCode has a end date that has already passed, that offerCode will be removed. OfferCodes without a end date will be processed. The start and end dates on the offer will still need to be evaluated.

Parameters:
offerCodes -
Returns:
a List of non-expired offers

applyOffersToOrder

public void applyOffersToOrder(java.util.List<Offer> offers,
                               Order order)
                        throws PricingException
Description copied from interface: OfferService
Apply offers to order.

Specified by:
applyOffersToOrder in interface OfferService
Parameters:
offers - the offers
order - the order
Throws:
PricingException

applyFulfillmentGroupOffersToOrder

public void applyFulfillmentGroupOffersToOrder(java.util.List<Offer> offers,
                                               Order order)
                                        throws PricingException
Specified by:
applyFulfillmentGroupOffersToOrder in interface OfferService
Throws:
PricingException

getCustomerOfferDao

public CustomerOfferDao getCustomerOfferDao()
Specified by:
getCustomerOfferDao in interface OfferService

setCustomerOfferDao

public void setCustomerOfferDao(CustomerOfferDao customerOfferDao)
Specified by:
setCustomerOfferDao in interface OfferService

getOfferCodeDao

public OfferCodeDao getOfferCodeDao()
Specified by:
getOfferCodeDao in interface OfferService

setOfferCodeDao

public void setOfferCodeDao(OfferCodeDao offerCodeDao)
Specified by:
setOfferCodeDao in interface OfferService

getOfferDao

public OfferDao getOfferDao()
Specified by:
getOfferDao in interface OfferService

setOfferDao

public void setOfferDao(OfferDao offerDao)
Specified by:
setOfferDao in interface OfferService

getOrderOfferProcessor

public OrderOfferProcessor getOrderOfferProcessor()
Specified by:
getOrderOfferProcessor in interface OfferService

setOrderOfferProcessor

public void setOrderOfferProcessor(OrderOfferProcessor orderOfferProcessor)
Specified by:
setOrderOfferProcessor in interface OfferService

getItemOfferProcessor

public ItemOfferProcessor getItemOfferProcessor()
Specified by:
getItemOfferProcessor in interface OfferService

setItemOfferProcessor

public void setItemOfferProcessor(ItemOfferProcessor itemOfferProcessor)
Specified by:
setItemOfferProcessor in interface OfferService

getFulfillmentGroupOfferProcessor

public FulfillmentGroupOfferProcessor getFulfillmentGroupOfferProcessor()
Specified by:
getFulfillmentGroupOfferProcessor in interface OfferService

setFulfillmentGroupOfferProcessor

public void setFulfillmentGroupOfferProcessor(FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor)
Specified by:
setFulfillmentGroupOfferProcessor in interface OfferService

getPromotableItemFactory

public PromotableItemFactory getPromotableItemFactory()
Specified by:
getPromotableItemFactory in interface OfferService

setPromotableItemFactory

public void setPromotableItemFactory(PromotableItemFactory promotableItemFactory)
Specified by:
setPromotableItemFactory in interface OfferService


Copyright © 2012. All Rights Reserved.