Class DefaultRemoveTravellerFromCartValidationStrategy
java.lang.Object
de.hybris.platform.travelfacades.strategies.impl.DefaultRemoveTravellerFromCartValidationStrategy
- All Implemented Interfaces:
RemoveTravellerFromCartValidationStrategy
public class DefaultRemoveTravellerFromCartValidationStrategy
extends Object
implements RemoveTravellerFromCartValidationStrategy
Strategy to validate removal of traveller from normal cart.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected de.hybris.platform.order.CartServiceGets cart service.protected booleanisAdultExistAfterRemove(CartModel sessionCart, String travellerId) Is any adult traveller exist after removal of traveller.protected booleanisLinkedTraveller(CartModel sessionCart, String travellerId) Is traveller linked to any cart entry.voidsetCartService(de.hybris.platform.order.CartService cartService) Sets cart service.voidValidates if 1) the cart is empty 2) traveller is not linked with any cart entry 3) cart does not contain child only after removal of traveller.
-
Constructor Details
-
DefaultRemoveTravellerFromCartValidationStrategy
public DefaultRemoveTravellerFromCartValidationStrategy()
-
-
Method Details
-
validate
public void validate(String travellerId) throws InvalidSessionCartException, InvalidTravellerException Validates if 1) the cart is empty 2) traveller is not linked with any cart entry 3) cart does not contain child only after removal of traveller.- Specified by:
validatein interfaceRemoveTravellerFromCartValidationStrategy- Parameters:
travellerId- the id of traveller- Throws:
InvalidSessionCartException- if session cart does not existInvalidTravellerException- if traveller linked to cart entry or its last adult in cart
-
isLinkedTraveller
Is traveller linked to any cart entry.- Parameters:
sessionCart- the session carttravellerId- the id of traveller- Returns:
truewhen traveller is linked to any cart entry
-
isAdultExistAfterRemove
Is any adult traveller exist after removal of traveller.- Parameters:
sessionCart- the session carttravellerId- the id of traveller- Returns:
trueif any adult traveller exist after removal of traveller
-
getCartService
protected de.hybris.platform.order.CartService getCartService()Gets cart service.- Returns:
- the cart service
-
setCartService
public void setCartService(de.hybris.platform.order.CartService cartService) Sets cart service.- Parameters:
cartService- the cart service
-