Class DefaultCartFacade
java.lang.Object
de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
- All Implemented Interfaces:
CartFacade
- Direct Known Subclasses:
CommerceWebServicesCartFacade,CommerceWebServicesCartFacade,DefaultCartFacade,DefaultSaveCartFacade
Implementation for
CartFacade. Delivers main functionality for cart.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddToCart(AddToCartParams addToCartParams) Method for adding a product to cart.Method for adding a product to cart.Method for adding a product to cart.protected ProductConfigurationItemconfigurationInfoToProductConfiguration(ConfigurationInfoData configurationInfoData) protected CartModificationDataconfigureCartEntry(OrderEntryData orderEntry, CartModificationData cartModificationData) protected CommerceCartParametercreateCommerceCartParameter(OrderEntryData orderEntry, List<ProductConfigurationItem> productConfigurationItemList) protected CartDataprotected CartModificationDatadeleteGroupedOrderEntriesMultiD(OrderEntryData orderEntry) estimateExternalTaxes(String deliveryZipCode, String countryIsoCode) Estimate taxes on the cart.protected List<ConfigurationInfoData>filterConfigurationsByConfigurator(List<ConfigurationInfoData> configurations, ConfiguratorType configuratorEnum) protected BaseSiteServiceprotected Converter<CommerceCartRestoration,CartRestorationData> protected CartServiceReturns all carts for current site and user.protected Converter<AddToCartParams,CommerceCartParameter> protected CommerceCartServiceDeprecated, for removal: This API element is subject to removal in a future version.since 1808.Method gets smaller version of cart, with data necessary for showing mini cart.protected ModelServicegetMostRecentCartGuidForUser(Collection<String> excludedCartGuid) Returns most recent cart guid for current site and user excluding the list of carts guid passed.protected Converter<AbstractOrderEntryModel,OrderEntryData> protected IntegergetOrderEntryNumberForMultiD(OrderEntryData findEntry) protected PointOfServiceServiceprotected Map<ConfiguratorType,ProductConfigurationMergeStrategy> protected ProductFacadeprotected ProductServiceMethod gets cart from session, if any exist.Returns session cart guid if any.getSessionCartWithEntryOrdering(boolean recentlyAddedFirst) Method gets cart sorted by recently added entries from session, if param is set to trueprotected UserServicebooleanCheck if session cart has entries, avoiding full conversion of the cart to CartData.protected booleanbooleanCheck if session has a cart.protected voidmergeOrderEntryWithModelConfiguration(OrderEntryData orderEntry) removeEntryGroup(Integer groupNumber) Removes group with all subsequent entries.voidIf existing the current session cart is being detached from this session and removed.voidRemove the stale carts of the current user.restoreAnonymousCartAndMerge(String fromAnonymousCartGuid, String toUserCartGuid) Merges carts from anonymous to given user's cart, restores user's cart to the session, sets its user to current user.Restores the anonymous user's cart to the session and sets its user to current user.restoreCartAndMerge(String fromUserCartGuid, String toUserCartGuid) Merges user's carts, restores merged cart to the session, sets its user to current user.restoreSavedCart(String guid) Restores the user's saved cart to the session.voidsetBaseSiteService(BaseSiteService baseSiteService) voidsetCartConverter(Converter<CartModel, CartData> cartConverter) voidsetCartModificationConverter(Converter<CommerceCartModification, CartModificationData> cartModificationConverter) voidsetCartRestorationConverter(Converter<CommerceCartRestoration, CartRestorationData> cartRestorationConverter) voidsetCartService(CartService cartService) voidsetCommerceCartParameterConverter(Converter<AddToCartParams, CommerceCartParameter> commerceCartParameterConverter) voidsetCommerceCartService(CommerceCartService commerceCartService) voidsetCountryConverter(Converter<CountryModel, CountryData> countryConverter) voidsetDeliveryService(DeliveryService deliveryService) voidsetGroupCartModificationListConverter(Converter<AbstractOrderModel, List<CartModificationData>> groupCartModificationListConverter) voidsetMiniCartConverter(Converter<CartModel, CartData> miniCartConverter) voidsetModelService(ModelService modelService) voidsetOrderEntryConverter(Converter<AbstractOrderEntryModel, OrderEntryData> orderEntryConverter) voidsetPointOfServiceService(PointOfServiceService pointOfServiceService) voidsetPriceDataFactory(PriceDataFactory priceDataFactory) voidsetProductConfigurationMergeStrategies(Map<ConfiguratorType, ProductConfigurationMergeStrategy> productConfigurationMergeStrategies) voidsetProductFacade(ProductFacade productFacade) voidsetProductService(ProductService productService) voidsetUserService(UserService userService) updateCartEntry(long entryNumber, long quantity) Method for updating the number of products.updateCartEntry(long entryNumber, String storeId) Method for updating the number of products.updateCartEntry(OrderEntryData orderEntry) Updates the given cart entry.voidupdateCartMetadata(CommerceCartMetadata metadata) Updates cart metadata, such as: name, description, expiration time.Method for validating every entry in the cart
-
Constructor Details
-
DefaultCartFacade
public DefaultCartFacade()
-
-
Method Details
-
getSessionCart
Description copied from interface:CartFacadeMethod gets cart from session, if any exist.- Specified by:
getSessionCartin interfaceCartFacade- Returns:
- the cart data
-
getSessionCartGuid
Description copied from interface:CartFacadeReturns session cart guid if any.- Specified by:
getSessionCartGuidin interfaceCartFacade- Returns:
- the session cart guid
-
getMiniCart
Description copied from interface:CartFacadeMethod gets smaller version of cart, with data necessary for showing mini cart.- Specified by:
getMiniCartin interfaceCartFacade- Returns:
- the mini card data
-
createEmptyCart
-
hasSessionCart
public boolean hasSessionCart()Description copied from interface:CartFacadeCheck if session has a cart.- Specified by:
hasSessionCartin interfaceCartFacade- Returns:
- true if the session has a cart
-
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- Returns:
- true if the cart has any entries.
-
addToCart
public CartModificationData addToCart(String code, long quantity) throws CommerceCartModificationException Description copied from interface:CartFacadeMethod for adding a product to cart.- Specified by:
addToCartin interfaceCartFacade- 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(String code, long quantity, String storeId) throws CommerceCartModificationException Description copied from interface:CartFacadeMethod for adding a product to cart.- Specified by:
addToCartin interfaceCartFacade- Parameters:
code- code of product to addquantity- the quantity of the productstoreId- The identifier for the store. If null 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
-
addToCart
public CartModificationData addToCart(AddToCartParams addToCartParams) throws CommerceCartModificationException Description copied from interface:CartFacadeMethod for adding a product to cart.- Specified by:
addToCartin interfaceCartFacade- Parameters:
addToCartParams- addToCartParams- 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
-
validateCartData
Description copied from interface:CartFacadeMethod for validating every entry in the cart- Specified by:
validateCartDatain interfaceCartFacade- 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- 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
-
updateCartEntry
public CartModificationData updateCartEntry(long entryNumber, String storeId) throws CommerceCartModificationException Description copied from interface:CartFacadeMethod for updating the number of products.- Specified by:
updateCartEntryin interfaceCartFacade- 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
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- Parameters:
guid- 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
-
restoreAnonymousCartAndTakeOwnership
public CartRestorationData restoreAnonymousCartAndTakeOwnership(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- 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
-
restoreAnonymousCartAndMerge
public CartRestorationData restoreAnonymousCartAndMerge(String fromAnonymousCartGuid, String toUserCartGuid) throws CommerceCartRestorationException, CommerceCartMergingException 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- Parameters:
fromAnonymousCartGuid- - Anonymous user's cart from merging is donetoUserCartGuid- - User's cart to merge to- Returns:
CartRestorationDataobject holding information about the restoration- Throws:
CommerceCartRestorationExceptionCommerceCartMergingException
-
restoreCartAndMerge
public CartRestorationData restoreCartAndMerge(String fromUserCartGuid, 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- Parameters:
fromUserCartGuid- - User's cart from merging is donetoUserCartGuid- - User's cart to merge to- Returns:
CartRestorationDataobject holding information about the restoration- Throws:
CommerceCartRestorationExceptionCommerceCartMergingException
-
removeStaleCarts
public void removeStaleCarts()Description copied from interface:CartFacadeRemove the stale carts of the current user.- Specified by:
removeStaleCartsin interfaceCartFacade
-
estimateExternalTaxes
Description copied from interface:CartFacadeEstimate taxes on the cart.- Specified by:
estimateExternalTaxesin interfaceCartFacade- 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
-
getSessionCartWithEntryOrdering
Description copied from interface:CartFacadeMethod gets cart sorted by recently added entries from session, if param is set to true- Specified by:
getSessionCartWithEntryOrderingin interfaceCartFacade- Parameters:
recentlyAddedFirst- boolean value to determine whether to return sorted cart data- Returns:
- the cart data sorted by recently added entries
-
getDeliveryCountries
Deprecated, for removal: This API element is subject to removal in a future version.since 1808. Please useCheckoutFacade.getCountries(CountryType)instead.Description copied from interface:CartFacadeGet the supported delivery countries. The list is sorted alphabetically.- Specified by:
getDeliveryCountriesin interfaceCartFacade- Returns:
- list of supported delivery countries.
-
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
-
getCartsForCurrentUser
Description copied from interface:CartFacadeReturns all carts for current site and user.- Specified by:
getCartsForCurrentUserin interfaceCartFacade- Returns:
- list of carts
-
getMostRecentCartGuidForUser
Description copied from interface:CartFacadeReturns most recent cart guid for current site and user excluding the list of carts guid passed.- Specified by:
getMostRecentCartGuidForUserin interfaceCartFacade- Parameters:
excludedCartGuid- the excluded carts guid- Returns:
- the cart guid
-
updateCartMetadata
Description copied from interface:CartFacadeUpdates cart metadata, such as: name, description, expiration time.- Specified by:
updateCartMetadatain interfaceCartFacade- Parameters:
metadata- a bean holding parameters a client may want to pass to the method, attributes can be added to the bean via beans.xml in your extensions
-
updateCartEntry
public CartModificationData updateCartEntry(OrderEntryData orderEntry) throws CommerceCartModificationException Description copied from interface:CartFacadeUpdates the given cart entry.- Specified by:
updateCartEntryin interfaceCartFacade- Parameters:
orderEntry- the order entry data object identifying the order entry to update and holding the updated attributes.- Returns:
- the cart modification data that includes a statusCode and the actual quantity that the entry was updated
- Throws:
CommerceCartModificationException
-
removeEntryGroup
public CartModificationData removeEntryGroup(@Nonnull Integer groupNumber) throws CommerceCartModificationException Description copied from interface:CartFacadeRemoves group with all subsequent entries.- Specified by:
removeEntryGroupin interfaceCartFacade- Parameters:
groupNumber- group number- Returns:
- cart modification data with status code: "invalidGroupNumber" - group not found, "notPermitted" - group can not be removed, null - OK
- Throws:
CommerceCartModificationException
-
mergeOrderEntryWithModelConfiguration
-
filterConfigurationsByConfigurator
protected List<ConfigurationInfoData> filterConfigurationsByConfigurator(List<ConfigurationInfoData> configurations, ConfiguratorType configuratorEnum) -
configureCartEntry
protected CartModificationData configureCartEntry(OrderEntryData orderEntry, CartModificationData cartModificationData) throws CommerceCartModificationException -
deleteGroupedOrderEntriesMultiD
protected CartModificationData deleteGroupedOrderEntriesMultiD(OrderEntryData orderEntry) throws CommerceCartModificationException -
getOrderEntryNumberForMultiD
-
configurationInfoToProductConfiguration
protected ProductConfigurationItem configurationInfoToProductConfiguration(ConfigurationInfoData configurationInfoData) -
createCommerceCartParameter
protected CommerceCartParameter createCommerceCartParameter(OrderEntryData orderEntry, List<ProductConfigurationItem> productConfigurationItemList) -
hasEntryGroups
protected boolean hasEntryGroups() -
getCartService
-
setCartService
-
getMiniCartConverter
-
setMiniCartConverter
-
getProductService
-
setProductService
-
getCommerceCartService
-
setCommerceCartService
-
getCartConverter
-
setCartConverter
-
getCartModificationConverter
-
setCartModificationConverter
public void setCartModificationConverter(Converter<CommerceCartModification, CartModificationData> cartModificationConverter) -
getCartRestorationConverter
-
setCartRestorationConverter
public void setCartRestorationConverter(Converter<CommerceCartRestoration, CartRestorationData> cartRestorationConverter) -
getBaseSiteService
-
setBaseSiteService
-
getUserService
-
setUserService
-
getProductFacade
-
setProductFacade
-
getPointOfServiceService
-
setPointOfServiceService
-
getPriceDataFactory
-
setPriceDataFactory
-
getDeliveryService
-
setDeliveryService
-
getCountryConverter
-
setCountryConverter
-
getGroupCartModificationListConverter
public Converter<AbstractOrderModel,List<CartModificationData>> getGroupCartModificationListConverter() -
getOrderEntryConverter
-
setOrderEntryConverter
public void setOrderEntryConverter(Converter<AbstractOrderEntryModel, OrderEntryData> orderEntryConverter) -
setGroupCartModificationListConverter
public void setGroupCartModificationListConverter(Converter<AbstractOrderModel, List<CartModificationData>> groupCartModificationListConverter) -
getProductConfigurationMergeStrategies
protected Map<ConfiguratorType,ProductConfigurationMergeStrategy> getProductConfigurationMergeStrategies() -
setProductConfigurationMergeStrategies
public void setProductConfigurationMergeStrategies(Map<ConfiguratorType, ProductConfigurationMergeStrategy> productConfigurationMergeStrategies) -
getModelService
-
setModelService
-
getCommerceCartParameterConverter
-
setCommerceCartParameterConverter
public void setCommerceCartParameterConverter(Converter<AddToCartParams, CommerceCartParameter> commerceCartParameterConverter)
-