com.elasticpath.service.catalog.impl
Class ProductSkuServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.catalog.impl.ProductSkuServiceImpl
All Implemented Interfaces:
ProductSkuService, EpPersistenceService, EpService

public class ProductSkuServiceImpl
extends AbstractEpPersistenceServiceImpl
implements ProductSkuService

The default implementation of ProductSkuService.


Constructor Summary
ProductSkuServiceImpl()
           
 
Method Summary
 ProductSku add(ProductSku productSku)
          Adds the given product sku.
 java.util.List findByProductUid(long productUid)
          Returns a list of ProductSku based on the given product Uid.
 ProductSku findBySkuCode(java.lang.String skuCode)
          Finds a ProductSku by its SKU Code.
 ProductSku findBySkuCodeWithAll(java.lang.String skuCode)
          Finds a ProductSku by its SKU Code and populates all lazy-loaded references.
 java.util.List findProductSkuCodeLikeWithRestriction(java.lang.String criteriaValue, long parentCategoryUid)
          Retrieve the list of productSkus, whose name matches the given criteria and belongs to direct or indirect subcategory of the specified parent category.
 java.util.List findProductSkuLike(java.lang.String propertyName, java.lang.String criteriaValue)
          Retrieve the list of productSkus, whose specified property contain the given criteria value.
 long findUidBySkuCode(java.lang.String skuCode)
          Get the sku UID of the given sku identifier.
 ProductSku get(long productSkuUid)
          Get the productSku with the given UID.
 java.lang.Object getObject(long uid)
          Generic get method for all persistable domain models.
 Utility getUtility()
          Returns the utility instance.
 ProductSku getWithProduct(long productSkuUid)
          Get the productSku with the given UID and load the parent product as well.
 ProductSku getWithPromotions(long productSkuUid, ShoppingCart shoppingCart)
          Get the productSku with the given UID.
 void removeProductSkuTree(long productSkuUid)
          Deletes the product sku and all it associations.
 void saveOrUpdate(ProductSku sku)
          Save or update the given product sku.
 void setCategoryService(CategoryService categoryService)
          Set the CategoryService singleton.
 void setLazyLoadHelper(LazyLoadHelper lazyLoadHelper)
          Sets the lazy load helper.
 void setProductLoadTunerAll(ProductLoadTuner productLoadTunerAll)
          Sets the ProductLoadTuner for populating all data.
 void setProductService(ProductService productService)
          Set the product service.
 void setProductSkuLoadTunerAll(ProductSkuLoadTuner productSkuLoadTunerAll)
          Sets the ProductSkuLoadTuner for populating all data.
 void setProductSkuLoadTunerMinimal(ProductSkuLoadTuner productSkuLoadTunerMinimal)
          Sets the ProductSkuLoadTuner to populate the SkuOptionValues.
 void setRuleEngine(EpRuleEngine epRuleEngine)
          Sets the rule engine.
 void setUtility(Utility utility)
          Sets the utility.
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Constructor Detail

ProductSkuServiceImpl

public ProductSkuServiceImpl()
Method Detail

add

public ProductSku add(ProductSku productSku)
               throws EpServiceException
Adds the given product sku.

Specified by:
add in interface ProductSkuService
Parameters:
productSku - the product sku to add
Returns:
the persisted instance of product sku
Throws:
EpServiceException - - in case of any errors

findByProductUid

public java.util.List findByProductUid(long productUid)
Returns a list of ProductSku based on the given product Uid.

Specified by:
findByProductUid in interface ProductSkuService
Parameters:
productUid - the product Uid
Returns:
a list of ProductSku

findBySkuCode

public ProductSku findBySkuCode(java.lang.String skuCode)
Finds a ProductSku by its SKU Code.

Specified by:
findBySkuCode in interface ProductSkuService
Parameters:
skuCode - the sku code
Returns:
a ProductSku or null if no matching SKU is found

findBySkuCodeWithAll

public ProductSku findBySkuCodeWithAll(java.lang.String skuCode)
Finds a ProductSku by its SKU Code and populates all lazy-loaded references.

Specified by:
findBySkuCodeWithAll in interface ProductSkuService
Parameters:
skuCode - the sku code
Returns:
a ProductSku or null if no matching SKU is found

findProductSkuCodeLikeWithRestriction

public java.util.List findProductSkuCodeLikeWithRestriction(java.lang.String criteriaValue,
                                                            long parentCategoryUid)
                                                     throws EpServiceException
Retrieve the list of productSkus, whose name matches the given criteria and belongs to direct or indirect subcategory of the specified parent category.

Specified by:
findProductSkuCodeLikeWithRestriction in interface ProductSkuService
Parameters:
criteriaValue - criteria value to be used for searching.
parentCategoryUid - Parent Category used to restricted the search results.
Returns:
list of productSkus matching the given criteria.
Throws:
EpServiceException - in case of any error

findProductSkuLike

public java.util.List findProductSkuLike(java.lang.String propertyName,
                                         java.lang.String criteriaValue)
                                  throws EpServiceException
Retrieve the list of productSkus, whose specified property contain the given criteria value.

Specified by:
findProductSkuLike in interface ProductSkuService
Parameters:
propertyName - productSku property to search on.
criteriaValue - criteria value to be used for searching.
Returns:
list of productSkus matching the given criteria.
Throws:
EpServiceException - in case of any error

findUidBySkuCode

public long findUidBySkuCode(java.lang.String skuCode)
                      throws EpServiceException
Get the sku UID of the given sku identifier. The given sku identifier will first be dealt as a guid to try to find a sku UID.

Parameters:
skuCode - the SKU Code or Guid.
Returns:
the sku UID, otherwise 0
Throws:
EpServiceException - - in case of any errors

get

public ProductSku get(long productSkuUid)
               throws EpServiceException
Get the productSku with the given UID. Return null if no matching record exists.

Specified by:
get in interface ProductSkuService
Parameters:
productSkuUid - the ProductSku UID.
Returns:
the productSku if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getObject

public java.lang.Object getObject(long uid)
                           throws EpServiceException
Generic get method for all persistable domain models.

Specified by:
getObject in interface ProductSkuService
Specified by:
getObject in interface EpPersistenceService
Parameters:
uid - the persisted instance uid
Returns:
the persisted instance if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getUtility

public Utility getUtility()
Returns the utility instance.

Returns:
the utility instance.

getWithProduct

public ProductSku getWithProduct(long productSkuUid)
                          throws EpServiceException
Get the productSku with the given UID and load the parent product as well. Return null if no matching record exists.

Specified by:
getWithProduct in interface ProductSkuService
Parameters:
productSkuUid - the ProductSku UID.
Returns:
the productSku if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getWithPromotions

public ProductSku getWithPromotions(long productSkuUid,
                                    ShoppingCart shoppingCart)
                             throws EpServiceException
Get the productSku with the given UID. Return null if no matching record exists. The SKU is fully populated and will have rules applied if the shopping cart is passed in.

Specified by:
getWithPromotions in interface ProductSkuService
Parameters:
productSkuUid - the ProductSku UID.
shoppingCart - pass in the shopping cart to apply promotion rules
Returns:
the productSku if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

removeProductSkuTree

public void removeProductSkuTree(long productSkuUid)
                          throws EpServiceException
Deletes the product sku and all it associations.

Specified by:
removeProductSkuTree in interface ProductSkuService
Parameters:
productSkuUid - the uid of product sku to remove
Throws:
EpServiceException - in case of any errors

saveOrUpdate

public void saveOrUpdate(ProductSku sku)
                  throws DuplicateKeyException
Save or update the given product sku.

Specified by:
saveOrUpdate in interface ProductSkuService
Parameters:
sku - the product sku to save or update
Throws:
DuplicateKeyException - - when sku code is duplicate in the db

setCategoryService

public void setCategoryService(CategoryService categoryService)
Set the CategoryService singleton.

Parameters:
categoryService - the CategoryService singleton.

setLazyLoadHelper

public void setLazyLoadHelper(LazyLoadHelper lazyLoadHelper)
Sets the lazy load helper.

Parameters:
lazyLoadHelper - the lazy load helper.

setProductLoadTunerAll

public void setProductLoadTunerAll(ProductLoadTuner productLoadTunerAll)
Sets the ProductLoadTuner for populating all data.

Parameters:
productLoadTunerAll - the ProductLoadTuner for populating all data.

setProductService

public void setProductService(ProductService productService)
Set the product service.

Parameters:
productService - the product service

setProductSkuLoadTunerAll

public void setProductSkuLoadTunerAll(ProductSkuLoadTuner productSkuLoadTunerAll)
Sets the ProductSkuLoadTuner for populating all data.

Parameters:
productSkuLoadTunerAll - the ProductSkuLoadTuner for populating all data.

setProductSkuLoadTunerMinimal

public void setProductSkuLoadTunerMinimal(ProductSkuLoadTuner productSkuLoadTunerMinimal)
Sets the ProductSkuLoadTuner to populate the SkuOptionValues.

Parameters:
productSkuLoadTunerMinimal - the ProductSkuLoadTuner for populating only the SkuOptionValues.

setRuleEngine

public void setRuleEngine(EpRuleEngine epRuleEngine)
Sets the rule engine.

Parameters:
epRuleEngine - the rule engine

setUtility

public void setUtility(Utility utility)
Sets the utility.

Parameters:
utility - the utility to set