Class DefaultTravelRouteTransportOfferingsValidationStrategy
java.lang.Object
de.hybris.platform.travelfacades.strategies.impl.DefaultTravelRouteTransportOfferingsValidationStrategy
- All Implemented Interfaces:
AddTransportBundleToCartValidationStrategy
public class DefaultTravelRouteTransportOfferingsValidationStrategy
extends Object
implements AddTransportBundleToCartValidationStrategy
Strategy to validate the travelRoute and the transportOfferingCodes of the addBundleToCartData.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TransportOfferingServiceGets transport offering service.protected TravelRouteServiceGets travel route service.voidsetTransportOfferingService(TransportOfferingService transportOfferingService) Sets transport offering service.voidsetTravelRouteService(TravelRouteService travelRouteService) Sets travel route service.voidvalidate(AddBundleToCartData addBundleToCartData) Validates if 1) the travelRoute corresponds to an existing TravelRoute in the system.protected voidvalidateTransportOfferingCodes(AddBundleToCartData addBundleToCartData, TravelRouteModel travelRoute) Validates the list of transport offering codes.protected voidvalidateTransportOfferingCodesAgainstTheDate(List<TransportOfferingModel> transportOfferings) Validates the list of transport offering codes against the date.protected voidvalidateTransportOfferingsAgainstTheRoute(List<TransportOfferingModel> transportOfferings, List<TravelSectorModel> travelSectors) Validates the list of transport offerings against the route.
-
Constructor Details
-
DefaultTravelRouteTransportOfferingsValidationStrategy
public DefaultTravelRouteTransportOfferingsValidationStrategy()
-
-
Method Details
-
validate
public void validate(AddBundleToCartData addBundleToCartData) throws AddTransportBundleToCartException Validates if 1) the travelRoute corresponds to an existing TravelRoute in the system. 2) all the transport offering codes in the list exists in the system. 3) all the transport offerings are in the future 3) the origins and the destinations of the transport offerings (sorted by departure date) compose the same route.- Specified by:
validatein interfaceAddTransportBundleToCartValidationStrategy- Parameters:
addBundleToCartData- the addBundleToCartData to be validated- Throws:
AddTransportBundleToCartException
-
validateTransportOfferingCodes
protected void validateTransportOfferingCodes(AddBundleToCartData addBundleToCartData, TravelRouteModel travelRoute) throws AddTransportBundleToCartException Validates the list of transport offering codes. Checks if 1) all the transport offerings exists in the system; 2) all the transport offerings are in the future; 3) all the transport offerings (sorted by departure date) build the same route provided in the addBundleToCartData.- Parameters:
addBundleToCartData- the add bundle to cart datatravelRoute- the travel route- Throws:
AddTransportBundleToCartException- the add transport bundle to cart exception
-
validateTransportOfferingsAgainstTheRoute
protected void validateTransportOfferingsAgainstTheRoute(List<TransportOfferingModel> transportOfferings, List<TravelSectorModel> travelSectors) throws AddTransportBundleToCartException Validates the list of transport offerings against the route. Checks if the transport offerings (sorted by departure date) correspond to the same travel route retrieved from the system.- Parameters:
transportOfferings- the list of transport offeringstravelSectors- the travel sectors which build the travel route- Throws:
AddTransportBundleToCartException- the add transport bundle to cart exception
-
validateTransportOfferingCodesAgainstTheDate
protected void validateTransportOfferingCodesAgainstTheDate(List<TransportOfferingModel> transportOfferings) throws AddTransportBundleToCartException Validates the list of transport offering codes against the date. Checks if all the transport offerings have departure date in the future.- Parameters:
transportOfferings- the list of transport offerings- Throws:
AddTransportBundleToCartException- the add transport bundle to cart exception
-
getTravelRouteService
Gets travel route service.- Returns:
- the travel route service
-
setTravelRouteService
Sets travel route service.- Parameters:
travelRouteService- the travel route service
-
getTransportOfferingService
Gets transport offering service.- Returns:
- the transport offering service
-
setTransportOfferingService
Sets transport offering service.- Parameters:
transportOfferingService- the transport offering service
-