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 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:
      validate in interface AddTransportBundleToCartValidationStrategy
      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 data
      travelRoute - 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 offerings
      travelSectors - 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

      protected TravelRouteService getTravelRouteService()
      Gets travel route service.
      Returns:
      the travel route service
    • setTravelRouteService

      public void setTravelRouteService(TravelRouteService travelRouteService)
      Sets travel route service.
      Parameters:
      travelRouteService - the travel route service
    • getTransportOfferingService

      protected TransportOfferingService getTransportOfferingService()
      Gets transport offering service.
      Returns:
      the transport offering service
    • setTransportOfferingService

      public void setTransportOfferingService(TransportOfferingService transportOfferingService)
      Sets transport offering service.
      Parameters:
      transportOfferingService - the transport offering service