Class DefaultCartRestorationService
- java.lang.Object
-
- de.hybris.platform.sap.sapordermgmtservices.cart.impl.DefaultCartRestorationService
-
- All Implemented Interfaces:
CartRestorationService
public class DefaultCartRestorationService extends java.lang.Object implements CartRestorationService
Default implementation of the restoration service. Task of this class is to create a BOL representation of the cart (which has a counterpart in the SAP back end) from a persisted hybris cart.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringSESSION_CART_PARAMETER_NAMEHybris session cart is stored in hybris session using this key
-
Constructor Summary
Constructors Constructor Description DefaultCartRestorationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<Item>createItemsFromCart(CartModel fromCart)Creates a list of BOL items from a hybris cart model.java.util.List<CartRestorationServiceHook>getCartRestorationServiceHooks()CartServicegetCartService()CartModelgetInternalSessionCart()Returns the standard session cart, basing on the hybris persistenceItemFactorygetItemFactory()protected ModelServicegetModelService()SessionServicegetSessionService()booleanhasInternalSessionCart()Does a standard session cart exist?voidremoveInternalSessionCart()Removes the internal session cart, basing on the hybris persistenceCartRestorationDatarestoreCart(CartModel fromCart)Restores a BOL cart from the persisted standard session cartvoidsetCartFactory(CartFactory cartFactory)Sets standard cart factory via spring injectionvoidsetCartRestorationServiceHooks(java.util.List<CartRestorationServiceHook> defaultCartRestorationServiceHook)voidsetCartService(CartService cartService)voidsetInternalSessionCart(CartModel cart)Sets session cart (stores it into the session)voidsetItemFactory(ItemFactory itemFactory)voidsetModelService(ModelService modelService)Sets standard model service via spring injectionvoidsetSessionService(SessionService sessionService)Sets standard session service via spring injection
-
-
-
Method Detail
-
restoreCart
public CartRestorationData restoreCart(CartModel fromCart)
Description copied from interface:CartRestorationServiceRestores a BOL cart from the persisted standard session cart- Specified by:
restoreCartin interfaceCartRestorationService- Parameters:
fromCart- Session cart in hybris persistence- Returns:
- Restorated cart, basing on the BOL cart
-
createItemsFromCart
protected java.util.List<Item> createItemsFromCart(CartModel fromCart)
Creates a list of BOL items from a hybris cart model. Those cart items carry following attributes copied from the entities of typeAbstractOrderEntryModel:- ProductId
- Quantity
- Parameters:
fromCart- Cart model- Returns:
- List of BOL items
-
setInternalSessionCart
public void setInternalSessionCart(CartModel cart)
Description copied from interface:CartRestorationServiceSets session cart (stores it into the session)- Specified by:
setInternalSessionCartin interfaceCartRestorationService
-
getInternalSessionCart
public CartModel getInternalSessionCart()
Description copied from interface:CartRestorationServiceReturns the standard session cart, basing on the hybris persistence- Specified by:
getInternalSessionCartin interfaceCartRestorationService- Returns:
- hybris cart model
-
hasInternalSessionCart
public boolean hasInternalSessionCart()
Description copied from interface:CartRestorationServiceDoes a standard session cart exist?- Specified by:
hasInternalSessionCartin interfaceCartRestorationService- Returns:
- true if a hybris session cart exists
-
removeInternalSessionCart
public void removeInternalSessionCart()
Description copied from interface:CartRestorationServiceRemoves the internal session cart, basing on the hybris persistence- Specified by:
removeInternalSessionCartin interfaceCartRestorationService
-
getSessionService
public SessionService getSessionService()
- Returns:
- Standard session service (needed to access session cart and references to product configuration runtime objects attached to cart entries)
-
setSessionService
public void setSessionService(SessionService sessionService)
Sets standard session service via spring injection- Parameters:
sessionService-
-
getModelService
protected ModelService getModelService()
- Returns:
- Model service
-
setModelService
public void setModelService(ModelService modelService)
Sets standard model service via spring injection- Parameters:
modelService-
-
setCartFactory
public void setCartFactory(CartFactory cartFactory)
Sets standard cart factory via spring injection- Parameters:
cartFactory-
-
getCartService
public CartService getCartService()
- Returns:
- the cartService
-
setCartService
public void setCartService(CartService cartService)
- Parameters:
cartService- the cartService to set
-
getCartRestorationServiceHooks
public java.util.List<CartRestorationServiceHook> getCartRestorationServiceHooks()
- Returns:
- the defaultCartRestorationServiceHook
-
setCartRestorationServiceHooks
public void setCartRestorationServiceHooks(java.util.List<CartRestorationServiceHook> defaultCartRestorationServiceHook)
- Parameters:
defaultCartRestorationServiceHook- the defaultCartRestorationServiceHook to set
-
getItemFactory
public ItemFactory getItemFactory()
- Returns:
- the itemFactory
-
setItemFactory
public void setItemFactory(ItemFactory itemFactory)
- Parameters:
itemFactory- the itemFactory to set
-
-