com.elasticpath.service.catalog
Interface TopSellerService

All Superinterfaces:
EpPersistenceService, EpService
All Known Implementing Classes:
TopSellerServiceImpl

public interface TopSellerService
extends EpPersistenceService

Provides services to process top seller related information.


Method Summary
 boolean calculateSalesCount()
          Calculate the number of sales for a product and update its sales count based on the number of items ordered in the order.
 TopSeller findTopSellerByCategoryUid(long categoryUid)
          Find top sellers of the given category uid.
 org.apache.commons.collections.map.ListOrderedMap getTopCategoriesFromDate(java.util.Date startDate, int numResults)
          Get map of leaf Categories and number of sales since a specific date.
 org.apache.commons.collections.map.ListOrderedMap getTopProductsFromDate(java.util.Date startDate, int numResults)
          Get map of Products and number of sales since a specific date.
 void setCategoryService(CategoryService categoryService)
          Set the category service.
 void setOrderService(OrderService orderService)
          Set the order service.
 void setProductService(ProductService productService)
          Set the product service.
 void setPropertiesDao(PropertiesDao propertiesDao)
          Sets the DAO used to load properties.
 void setUtility(Utility utility)
          Set the utility class.
 void updateTopSellers()
          Calculate the number of sales for a particular product and update its sales count.
 void updateTopSellersForCategories()
          Populate top sellers for each categories.
 void updateTopSellersForTheStore()
          Populate top sellers for the store.
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getObject, getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Method Detail

calculateSalesCount

boolean calculateSalesCount()
Calculate the number of sales for a product and update its sales count based on the number of items ordered in the order.

Returns:
true if has updates

findTopSellerByCategoryUid

TopSeller findTopSellerByCategoryUid(long categoryUid)
Find top sellers of the given category uid. Give 0 to find top sellers for the whole store.

Parameters:
categoryUid - the category uid, give 0 to find top sellers for the whole store
Returns:
a TopSeller if found, otherwise null

getTopCategoriesFromDate

org.apache.commons.collections.map.ListOrderedMap getTopCategoriesFromDate(java.util.Date startDate,
                                                                           int numResults)
Get map of leaf Categories and number of sales since a specific date.

Parameters:
startDate - Date to start calculation from
numResults - The maximum number of products to return
Returns:
map of categories and associated number of sales, sorted by sale numbers

getTopProductsFromDate

org.apache.commons.collections.map.ListOrderedMap getTopProductsFromDate(java.util.Date startDate,
                                                                         int numResults)
Get map of Products and number of sales since a specific date.

Parameters:
startDate - Date to start calculation from
numResults - The maximum number of products to return
Returns:
map of product and associated number of sales, sorted by sale numbers

setCategoryService

void setCategoryService(CategoryService categoryService)
Set the category service.

Parameters:
categoryService - the category service

setOrderService

void setOrderService(OrderService orderService)
Set the order service.

Parameters:
orderService - the order service

setProductService

void setProductService(ProductService productService)
Set the product service.

Parameters:
productService - the product service

setPropertiesDao

void setPropertiesDao(PropertiesDao propertiesDao)
Sets the DAO used to load properties.

Parameters:
propertiesDao - the properties DAO used to retrieve properties information

setUtility

void setUtility(Utility utility)
Set the utility class.

Parameters:
utility - the utility class

updateTopSellers

void updateTopSellers()
Calculate the number of sales for a particular product and update its sales count. Also populate top sellers for each category and the whole store.


updateTopSellersForCategories

void updateTopSellersForCategories()
Populate top sellers for each categories.


updateTopSellersForTheStore

void updateTopSellersForTheStore()
Populate top sellers for the store.