Class DefaultCartService
java.lang.Object
de.hybris.platform.sap.sapordermgmtservices.cart.impl.DefaultCartCheckoutBaseService
de.hybris.platform.sap.sapordermgmtservices.cart.impl.DefaultCartService
- All Implemented Interfaces:
CartCheckoutBaseService,CartService
- Direct Known Subclasses:
CPQDefaultCartService
Basic cart functions for SAP synchronous order management. In this case, the cart will be created in the back end
session, it does not touch the hybris persistence.
The class synchronizes accesses to the BOL object representing the cart, as this is not thread safe. Multi-threaded accesses can happen although we use request sequencing, since also filters might call cart facades.
The class synchronizes accesses to the BOL object representing the cart, as this is not thread safe. Multi-threaded accesses can happen although we use request sequencing, since also filters might call cart facades.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddEntriesToCart(List<OrderEntryData> orderEntries) Adds quick order entries to the cart.voidaddItemsToCart(List<Item> items) Adds an item to the cart.Adds an entry to the cart.protected voidcheckForDeletion(BigDecimal quantity, Item itemToUpdate) Checks if cart item is meant to be deleted, which is indicated by a quantity zero.protected BigDecimalconvertQuantity(long quantity) Converts a quantity into a BigDecimal so that BOL can consume it.protected intconvertToPositiveInt(long entryNumber) createItemsFromOrderEntries(List<OrderEntryData> cartEntries) de.hybris.platform.servicelayer.dto.converter.Converter<Item,OrderEntryData> de.hybris.platform.servicelayer.dto.converter.Converter<Message,CartModificationData> de.hybris.platform.servicelayer.session.SessionServicebooleanisItemAvailable(String itemKey) Does an item exist with a given key?voidsetCartItemConverter(de.hybris.platform.servicelayer.dto.converter.Converter<Item, OrderEntryData> cartItemConverter) voidsetItemFactory(ItemFactory itemFactory) voidsetMessageConverter(de.hybris.platform.servicelayer.dto.converter.Converter<Message, CartModificationData> messageConverter) voidsetSalesAreaService(SalesAreaService salesAreaService) voidsetSessionService(de.hybris.platform.servicelayer.session.SessionService sessionService) Sets standard session service via spring injectionupdateCartEntry(long entryNumber, long quantityAsLong) Updates a cart entryValidates cartMethods inherited from class de.hybris.platform.sap.sapordermgmtservices.cart.impl.DefaultCartCheckoutBaseService
compileSessionCart, createEmptyCart, getBolCartFacade, getCartConverter, getI18nService, getMessageSource, getSessionCart, getSessionCart, hasSessionCart, removeSessionCart, reverseCartSorting, reverseCartSorting, setBolCartFacade, setCartConverter, setI18nService, setMessageSourceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.sap.sapordermgmtservices.cart.CartCheckoutBaseService
getSessionCart, getSessionCart, hasSessionCart, removeSessionCart
-
Constructor Details
-
DefaultCartService
public DefaultCartService()
-
-
Method Details
-
addToCart
Description copied from interface:CartServiceAdds an entry to the cart. The result contains error messages if those have occurred.- Specified by:
addToCartin interfaceCartService- Parameters:
code- Product IDquantity- Quantity to be added- Returns:
- Cart modification data
-
updateCartEntry
Description copied from interface:CartServiceUpdates a cart entry- Specified by:
updateCartEntryin interfaceCartService- Parameters:
entryNumber- Item numberquantityAsLong- New quantity of item- Returns:
- Cart modifications
-
convertToPositiveInt
protected int convertToPositiveInt(long entryNumber) - Parameters:
entryNumber-- Returns:
- Input converted into positive int
-
checkForDeletion
Checks if cart item is meant to be deleted, which is indicated by a quantity zero. In this case, the BOL item will be marked to be deleted- Parameters:
quantity- New item quantity, if zero: Item will be deleteditemToUpdate- BOL item to be updated
-
convertQuantity
Converts a quantity into a BigDecimal so that BOL can consume it.- Parameters:
quantity-- Returns:
- Quantity as result from the input, if input is positive. Zero otherwise
-
validateCartData
Description copied from interface:CartServiceValidates cart- Specified by:
validateCartDatain interfaceCartService- Returns:
- Modification status as result of the validation
-
getSessionService
public de.hybris.platform.servicelayer.session.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(de.hybris.platform.servicelayer.session.SessionService sessionService) Sets standard session service via spring injection- Parameters:
sessionService-
-
getCartItemConverter
public de.hybris.platform.servicelayer.dto.converter.Converter<Item,OrderEntryData> getCartItemConverter()- Returns:
- the cartItemConverter
-
setCartItemConverter
public void setCartItemConverter(de.hybris.platform.servicelayer.dto.converter.Converter<Item, OrderEntryData> cartItemConverter) - Parameters:
cartItemConverter- the cartItemConverter to set
-
getMessageConverter
public de.hybris.platform.servicelayer.dto.converter.Converter<Message,CartModificationData> getMessageConverter()- Returns:
- the messageConverter
-
setMessageConverter
public void setMessageConverter(de.hybris.platform.servicelayer.dto.converter.Converter<Message, CartModificationData> messageConverter) - Parameters:
messageConverter- the messageConverter to set
-
getSalesAreaService
- Returns:
- the salesAreaService
-
setSalesAreaService
- Parameters:
salesAreaService- the salesAreaService to set
-
isItemAvailable
Description copied from interface:CartServiceDoes an item exist with a given key?- Specified by:
isItemAvailablein interfaceCartService- Parameters:
itemKey- key for the item.- Returns:
- Does item exist for the item key?
-
addItemsToCart
Description copied from interface:CartServiceAdds an item to the cart.- Specified by:
addItemsToCartin interfaceCartService- Parameters:
items- list of items
-
addEntriesToCart
Description copied from interface:CartServiceAdds quick order entries to the cart.- Specified by:
addEntriesToCartin interfaceCartService- Parameters:
orderEntries- order entries list- Returns:
- list of CartModificationData objects
-
createItemsFromOrderEntries
-
getItemFactory
- Returns:
- the itemFactory
-
setItemFactory
- Parameters:
itemFactory- the itemFactory to set
-