Class DefaultSapCartFacade
- java.lang.Object
-
- de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
-
- de.hybris.platform.sap.sapordermgmtb2bfacades.order.impl.DefaultSapCartFacade
-
- All Implemented Interfaces:
CartFacade
public class DefaultSapCartFacade extends DefaultCartFacade
Implementation forCartFacade. Delivers main functionality for cart.
-
-
Constructor Summary
Constructors Constructor Description DefaultSapCartFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CartModificationData>addItemsToCart(java.util.List<OrderEntryData> cartEntries)Add quick order entries to cartCartModificationDataaddToCart(java.lang.String code, long quantity)Method for adding a product to cart.CartModificationDataaddToCart(java.lang.String code, long quantity, java.lang.String storeId)Method for adding a product to cart.CartDataestimateExternalTaxes(java.lang.String deliveryZipCode, java.lang.String countryIsoCode)Estimate taxes on the cart.BackendAvailabilityServicegetBackendAvailabilityService()BaseStoreServicegetBaseStoreService()CartRestorationFacadegetCartRestorationFacade()java.util.List<CartData>getCartsForCurrentUser()Returns all carts for current site and user.java.util.List<CountryData>getDeliveryCountries()Get the supported delivery countries.I18NServicegetI18nService()org.springframework.context.MessageSourcegetMessageSource()CartDatagetMiniCart()Method gets smaller version of cart, with data necessary for showing mini cart.ProductImageHelpergetProductImageHelper()java.util.List<SapCartFacadeHook>getSapCartFacadeHooks()CartServicegetSapCartService()CartDatagetSessionCart()Method gets cart from session, if any exist.CartDatagetSessionCartWithEntryOrdering(boolean recentlyAddedFirst)Method gets cart sorted by recently added entries from session, if param is set to trueSessionServicegetSessionService()booleanhasEntries()Check if session cart has entries, avoiding full conversion of the cart to CartData.booleanhasSessionCart()Check if session has a cart.protected booleanisSyncOrdermgmtEnabled()voidremoveSessionCart()If existing the current session cart is being detached from this session and removed.voidremoveStaleCarts()Remove the stale carts of the current user.CartRestorationDatarestoreAnonymousCartAndMerge(java.lang.String fromAnonumousCartGuid, java.lang.String toUserCartGuid)Merges carts from anonymous to given user's cart, restores user's cart to the session, sets its user to current user.CartRestorationDatarestoreAnonymousCartAndTakeOwnership(java.lang.String guid)Restores the anonymous user's cart to the session and sets its user to current user.CartRestorationDatarestoreCartAndMerge(java.lang.String fromUserCartGuid, java.lang.String toUserCartGuid)Merges user's carts, restores merged cart to the session, sets its user to current user.CartRestorationDatarestoreSavedCart(java.lang.String code)Restores the user's saved cart to the session.voidsetBackendAvailabilityService(BackendAvailabilityService backendAvailabilityService)voidsetBaseStoreService(BaseStoreService baseStoreService)voidsetCartRestorationFacade(CartRestorationFacade cartRestorationFacade)voidsetI18nService(I18NService i18nService)voidsetMessageSource(org.springframework.context.MessageSource messageSource)voidsetProductImageHelper(ProductImageHelper productImageHelper)voidsetSapCartFacadeHooks(java.util.List<SapCartFacadeHook> sapCartFacadeHooks)voidsetSapCartService(CartService sapCartService)voidsetSessionService(SessionService sessionService)CartModificationDataupdateCartEntry(long entryNumber, long quantity)Method for updating the number of products.CartModificationDataupdateCartEntry(long entryNumber, java.lang.String storeId)Method for updating the number of products.java.util.List<CartModificationData>validateCartData()Method for validating every entry in the cart-
Methods inherited from class de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
addToCart, configurationInfoToProductConfiguration, configureCartEntry, createCommerceCartParameter, createEmptyCart, deleteGroupedOrderEntriesMultiD, filterConfigurationsByConfigurator, getBaseSiteService, getCartConverter, getCartModificationConverter, getCartRestorationConverter, getCartService, getCommerceCartParameterConverter, getCommerceCartService, getCountryConverter, getDeliveryService, getGroupCartModificationListConverter, getMiniCartConverter, getModelService, getMostRecentCartGuidForUser, getOrderEntryConverter, getOrderEntryNumberForMultiD, getPointOfServiceService, getPriceDataFactory, getProductConfigurationMergeStrategies, getProductFacade, getProductService, getSessionCartGuid, getUserService, hasEntryGroups, mergeOrderEntryWithModelConfiguration, removeEntryGroup, setBaseSiteService, setCartConverter, setCartModificationConverter, setCartRestorationConverter, setCartService, setCommerceCartParameterConverter, setCommerceCartService, setCountryConverter, setDeliveryService, setGroupCartModificationListConverter, setMiniCartConverter, setModelService, setOrderEntryConverter, setPointOfServiceService, setPriceDataFactory, setProductConfigurationMergeStrategies, setProductFacade, setProductService, setUserService, updateCartEntry, updateCartMetadata
-
-
-
-
Method Detail
-
getI18nService
public I18NService getI18nService()
- Returns:
- the i18nService
-
setI18nService
public void setI18nService(I18NService i18nService)
- Parameters:
i18nService- the i18nService to set
-
getMessageSource
public org.springframework.context.MessageSource getMessageSource()
- Returns:
- the messageSource
-
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource)
- Parameters:
messageSource- the messageSource to set
-
hasSessionCart
public boolean hasSessionCart()
Description copied from interface:CartFacadeCheck if session has a cart.- Specified by:
hasSessionCartin interfaceCartFacade- Overrides:
hasSessionCartin classDefaultCartFacade- Returns:
- true if the session has a cart
-
getMiniCart
public CartData getMiniCart()
Description copied from interface:CartFacadeMethod gets smaller version of cart, with data necessary for showing mini cart.- Specified by:
getMiniCartin interfaceCartFacade- Overrides:
getMiniCartin classDefaultCartFacade- Returns:
- the mini card data
-
getSessionCart
public CartData getSessionCart()
Description copied from interface:CartFacadeMethod gets cart from session, if any exist.- Specified by:
getSessionCartin interfaceCartFacade- Overrides:
getSessionCartin classDefaultCartFacade- Returns:
- the cart data
-
getSessionCartWithEntryOrdering
public CartData getSessionCartWithEntryOrdering(boolean recentlyAddedFirst)
Description copied from interface:CartFacadeMethod gets cart sorted by recently added entries from session, if param is set to true- Specified by:
getSessionCartWithEntryOrderingin interfaceCartFacade- Overrides:
getSessionCartWithEntryOrderingin classDefaultCartFacade- Parameters:
recentlyAddedFirst- boolean value to determine whether to return sorted cart data- Returns:
- the cart data sorted by recently added entries
-
addToCart
public CartModificationData addToCart(java.lang.String code, long quantity) throws CommerceCartModificationException
Description copied from interface:CartFacadeMethod for adding a product to cart.- Specified by:
addToCartin interfaceCartFacade- Overrides:
addToCartin classDefaultCartFacade- Parameters:
code- code of product to addquantity- the quantity of the product- Returns:
- the cart modification data that includes a statusCode and the actual quantity added to the cart
- Throws:
CommerceCartModificationException- if the cart cannot be modified
-
addToCart
public CartModificationData addToCart(java.lang.String code, long quantity, java.lang.String storeId) throws CommerceCartModificationException
Description copied from interface:CartFacadeMethod for adding a product to cart.- Specified by:
addToCartin interfaceCartFacade- Overrides:
addToCartin classDefaultCartFacade- Parameters:
code- code of product to addquantity- the quantity of the productstoreId- The identifier for the store. If null {@see CartFacade#addToCart(String, long)} is used.- Returns:
- the cart modification data that includes a statusCode and the actual quantity added to the cart
- Throws:
CommerceCartModificationException- if the cart cannot be modified
-
addItemsToCart
public java.util.List<CartModificationData> addItemsToCart(java.util.List<OrderEntryData> cartEntries) throws CommerceCartModificationException
Add quick order entries to cart- Parameters:
cartEntries- list of cart entries- Returns:
- cart modification data
- Throws:
CommerceCartModificationException- exception
-
validateCartData
public java.util.List<CartModificationData> validateCartData() throws CommerceCartModificationException
Description copied from interface:CartFacadeMethod for validating every entry in the cart- Specified by:
validateCartDatain interfaceCartFacade- Overrides:
validateCartDatain classDefaultCartFacade- Returns:
- a list of cart modifications that includes a statusCode and the actual quantity that the entry was updated to
- Throws:
CommerceCartModificationException- if the cart cannot be modified
-
updateCartEntry
public CartModificationData updateCartEntry(long entryNumber, long quantity) throws CommerceCartModificationException
Description copied from interface:CartFacadeMethod for updating the number of products.- Specified by:
updateCartEntryin interfaceCartFacade- Overrides:
updateCartEntryin classDefaultCartFacade- Parameters:
entryNumber- the entry numberquantity- new value of quantity for product- Returns:
- the cart modification data that includes a statusCode and the actual quantity that the entry was updated to
- Throws:
CommerceCartModificationException- if the cart cannot be modified
-
isSyncOrdermgmtEnabled
protected boolean isSyncOrdermgmtEnabled()
-
getBaseStoreService
public BaseStoreService getBaseStoreService()
- Returns:
- the baseStoreService
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService baseStoreService)
- Parameters:
baseStoreService- the baseStoreService to set
-
getSapCartService
public CartService getSapCartService()
- Returns:
- the sapCartService
-
setSapCartService
public void setSapCartService(CartService sapCartService)
- Parameters:
sapCartService- the sapCartService to set
-
getBackendAvailabilityService
public BackendAvailabilityService getBackendAvailabilityService()
- Returns:
- the backendAvailabilityService
-
setBackendAvailabilityService
public void setBackendAvailabilityService(BackendAvailabilityService backendAvailabilityService)
- Parameters:
backendAvailabilityService- the backendAvailabilityService to set
-
getProductImageHelper
public ProductImageHelper getProductImageHelper()
- Returns:
- the productImageHelper
-
setProductImageHelper
public void setProductImageHelper(ProductImageHelper productImageHelper)
- Parameters:
productImageHelper- the productImageHelper to set
-
getCartRestorationFacade
public CartRestorationFacade getCartRestorationFacade()
- Returns:
- the cartRestorationFacade
-
setCartRestorationFacade
public void setCartRestorationFacade(CartRestorationFacade cartRestorationFacade)
- Parameters:
cartRestorationFacade- the cartRestorationFacade to set
-
updateCartEntry
public CartModificationData updateCartEntry(long entryNumber, java.lang.String storeId) throws CommerceCartModificationException
Description copied from interface:CartFacadeMethod for updating the number of products.- Specified by:
updateCartEntryin interfaceCartFacade- Overrides:
updateCartEntryin classDefaultCartFacade- Parameters:
entryNumber- The entry numberstoreId- The identifier for the store. Can be null.- Returns:
- the cart modification data that includes a statusCode and the actual quantity that the entry was updated to
- Throws:
CommerceCartModificationException- if the cart cannot be modified
-
restoreSavedCart
public CartRestorationData restoreSavedCart(java.lang.String code) throws CommerceCartRestorationException
Description copied from interface:CartFacadeRestores the user's saved cart to the session. For non-anonymous users, the cart restored will be for the current user and site.- Specified by:
restoreSavedCartin interfaceCartFacade- Overrides:
restoreSavedCartin classDefaultCartFacade- Parameters:
code- the cart guid to restore for Anonymous user.- Returns:
- the cart restoration data that includes details of any items that could not be restored in part or in full.
- Throws:
CommerceCartRestorationException
-
getDeliveryCountries
public java.util.List<CountryData> getDeliveryCountries()
Description copied from interface:CartFacadeGet the supported delivery countries. The list is sorted alphabetically.- Specified by:
getDeliveryCountriesin interfaceCartFacade- Overrides:
getDeliveryCountriesin classDefaultCartFacade- Returns:
- list of supported delivery countries.
-
estimateExternalTaxes
public CartData estimateExternalTaxes(java.lang.String deliveryZipCode, java.lang.String countryIsoCode)
Description copied from interface:CartFacadeEstimate taxes on the cart.- Specified by:
estimateExternalTaxesin interfaceCartFacade- Overrides:
estimateExternalTaxesin classDefaultCartFacade- Parameters:
deliveryZipCode- delivery zip code used for calculating external taxescountryIsoCode- delivery country used for calculating taxes- Returns:
- cart data that represents the current cart with taxes estimations added
-
removeStaleCarts
public void removeStaleCarts()
Description copied from interface:CartFacadeRemove the stale carts of the current user.- Specified by:
removeStaleCartsin interfaceCartFacade- Overrides:
removeStaleCartsin classDefaultCartFacade
-
restoreAnonymousCartAndTakeOwnership
public CartRestorationData restoreAnonymousCartAndTakeOwnership(java.lang.String guid) throws CommerceCartRestorationException
Description copied from interface:CartFacadeRestores the anonymous user's cart to the session and sets its user to current user.- Specified by:
restoreAnonymousCartAndTakeOwnershipin interfaceCartFacade- Overrides:
restoreAnonymousCartAndTakeOwnershipin classDefaultCartFacade- Parameters:
guid- GUID used to find anonymous user's cart- Returns:
- the cart restoration data that includes details of any items that could not be restored in part or in full.
- Throws:
CommerceCartRestorationException
-
removeSessionCart
public void removeSessionCart()
Description copied from interface:CartFacadeIf existing the current session cart is being detached from this session and removed. Afterwards it's no longer available.- Specified by:
removeSessionCartin interfaceCartFacade- Overrides:
removeSessionCartin classDefaultCartFacade
-
getCartsForCurrentUser
public java.util.List<CartData> getCartsForCurrentUser()
Description copied from interface:CartFacadeReturns all carts for current site and user.- Specified by:
getCartsForCurrentUserin interfaceCartFacade- Overrides:
getCartsForCurrentUserin classDefaultCartFacade- Returns:
- list of carts
-
restoreAnonymousCartAndMerge
public CartRestorationData restoreAnonymousCartAndMerge(java.lang.String fromAnonumousCartGuid, java.lang.String toUserCartGuid) throws CommerceCartMergingException, CommerceCartRestorationException
Description copied from interface:CartFacadeMerges carts from anonymous to given user's cart, restores user's cart to the session, sets its user to current user.- Specified by:
restoreAnonymousCartAndMergein interfaceCartFacade- Overrides:
restoreAnonymousCartAndMergein classDefaultCartFacade- Parameters:
fromAnonumousCartGuid- - Anonymous user's cart from merging is donetoUserCartGuid- - User's cart to merge to- Returns:
CartRestorationDataobject holding information about the restoration- Throws:
CommerceCartMergingExceptionCommerceCartRestorationException
-
restoreCartAndMerge
public CartRestorationData restoreCartAndMerge(java.lang.String fromUserCartGuid, java.lang.String toUserCartGuid) throws CommerceCartRestorationException, CommerceCartMergingException
Description copied from interface:CartFacadeMerges user's carts, restores merged cart to the session, sets its user to current user.- Specified by:
restoreCartAndMergein interfaceCartFacade- Overrides:
restoreCartAndMergein classDefaultCartFacade- Parameters:
fromUserCartGuid- - User's cart from merging is donetoUserCartGuid- - User's cart to merge to- Returns:
CartRestorationDataobject holding information about the restoration- Throws:
CommerceCartRestorationExceptionCommerceCartMergingException
-
hasEntries
public boolean hasEntries()
Description copied from interface:CartFacadeCheck if session cart has entries, avoiding full conversion of the cart to CartData. For Performance.- Specified by:
hasEntriesin interfaceCartFacade- Overrides:
hasEntriesin classDefaultCartFacade- Returns:
- true if the cart has any entries.
-
getSapCartFacadeHooks
public java.util.List<SapCartFacadeHook> getSapCartFacadeHooks()
- Returns:
- the sapCartFacadeHooks
-
setSapCartFacadeHooks
public void setSapCartFacadeHooks(java.util.List<SapCartFacadeHook> sapCartFacadeHooks)
- Parameters:
sapCartFacadeHooks- the sapCartFacadeHooks to set
-
getSessionService
public SessionService getSessionService()
- Returns:
- the sessionService
-
setSessionService
public void setSessionService(SessionService sessionService)
- Parameters:
sessionService- the sessionService to set
-
-