Class DefaultCartLoaderStrategy
java.lang.Object
de.hybris.platform.commercewebservicescommons.strategies.impl.DefaultCartLoaderStrategy
- All Implemented Interfaces:
CartLoaderStrategy
- Direct Known Subclasses:
SelectiveCartLoaderStrategy
Strategy that loads cart into the session
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDeprecated, for removal: This API element is subject to removal in a future version.not usedprotected voidcheckCartExpiration(String requestedCartID, String restoredCartID) Checks whether cart expired and informs user about the changeprotected BaseSiteServiceprotected CartServiceprotected CommerceCartServiceprotected booleanisBaseSiteValid(CartModel cart) Checks if base site set in the cart is the same as one set in baseSiteService.booleanprotected voidloadAnonymousCart(String cartID, boolean refresh) Loads anonymous or guest cartvoidLoads cart for current sessionvoidLoads cart for current sessionprotected voidloadUserCart(String cartID, boolean refresh) Loads customer's cartprotected voidrestoreCart(CartModel cart, String requestedCartId, boolean refresh) Restores a cart.voidsetBaseSiteService(BaseSiteService baseSiteService) voidsetCartRefreshedByDefault(boolean cartRefreshedByDefault) voidsetCartService(CartService cartService) voidsetCommerceCartService(CommerceCartService commerceCartService) voidsetCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService) voidsetModelService(ModelService modelService) voidsetUserService(UserService userService)
-
Constructor Details
-
DefaultCartLoaderStrategy
public DefaultCartLoaderStrategy()
-
-
Method Details
-
loadCart
Description copied from interface:CartLoaderStrategyLoads cart for current session- Specified by:
loadCartin interfaceCartLoaderStrategy- Parameters:
cartId- Cart identifier (can be guid or code)
-
loadCart
Description copied from interface:CartLoaderStrategyLoads cart for current session- Specified by:
loadCartin interfaceCartLoaderStrategy- Parameters:
cartId- Cart identifier (can be guid or code)refresh- Define if cart should be refreshed (recalculated). Refreshing cart can change it.
-
loadUserCart
Loads customer's cart- Parameters:
cartID-
-
restoreCart
Restores a cart. The cart is recalculated if the refresh parameter is true or the cart currency is different than the currency currently set. It usesCommerceCartService.restoreCart(CommerceCartParameter)method, which includes logic to verify cart expiration, rebuild cart, delete cart payment transactions, cart recalculation and current cart setting.- Parameters:
cart- user cartrequestedCartId- requested cart idrefresh- forces recalculation of the cart- Throws:
CartException- thrown in case cart restoration error
-
loadAnonymousCart
Loads anonymous or guest cart- Parameters:
cartID-
-
isBaseSiteValid
Checks if base site set in the cart is the same as one set in baseSiteService. It prevents mixing requests for multiple sites in one session -
applyCurrencyToCartAndRecalculateIfNeeded
@Deprecated(since="2011", forRemoval=true) protected void applyCurrencyToCartAndRecalculateIfNeeded()Deprecated, for removal: This API element is subject to removal in a future version.not usedChecks currently set currency and compares it with one set in cart. If not equal, sets new currency in cart and recalculates. This is similar logic to SessionContext.checkSpecialAttributes. Calling this is needed if checkSpecialAttributes was called before (when there was no cart in session) -
checkCartExpiration
Checks whether cart expired and informs user about the change- Parameters:
requestedCartID-
-
setUserService
-
getCommerceCartService
-
setCommerceCartService
-
getCartService
-
setCartService
-
getBaseSiteService
-
setBaseSiteService
-
getCommerceCommonI18NService
-
setCommerceCommonI18NService
-
getModelService
-
setModelService
-
isCartRefreshedByDefault
public boolean isCartRefreshedByDefault() -
setCartRefreshedByDefault
public void setCartRefreshedByDefault(boolean cartRefreshedByDefault)
-