com.elasticpath.service.shoppingcart.impl
Class ShoppingCartServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.shoppingcart.impl.ShoppingCartServiceImpl
All Implemented Interfaces:
EpPersistenceService, EpService, ShoppingCartService

public class ShoppingCartServiceImpl
extends AbstractEpPersistenceServiceImpl
implements ShoppingCartService

Service for retrieving and saving Shopping Carts.


Constructor Summary
ShoppingCartServiceImpl()
           
 
Method Summary
 ShoppingCart add(ShoppingCart shoppingCart)
          Adds the given shopping cart.
 ShoppingCart getCartByCustomerSession(CustomerSession customerSession)
          This method retrieves the shopping cart for the given customer session.
 java.lang.Object getObject(long uid)
          Generic get method for all persistable domain models.
 ShoppingCart load(long shoppingCartUid)
          Load the shopping cart with the given UID.
 void setCustomerSessionService(CustomerSessionService customerSessionService)
          Sets the customer session service.
 void setLazyLoadHelper(LazyLoadHelper lazyLoadHelper)
          Sets the lazy load helper.
 void setProductLoadTuner(ProductLoadTuner productLoadTuner)
          Sets the ProductLoadTuner for populating all data.
 void setProductSkuLoadTuner(ProductSkuLoadTuner productSkuLoadTuner)
          Sets the ProductSkuLoadTuner for populating all data.
 void update(ShoppingCart shoppingCart)
          Updates the given shopping cart.
 
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

ShoppingCartServiceImpl

public ShoppingCartServiceImpl()
Method Detail

add

public ShoppingCart add(ShoppingCart shoppingCart)
                 throws EpServiceException
Adds the given shopping cart.

Specified by:
add in interface ShoppingCartService
Parameters:
shoppingCart - the shopping cart to add
Returns:
the persisted instance of shoppingCart.
Throws:
EpServiceException - - in case of any errors

getCartByCustomerSession

public ShoppingCart getCartByCustomerSession(CustomerSession customerSession)
                                      throws EpServiceException
This method retrieves the shopping cart for the given customer session. Although this is not yet implemented, this method will attempt to find carts corresponding to the customer in the customer session or the session GUID if there is no customer. If multiple carts have been saved for the session or customer, they will be merged and the merged cart will be returned.

Specified by:
getCartByCustomerSession in interface ShoppingCartService
Parameters:
customerSession - the customer session for which the shopping cart is requested
Returns:
the shopping cart corresponding to the session or an empty cart if no session was found
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 EpPersistenceService
Parameters:
uid - the persisted instance uid
Returns:
the persisted instance if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

load

public ShoppingCart load(long shoppingCartUid)
                  throws EpServiceException
Load the shopping cart with the given UID.

Specified by:
load in interface ShoppingCartService
Parameters:
shoppingCartUid - the shopping cart UID
Returns:
the shopping cart if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

setCustomerSessionService

public void setCustomerSessionService(CustomerSessionService customerSessionService)
Sets the customer session service.

Parameters:
customerSessionService - the customer session service

setLazyLoadHelper

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

Parameters:
lazyLoadHelper - the lazy load helper

setProductLoadTuner

public void setProductLoadTuner(ProductLoadTuner productLoadTuner)
Sets the ProductLoadTuner for populating all data.

Parameters:
productLoadTuner - the ProductSkuLoadTuner for populating all data.

setProductSkuLoadTuner

public void setProductSkuLoadTuner(ProductSkuLoadTuner productSkuLoadTuner)
Sets the ProductSkuLoadTuner for populating all data.

Parameters:
productSkuLoadTuner - the ProductSkuLoadTuner for populating all data.

update

public void update(ShoppingCart shoppingCart)
            throws EpServiceException
Updates the given shopping cart.

Specified by:
update in interface ShoppingCartService
Parameters:
shoppingCart - the shopping cart to update
Throws:
EpServiceException - - in case of any errors