com.elasticpath.service.catalog
Interface ProductService

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

public interface ProductService
extends EpPersistenceService

Provides product-related business services. This service currently handles products, product types, and attributes for products although this may be moved later.


Method Summary
 Product add(Product product)
          Adds the given product.
 java.util.List findAllUids()
          Returns all product uids as a list.
 java.util.List findAvailableUids()
          Returns all available product uids as a list.
 java.util.List findAvailableUidsByModifiedDate(java.util.Date date)
          Retrieves list of Product uids where the last modified date is later than the specified date.
 java.util.List findByBrandUid(long brandUid)
          Returns a list of Product based on the given brand Uid.
 java.util.List findByBrandUid(long brandUid, ProductLoadTuner loadTuner)
          Returns a list of Product based on the given brand Uid.
 java.util.List findByCategoryUid(long categoryUid)
          Returns a list of Product based on the given category Uid.
 java.util.List findByCategoryUid(long categoryUid, ProductLoadTuner loadTuner)
          Returns a list of Product based on the given category Uid.
 java.util.List findByCategoryUidPaginated(long categoryUid, int startIndex, int numProducts, ProductLoadTuner loadTuner)
          Returns a list of Products based on the given category Uid.
 Product findByGuid(java.lang.String guid)
          Find the product with the given guid, for product, i.e.
 java.util.List findByModifiedDate(java.util.Date date)
          Retrieves list of Product where the last modified date is later than the specified date.
 java.util.List findByUids(java.util.Collection productUids, ProductLoadTuner loadTuner)
          Returns a list of Product based on the given uids.
 java.util.List findProductByCriteria(ProductSearchCriteria productSearchCriteria)
          Retrieve the list of products, whose specified property contain the given criteria value.
 java.util.List findProductTopSeller(int topCount, ProductLoadTuner productLoadTuner)
          Retrieve a list of top sellers of the whole store.
 java.util.List findProductTopSellerForCategory(long categoryUid)
          Retrieve the list of top selling products that belongs to the category or its subcategories.
 long findUidById(java.lang.String productId)
          Get the product UID of the given product identifier.
 java.util.List findUidsByCategoryUids(java.util.Collection categoryUids)
          Retrieves list of product uids belongs to either category uids given.
 java.util.List findUidsByDeletedDate(java.util.Date date)
          Retrieves list of product uids where the deleted date is later than the specified date.
 java.util.List findUidsByModifiedDate(java.util.Date date)
          Retrieves list of Product uids where the last modified date is later than the specified date.
 Product get(long productUid)
          Get the product with the given UID.
 ProductCategory getProductCategoryByProCatUid(long productUid, long categoryUid)
          Get a ProductCategory by the product uidPk and category uidPk.
 int getProductSkuCount(long productUid)
          Get a count of ProductSkus belong to this product.
 Product getTuned(long productUid, ProductLoadTuner loadTuner, ShoppingCart shoppingCart)
          Get the product with the given UID.
 Product getWithCategories(long productUid)
          Load the product with the given UID.
 boolean guidExists(java.lang.String guid)
          Checks whether the given product guid exists or not, for product, i.e.
 java.util.List list()
          List all products stored in the database.
 Product load(long productUid)
          Load the product with the given UID.
 void removeProductList(java.util.List productUidList)
          Deletes the list of products.
 void removeProductTree(long productUid)
          Deletes the product and all it associations.
 void resetProductCategoryFeatured(long productUid, long categoryUid)
          Disable a ProductCategory as a featured product, if the featuredProductOrder is set to 0, means this productCategory is not featured.
 void saveOrUpdate(Product product)
          Save or update the given product.
 int setProductCategoryFeatured(long productUid, long categoryUid)
          Set a ProductCategory as a featured product, if the featuredProductOrder is set to be greater than 0, means this productCategory is featured.
 void updateFeaturedProductOrder(long productUid, long categoryUid, long productUid2)
          Swap two ProductCategory featured product orders.
 void updateLastModifiedTime(Product product)
          Update the product's last modified timestamp.
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getObject, getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Method Detail

add

Product add(Product product)
            throws EpServiceException
Adds the given product.

Parameters:
product - the product to add
Returns:
the persisted instance of product
Throws:
EpServiceException - - in case of any errors

findAllUids

java.util.List findAllUids()
Returns all product uids as a list.

Returns:
all product uids as a list

findAvailableUids

java.util.List findAvailableUids()
Returns all available product uids as a list.

Returns:
all available product uids as a list

findAvailableUidsByModifiedDate

java.util.List findAvailableUidsByModifiedDate(java.util.Date date)
Retrieves list of Product uids where the last modified date is later than the specified date. Products refered by the returned uids are all available.

Parameters:
date - date to compare with the last modified date
Returns:
list of Product whose last modified date is later than the specified date

findByBrandUid

java.util.List findByBrandUid(long brandUid)
Returns a list of Product based on the given brand Uid.

Parameters:
brandUid - the brand Uid
Returns:
a list of Product

findByBrandUid

java.util.List findByBrandUid(long brandUid,
                              ProductLoadTuner loadTuner)
Returns a list of Product based on the given brand Uid. The returned products will be populated based on the given load tuner.

Parameters:
brandUid - the brand Uid
loadTuner - the load tuner, give null to populate all related data
Returns:
a list of Product

findByCategoryUid

java.util.List findByCategoryUid(long categoryUid)
Returns a list of Product based on the given category Uid.

Parameters:
categoryUid - the category Uid
Returns:
a list of Product

findByCategoryUid

java.util.List findByCategoryUid(long categoryUid,
                                 ProductLoadTuner loadTuner)
Returns a list of Product based on the given category Uid. The returned products will be populated based on the given load tuner.

Parameters:
categoryUid - the category Uid
loadTuner - the load tuner, give null to populate all related data
Returns:
a list of Product

findByCategoryUidPaginated

java.util.List findByCategoryUidPaginated(long categoryUid,
                                          int startIndex,
                                          int numProducts,
                                          ProductLoadTuner loadTuner)
Returns a list of Products based on the given category Uid. The returned products will be populated based on the given load tuner. This method allows a subset of the products to be returned at a time by giving the starting index of the first product and the number of products to be returned.

Parameters:
categoryUid - the category Uid
startIndex - the starting index of the first product to be returned
numProducts - the number of products to be returned, starting from the start index
loadTuner - the load tuner, give null to populate all related data
Returns:
a list of Product

findByGuid

Product findByGuid(java.lang.String guid)
                   throws EpServiceException
Find the product with the given guid, for product, i.e. product code.

Parameters:
guid - the product code.
Returns:
the product that matches the given guid (code), otherwise null
Throws:
EpServiceException - - in case of any errors

findByModifiedDate

java.util.List findByModifiedDate(java.util.Date date)
Retrieves list of Product where the last modified date is later than the specified date.

Parameters:
date - date to compare with the last modified date
Returns:
list of Product whose last modified date is later than the specified date

findByUids

java.util.List findByUids(java.util.Collection productUids,
                          ProductLoadTuner loadTuner)
Returns a list of Product based on the given uids. The returned products will be populated based on the given load tuner. If a given product Uid is not found, it won't be included in the return list.

Parameters:
productUids - a collection of product uids
loadTuner - the load tuner
Returns:
a list of Products

findProductByCriteria

java.util.List findProductByCriteria(ProductSearchCriteria productSearchCriteria)
Retrieve the list of products, whose specified property contain the given criteria value.

Parameters:
productSearchCriteria - criteria for product search.
Returns:
list of products matching the given criteria.

findProductTopSeller

java.util.List findProductTopSeller(int topCount,
                                    ProductLoadTuner productLoadTuner)
                                    throws EpServiceException
Retrieve a list of top sellers of the whole store.

Parameters:
topCount - the number of top seller products to retrieve
productLoadTuner - the product load tunner to control data get loaded
Returns:
the list of top sellers of the whole store
Throws:
EpServiceException - in case of any error

findProductTopSellerForCategory

java.util.List findProductTopSellerForCategory(long categoryUid)
                                               throws EpServiceException
Retrieve the list of top selling products that belongs to the category or its subcategories.

Parameters:
categoryUid - the category id
Returns:
the list of top selling products that belongs to the category or its subcategories
Throws:
EpServiceException - in case of any error

findUidById

long findUidById(java.lang.String productId)
                 throws EpServiceException
Get the product UID of the given product identifier. The given product identifier will frist be dealt as a guid to try to find a product UID. It no product UID is found and the given identifier is a long value, itself will be dealt as UID.

Parameters:
productId - the Product Guid or UID.
Returns:
the product UID, otherwise 0
Throws:
EpServiceException - - in case of any errors

findUidsByCategoryUids

java.util.List findUidsByCategoryUids(java.util.Collection categoryUids)
Retrieves list of product uids belongs to either category uids given.

Parameters:
categoryUids - category uids
Returns:
list of product uids

findUidsByDeletedDate

java.util.List findUidsByDeletedDate(java.util.Date date)
Retrieves list of product uids where the deleted date is later than the specified date.

Parameters:
date - date to compare with the deleted date
Returns:
list of product uids whose deleted date is later than the specified date

findUidsByModifiedDate

java.util.List findUidsByModifiedDate(java.util.Date date)
Retrieves list of Product uids where the last modified date is later than the specified date.

Parameters:
date - date to compare with the last modified date
Returns:
list of Product whose last modified date is later than the specified date

get

Product get(long productUid)
            throws EpServiceException
Get the product with the given UID. Return null if no matching record exists.

Parameters:
productUid - the Product UID.
Returns:
the product if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getProductCategoryByProCatUid

ProductCategory getProductCategoryByProCatUid(long productUid,
                                              long categoryUid)
Get a ProductCategory by the product uidPk and category uidPk.

Parameters:
productUid - the unique identifier for the product
categoryUid - the unique identifier for the category
Returns:
productCategory the productCategory

getProductSkuCount

int getProductSkuCount(long productUid)
Get a count of ProductSkus belong to this product.

Parameters:
productUid - the uid of the product.
Returns:
a count of ProductSkus belong to this product.

getTuned

Product getTuned(long productUid,
                 ProductLoadTuner loadTuner,
                 ShoppingCart shoppingCart)
                 throws EpServiceException
Get the product with the given UID. Return null if no matching record exists. You can give a product load tuner to fine control what data get populated of the returned product.

By giving a shopping cart, promotion rules will be applied to the returned product.

Parameters:
productUid - the Product UID.
loadTuner - the product load tuner
shoppingCart - the shopping cart, give null if you don't have it.
Returns:
the product if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getWithCategories

Product getWithCategories(long productUid)
                          throws EpServiceException
Load the product with the given UID. Also load all the categories that the product belongs to.

Parameters:
productUid - the product UID
Returns:
the product if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

guidExists

boolean guidExists(java.lang.String guid)
                   throws EpServiceException
Checks whether the given product guid exists or not, for product, i.e. product code.

Parameters:
guid - the product code.
Returns:
true if the given guid(code) exists.
Throws:
EpServiceException - - in case of any errors

list

java.util.List list()
                    throws EpServiceException
List all products stored in the database.

Returns:
a list of products
Throws:
EpServiceException - - in case of any errors

load

Product load(long productUid)
             throws EpServiceException
Load the product with the given UID.

Parameters:
productUid - the product UID
Returns:
the product if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

removeProductList

void removeProductList(java.util.List productUidList)
                       throws EpServiceException
Deletes the list of products.

Parameters:
productUidList - the product Uid List to be removed
Throws:
EpServiceException - - in case of any errors

removeProductTree

void removeProductTree(long productUid)
                       throws EpServiceException
Deletes the product and all it associations.

Parameters:
productUid - the uid of product to remove
Throws:
EpServiceException - in case of any errors

resetProductCategoryFeatured

void resetProductCategoryFeatured(long productUid,
                                  long categoryUid)
Disable a ProductCategory as a featured product, if the featuredProductOrder is set to 0, means this productCategory is not featured.

Parameters:
productUid - the unique identifier for the product
categoryUid - the unique identifier for the category

saveOrUpdate

void saveOrUpdate(Product product)
                  throws EpServiceException
Save or update the given product.

Parameters:
product - the product to save or update
Throws:
EpServiceException - - in case of any errors

setProductCategoryFeatured

int setProductCategoryFeatured(long productUid,
                               long categoryUid)
Set a ProductCategory as a featured product, if the featuredProductOrder is set to be greater than 0, means this productCategory is featured.

Parameters:
productUid - the unique identifier for the product
categoryUid - the unique identifier for the category
Returns:
featuredProductOrder the fetured product order of the ProductCategory

updateFeaturedProductOrder

void updateFeaturedProductOrder(long productUid,
                                long categoryUid,
                                long productUid2)
Swap two ProductCategory featured product orders.

Parameters:
productUid - the unique identifier for the product
categoryUid - the unique identifier for the category
productUid2 - the unique identifier for the product to be swaped

updateLastModifiedTime

void updateLastModifiedTime(Product product)
Update the product's last modified timestamp.

Parameters:
product - the product whose timestamp is to be updated.