public class DefaultCartFacade extends java.lang.Object implements CartFacade
CartFacade. Delivers main functionality for cart.| Constructor and Description |
|---|
DefaultCartFacade() |
| Modifier and Type | Method and Description |
|---|---|
CartModificationData |
addToCart(AddToCartParams addToCartParams)
Method for adding a product to cart.
|
CartModificationData |
addToCart(java.lang.String code,
long quantity)
Method for adding a product to cart.
|
CartModificationData |
addToCart(java.lang.String code,
long quantity,
java.lang.String storeId)
Method for adding a product to cart.
|
protected ProductConfigurationItem |
configurationInfoToProductConfiguration(ConfigurationInfoData configurationInfoData) |
protected CartModificationData |
configureCartEntry(OrderEntryData orderEntry,
CartModificationData cartModificationData) |
protected CommerceCartParameter |
createCommerceCartParameter(OrderEntryData orderEntry,
java.util.List<ProductConfigurationItem> productConfigurationItemList) |
protected CartData |
createEmptyCart() |
protected CartModificationData |
deleteGroupedOrderEntriesMultiD(OrderEntryData orderEntry) |
CartData |
estimateExternalTaxes(java.lang.String deliveryZipCode,
java.lang.String countryIsoCode)
Estimate taxes on the cart.
|
protected java.util.List<ConfigurationInfoData> |
filterConfigurationsByConfigurator(java.util.List<ConfigurationInfoData> configurations,
ConfiguratorType configuratorEnum) |
protected BaseSiteService |
getBaseSiteService() |
protected Converter<CartModel,CartData> |
getCartConverter() |
protected Converter<CommerceCartModification,CartModificationData> |
getCartModificationConverter() |
protected Converter<CommerceCartRestoration,CartRestorationData> |
getCartRestorationConverter() |
protected CartService |
getCartService() |
java.util.List<CartData> |
getCartsForCurrentUser()
Returns all carts for current site and user.
|
protected Converter<AddToCartParams,CommerceCartParameter> |
getCommerceCartParameterConverter() |
protected CommerceCartService |
getCommerceCartService() |
Converter<CountryModel,CountryData> |
getCountryConverter() |
java.util.List<CountryData> |
getDeliveryCountries()
Deprecated.
since 1808. Please use
CheckoutFacade.getCountries(CountryType) instead. |
DeliveryService |
getDeliveryService() |
Converter<AbstractOrderModel,java.util.List<CartModificationData>> |
getGroupCartModificationListConverter() |
CartData |
getMiniCart()
Method gets smaller version of cart, with data necessary for showing mini cart.
|
protected Converter<CartModel,CartData> |
getMiniCartConverter() |
protected ModelService |
getModelService() |
java.lang.String |
getMostRecentCartGuidForUser(java.util.Collection<java.lang.String> excludedCartGuid)
Returns most recent cart guid for current site and user excluding the list of carts guid passed.
|
protected Converter<AbstractOrderEntryModel,OrderEntryData> |
getOrderEntryConverter() |
protected java.lang.Integer |
getOrderEntryNumberForMultiD(OrderEntryData findEntry) |
protected PointOfServiceService |
getPointOfServiceService() |
PriceDataFactory |
getPriceDataFactory() |
protected java.util.Map<ConfiguratorType,ProductConfigurationMergeStrategy> |
getProductConfigurationMergeStrategies() |
protected ProductFacade |
getProductFacade() |
protected ProductService |
getProductService() |
CartData |
getSessionCart()
Method gets cart from session, if any exist.
|
java.lang.String |
getSessionCartGuid()
Returns session cart guid if any.
|
CartData |
getSessionCartWithEntryOrdering(boolean recentlyAddedFirst)
Method gets cart sorted by recently added entries from session, if param is set to true
|
protected UserService |
getUserService() |
boolean |
hasEntries()
Check if session cart has entries, avoiding full conversion of the cart to CartData.
|
protected boolean |
hasEntryGroups() |
boolean |
hasSessionCart()
Check if session has a cart.
|
protected void |
mergeOrderEntryWithModelConfiguration(OrderEntryData orderEntry) |
CartModificationData |
removeEntryGroup(java.lang.Integer groupNumber)
Removes group with all subsequent entries.
|
void |
removeSessionCart()
If existing the current session cart is being detached from this session and removed.
|
void |
removeStaleCarts()
Remove the stale carts of the current user.
|
CartRestorationData |
restoreAnonymousCartAndMerge(java.lang.String fromAnonymousCartGuid,
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.
|
CartRestorationData |
restoreAnonymousCartAndTakeOwnership(java.lang.String guid)
Restores the anonymous user's cart to the session and sets its user to current user.
|
CartRestorationData |
restoreCartAndMerge(java.lang.String fromUserCartGuid,
java.lang.String toUserCartGuid)
Merges user's carts, restores merged cart to the session, sets its user to current user.
|
CartRestorationData |
restoreSavedCart(java.lang.String guid)
Restores the user's saved cart to the session.
|
void |
setBaseSiteService(BaseSiteService baseSiteService) |
void |
setCartConverter(Converter<CartModel,CartData> cartConverter) |
void |
setCartModificationConverter(Converter<CommerceCartModification,CartModificationData> cartModificationConverter) |
void |
setCartRestorationConverter(Converter<CommerceCartRestoration,CartRestorationData> cartRestorationConverter) |
void |
setCartService(CartService cartService) |
void |
setCommerceCartParameterConverter(Converter<AddToCartParams,CommerceCartParameter> commerceCartParameterConverter) |
void |
setCommerceCartService(CommerceCartService commerceCartService) |
void |
setCountryConverter(Converter<CountryModel,CountryData> countryConverter) |
void |
setDeliveryService(DeliveryService deliveryService) |
void |
setGroupCartModificationListConverter(Converter<AbstractOrderModel,java.util.List<CartModificationData>> groupCartModificationListConverter) |
void |
setMiniCartConverter(Converter<CartModel,CartData> miniCartConverter) |
void |
setModelService(ModelService modelService) |
void |
setOrderEntryConverter(Converter<AbstractOrderEntryModel,OrderEntryData> orderEntryConverter) |
void |
setPointOfServiceService(PointOfServiceService pointOfServiceService) |
void |
setPriceDataFactory(PriceDataFactory priceDataFactory) |
void |
setProductConfigurationMergeStrategies(java.util.Map<ConfiguratorType,ProductConfigurationMergeStrategy> productConfigurationMergeStrategies) |
void |
setProductFacade(ProductFacade productFacade) |
void |
setProductService(ProductService productService) |
void |
setUserService(UserService userService) |
CartModificationData |
updateCartEntry(long entryNumber,
long quantity)
Method for updating the number of products.
|
CartModificationData |
updateCartEntry(long entryNumber,
java.lang.String storeId)
Method for updating the number of products.
|
CartModificationData |
updateCartEntry(OrderEntryData orderEntry)
Updates the given cart entry.
|
void |
updateCartMetadata(CommerceCartMetadata metadata)
Updates cart metadata, such as: name, description, expiration time.
|
java.util.List<CartModificationData> |
validateCartData()
Method for validating every entry in the cart
|
public CartData getSessionCart()
CartFacadegetSessionCart in interface CartFacadepublic java.lang.String getSessionCartGuid()
CartFacadegetSessionCartGuid in interface CartFacadepublic CartData getMiniCart()
CartFacadegetMiniCart in interface CartFacadeprotected CartData createEmptyCart()
public boolean hasSessionCart()
CartFacadehasSessionCart in interface CartFacadepublic boolean hasEntries()
CartFacadehasEntries in interface CartFacadepublic CartModificationData addToCart(java.lang.String code, long quantity) throws CommerceCartModificationException
CartFacadeaddToCart in interface CartFacadecode - code of product to addquantity - the quantity of the productCommerceCartModificationException - if the cart cannot be modifiedpublic CartModificationData addToCart(java.lang.String code, long quantity, java.lang.String storeId) throws CommerceCartModificationException
CartFacadeaddToCart in interface CartFacadecode - code of product to addquantity - the quantity of the productstoreId - The identifier for the store. If null CartFacade.addToCart(String, long) is used.CommerceCartModificationException - if the cart cannot be modifiedpublic CartModificationData addToCart(AddToCartParams addToCartParams) throws CommerceCartModificationException
CartFacadeaddToCart in interface CartFacadeaddToCartParams - addToCartParamsCommerceCartModificationException - if the cart cannot be modifiedpublic java.util.List<CartModificationData> validateCartData() throws CommerceCartModificationException
CartFacadevalidateCartData in interface CartFacadeCommerceCartModificationException - if the cart cannot be modifiedpublic CartModificationData updateCartEntry(long entryNumber, long quantity) throws CommerceCartModificationException
CartFacadeupdateCartEntry in interface CartFacadeentryNumber - the entry numberquantity - new value of quantity for productCommerceCartModificationException - if the cart cannot be modifiedpublic CartModificationData updateCartEntry(long entryNumber, java.lang.String storeId) throws CommerceCartModificationException
CartFacadeupdateCartEntry in interface CartFacadeentryNumber - The entry numberstoreId - The identifier for the store. Can be null.CommerceCartModificationException - if the cart cannot be modifiedpublic CartRestorationData restoreSavedCart(java.lang.String guid) throws CommerceCartRestorationException
CartFacaderestoreSavedCart in interface CartFacadeguid - the cart guid to restore for Anonymous user.CommerceCartRestorationExceptionpublic CartRestorationData restoreAnonymousCartAndTakeOwnership(java.lang.String guid) throws CommerceCartRestorationException
CartFacaderestoreAnonymousCartAndTakeOwnership in interface CartFacadeguid - GUID used to find anonymous user's cartCommerceCartRestorationExceptionpublic CartRestorationData restoreAnonymousCartAndMerge(java.lang.String fromAnonymousCartGuid, java.lang.String toUserCartGuid) throws CommerceCartRestorationException, CommerceCartMergingException
CartFacaderestoreAnonymousCartAndMerge in interface CartFacadefromAnonymousCartGuid - - Anonymous user's cart from merging is donetoUserCartGuid - - User's cart to merge toCartRestorationData object holding information about the restorationCommerceCartRestorationExceptionCommerceCartMergingExceptionpublic CartRestorationData restoreCartAndMerge(java.lang.String fromUserCartGuid, java.lang.String toUserCartGuid) throws CommerceCartRestorationException, CommerceCartMergingException
CartFacaderestoreCartAndMerge in interface CartFacadefromUserCartGuid - - User's cart from merging is donetoUserCartGuid - - User's cart to merge toCartRestorationData object holding information about the restorationCommerceCartRestorationExceptionCommerceCartMergingExceptionpublic void removeStaleCarts()
CartFacaderemoveStaleCarts in interface CartFacadepublic CartData estimateExternalTaxes(java.lang.String deliveryZipCode, java.lang.String countryIsoCode)
CartFacadeestimateExternalTaxes in interface CartFacadedeliveryZipCode - delivery zip code used for calculating external taxescountryIsoCode - delivery country used for calculating taxespublic CartData getSessionCartWithEntryOrdering(boolean recentlyAddedFirst)
CartFacadegetSessionCartWithEntryOrdering in interface CartFacaderecentlyAddedFirst - boolean value to determine whether to return sorted cart data@Deprecated public java.util.List<CountryData> getDeliveryCountries()
CheckoutFacade.getCountries(CountryType) instead.CartFacadegetDeliveryCountries in interface CartFacadepublic void removeSessionCart()
CartFacaderemoveSessionCart in interface CartFacadepublic java.util.List<CartData> getCartsForCurrentUser()
CartFacadegetCartsForCurrentUser in interface CartFacadepublic java.lang.String getMostRecentCartGuidForUser(java.util.Collection<java.lang.String> excludedCartGuid)
CartFacadegetMostRecentCartGuidForUser in interface CartFacadeexcludedCartGuid - the excluded carts guidpublic void updateCartMetadata(CommerceCartMetadata metadata)
CartFacadeupdateCartMetadata in interface CartFacademetadata - 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 extensionspublic CartModificationData updateCartEntry(OrderEntryData orderEntry) throws CommerceCartModificationException
CartFacadeupdateCartEntry in interface CartFacadeorderEntry - the order entry data object identifying the order entry to update and holding the updated attributes.CommerceCartModificationExceptionpublic CartModificationData removeEntryGroup(java.lang.Integer groupNumber) throws CommerceCartModificationException
CartFacaderemoveEntryGroup in interface CartFacadegroupNumber - group numberCommerceCartModificationExceptionprotected void mergeOrderEntryWithModelConfiguration(OrderEntryData orderEntry)
protected java.util.List<ConfigurationInfoData> filterConfigurationsByConfigurator(java.util.List<ConfigurationInfoData> configurations, ConfiguratorType configuratorEnum)
protected CartModificationData configureCartEntry(OrderEntryData orderEntry, CartModificationData cartModificationData) throws CommerceCartModificationException
protected CartModificationData deleteGroupedOrderEntriesMultiD(OrderEntryData orderEntry) throws CommerceCartModificationException
protected java.lang.Integer getOrderEntryNumberForMultiD(OrderEntryData findEntry)
protected ProductConfigurationItem configurationInfoToProductConfiguration(ConfigurationInfoData configurationInfoData)
protected CommerceCartParameter createCommerceCartParameter(OrderEntryData orderEntry, java.util.List<ProductConfigurationItem> productConfigurationItemList)
protected boolean hasEntryGroups()
protected CartService getCartService()
public void setCartService(CartService cartService)
public void setMiniCartConverter(Converter<CartModel,CartData> miniCartConverter)
protected ProductService getProductService()
public void setProductService(ProductService productService)
protected CommerceCartService getCommerceCartService()
public void setCommerceCartService(CommerceCartService commerceCartService)
protected Converter<CommerceCartModification,CartModificationData> getCartModificationConverter()
public void setCartModificationConverter(Converter<CommerceCartModification,CartModificationData> cartModificationConverter)
protected Converter<CommerceCartRestoration,CartRestorationData> getCartRestorationConverter()
public void setCartRestorationConverter(Converter<CommerceCartRestoration,CartRestorationData> cartRestorationConverter)
protected BaseSiteService getBaseSiteService()
public void setBaseSiteService(BaseSiteService baseSiteService)
protected UserService getUserService()
public void setUserService(UserService userService)
protected ProductFacade getProductFacade()
public void setProductFacade(ProductFacade productFacade)
protected PointOfServiceService getPointOfServiceService()
public void setPointOfServiceService(PointOfServiceService pointOfServiceService)
public PriceDataFactory getPriceDataFactory()
public void setPriceDataFactory(PriceDataFactory priceDataFactory)
public DeliveryService getDeliveryService()
public void setDeliveryService(DeliveryService deliveryService)
public Converter<CountryModel,CountryData> getCountryConverter()
public void setCountryConverter(Converter<CountryModel,CountryData> countryConverter)
public Converter<AbstractOrderModel,java.util.List<CartModificationData>> getGroupCartModificationListConverter()
protected Converter<AbstractOrderEntryModel,OrderEntryData> getOrderEntryConverter()
public void setOrderEntryConverter(Converter<AbstractOrderEntryModel,OrderEntryData> orderEntryConverter)
public void setGroupCartModificationListConverter(Converter<AbstractOrderModel,java.util.List<CartModificationData>> groupCartModificationListConverter)
protected java.util.Map<ConfiguratorType,ProductConfigurationMergeStrategy> getProductConfigurationMergeStrategies()
public void setProductConfigurationMergeStrategies(java.util.Map<ConfiguratorType,ProductConfigurationMergeStrategy> productConfigurationMergeStrategies)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected Converter<AddToCartParams,CommerceCartParameter> getCommerceCartParameterConverter()
public void setCommerceCartParameterConverter(Converter<AddToCartParams,CommerceCartParameter> commerceCartParameterConverter)
Copyright © 2018 SAP SE. All Rights Reserved.