Class DefaultTransportOfferingFacade

java.lang.Object
de.hybris.platform.travelfacades.facades.impl.DefaultTransportOfferingFacade
All Implemented Interfaces:
TransportOfferingFacade
Direct Known Subclasses:
DefaultShoppingTransportOfferingFacade

public class DefaultTransportOfferingFacade extends Object implements TransportOfferingFacade
Default implementation of the TransportOfferingFacade interface.
  • Constructor Details

    • DefaultTransportOfferingFacade

      public DefaultTransportOfferingFacade()
  • Method Details

    • getTransportOfferings

      public List<TransportOfferingData> getTransportOfferings(String number, Date departureDate, List<TransportOfferingOption> options)
      Description copied from interface: TransportOfferingFacade
      Get a list of TransportOfferingData by number and departureDate.
      Specified by:
      getTransportOfferings in interface TransportOfferingFacade
      Parameters:
      number - the number of requested transport offering
      departureDate - the departure date of requested transport offering
      options - the options for populating the TransportOfferingData
      Returns:
      List transport offerings
    • getTransportOfferings

      public List<TransportOfferingData> getTransportOfferings(List<TransportOfferingOption> options, List<TransportOfferingModel> transportOfferingModelList)
      Description copied from interface: TransportOfferingFacade
      Get a list of TransportOfferingData for TransportOfferingModels.
      Specified by:
      getTransportOfferings in interface TransportOfferingFacade
      Parameters:
      options - the options for populating the TransportOfferingData
      transportOfferingModelList - list of TransportOfferingModels
      Returns:
      List transport offerings
    • getScheduledRoutes

      public List<ScheduledRouteData> getScheduledRoutes(FareSearchRequestData fareSearchRequestData)
      Description copied from interface: TransportOfferingFacade
      Method uses the arrivalLocation and departureLocation form OriginDestinationInfoData on FareSearchRequestData** to get a list of TravelRouteModel from the Database. Each TravelRouteModel is then converted to a list of TravelRouteData by the TravelRoutePopulator. The method then queries Solr for a list of TransportOfferingData for each TravelSectorData within each TravelRouteData and then runs an algorithm to match TransportOfferingData for each TravelSectorData before building the ScheduledRouteData** consisting of valid TransportOfferingData combinations per TravelRouteModel
      Specified by:
      getScheduledRoutes in interface TransportOfferingFacade
      Parameters:
      fareSearchRequestData - the request made by the user
      Returns:
      List scheduled routes
    • buildTransportOfferingConnections

      protected Queue<List<TransportOfferingData>> buildTransportOfferingConnections(OriginDestinationInfoData originDestinationInfo, List<TravelSectorData> travelSectors, FareSearchRequestData fareSearchRequestData)
    • checkForOverNightTransportOfferingConnections

      protected boolean checkForOverNightTransportOfferingConnections(Queue<List<TransportOfferingData>> transportOfferingConnections)
      Method to check if the a TransportOffering has an overnight connection. The method will check if in the current Queue of transport offering connections there at least one TransportOfferingData with arrival time + arrival date threshold falling in the day after.
      Parameters:
      transportOfferingConnections - current queue of Transport Offering connections
      Returns:
      a boolean flag, true if check for flight overnight connections is true, false otherwise
    • getTravelRoutes

      protected List<TravelRouteData> getTravelRoutes(OriginDestinationInfoData originDestinationInfo)
      Method returns List of TravelRouteData that contains the origin destination sent in the request.
      Parameters:
      originDestinationInfo -
      Returns:
      List of TravelRouteData
    • getLocationCodesResolvingStrategy

      protected LocationCodesResolvingStrategy getLocationCodesResolvingStrategy(LocationType locationType)
      Method returning a LocationCodesResolvingStrategy according to the LocatiionType passed as an argument
      Parameters:
      locationType -
      Returns:
    • getNewPriorityQueue

      protected Queue<List<TransportOfferingData>> getNewPriorityQueue()
      Method returns a new PriorityQueue<List> object with a comparator
      Returns:
      Queue<List < TransportOfferingData>>
    • buildTransportOfferingConnections

      protected Queue<List<TransportOfferingData>> buildTransportOfferingConnections(Queue<List<TransportOfferingData>> routeCombinations, List<TransportOfferingData> transportOfferings)
      Method handles the preparation of routes in case of multi-sector i.e. connected transport offerings. The transport offering on the last sector is compared with the date-time of the transport offering in the next sector, to prepare feasible routes containing transport offering options. If the date-time of connected transport offerings are within the configured limits, then such transport offerings are added as available combinations.
      Parameters:
      routeCombinations - the queue containing a list of TransportOfferingData
      transportOfferings - list of TransportOfferingData
      Returns:
    • buildInitialTransportOfferings

      protected void buildInitialTransportOfferings(Queue<List<TransportOfferingData>> routeCombinations, List<TransportOfferingData> transportOfferings)
      Method creates individual lists for each TransportOfferingData and before adding the list to the Queue.
      Parameters:
      routeCombinations - the queue containing a list of TransportOfferingData that will contain the list of TransportOfferingData
      transportOfferings - list of TransportOfferingData which will then be converted to individual list items containing a single TransportOfferingData element
    • isTransportOfferingConnectionFeasible

      protected boolean isTransportOfferingConnectionFeasible(Date arrivalDate, Date departureDate)
      Method takes arrivalDate and departureDate Date objects and run the following check:

      departureDate is AFTER (arrivalDate + x hours) && departureDate is BEFORE (arrivalDate + x hours)

      Parameters:
      arrivalDate - the Transport Offering arrival date which will have a threshold applied
      departureDate - the Transport Offering departure date which will not have a threshold applied
      Returns:
    • buildScheduledRoutes

      protected void buildScheduledRoutes(Queue<List<TransportOfferingData>> transportOfferingConnections, TravelRouteData travelRoute, List<ScheduledRouteData> scheduledRoutes, int referenceNumber)
      Method takes the queue which contains a list of TransportOfferingData and creates a ScheduledRouteData for each element before adding to the ScheduledRouteData list.
      Parameters:
      transportOfferingConnections - the queue containing a list of TransportOfferingData elements
      travelRoute - the TravelRouteData which is to be added to the ScheduledRouteData
      scheduledRoutes - the ScheduledRouteData list where each ScheduledRouteData object will be added too.
      referenceNumber - the referenceNumber for this route which will be added to the ScheduledRouteData object
    • isConnectionValid

      protected boolean isConnectionValid(List<TransportOfferingData> transportOfferings)
      Checks if the first flight in the connection is in future and if it is enough in future to be booked based on configurable attribute
      Parameters:
      transportOfferings -
      Returns:
      true if transport offerings can be booked
    • searchTransportOfferings

      protected List<TransportOfferingData> searchTransportOfferings(TravelSectorData travelSector, Date departureDate, FareSearchRequestData fareSearchRequestData)
      Method which makes a call to Solr and returns a list of TransportOfferingData based on the TravelSectorData Origin and Destination codes and OriginDestinationInfo departureDate.
      Parameters:
      travelSector - the TravelSectorData which will be used in the solr query
      departureDate - the Date which will be used in the solr query
      Returns:
      List
    • createSearchData

      protected SearchData createSearchData(TravelSectorData travelSector, Date departureDate)
    • getTransportOffering

      public TransportOfferingData getTransportOffering(String code)
      Description copied from interface: TransportOfferingFacade
      Get a TransportOfferingData by code.
      Specified by:
      getTransportOffering in interface TransportOfferingFacade
      Parameters:
      code - the unique code for a transport offering
      Returns:
      TransportOfferingData transport offering
    • isMultiSectorRoute

      public boolean isMultiSectorRoute(List<String> transportOfferings)
      Description copied from interface: TransportOfferingFacade
      Method to check if the route is multi sector
      Specified by:
      isMultiSectorRoute in interface TransportOfferingFacade
      Parameters:
      transportOfferings - the transport offerings
      Returns:
      boolean boolean
    • getOriginSuggestions

      public Map<String,Map<String,String>> getOriginSuggestions(String text)
      Description copied from interface: TransportOfferingFacade
      Method to retrieve suggestions for the origin search text
      Specified by:
      getOriginSuggestions in interface TransportOfferingFacade
      Parameters:
      text - the text
      Returns:
      Map of suggestions results
    • getDestinationSuggestions

      public Map<String,Map<String,String>> getDestinationSuggestions(String originLocation, String text)
      Description copied from interface: TransportOfferingFacade
      Method to retrieve suggestions for the destination search text and origin code
      Specified by:
      getDestinationSuggestions in interface TransportOfferingFacade
      Parameters:
      originLocation - the origin location
      text - the text
      Returns:
      Map of suggestions results
    • populateSuggestionsSearchData

      protected SearchData populateSuggestionsSearchData(String searchType, String text, String originLocation)
      Method to populate the search criteria for solr suggestions search
      Parameters:
      text -
      Returns:
    • getOriginSuggestionData

      public Map<GlobalSuggestionData,List<GlobalSuggestionData>> getOriginSuggestionData(String text)
      Description copied from interface: TransportOfferingFacade
      Method to retrieve suggestions for the origin search text
      Specified by:
      getOriginSuggestionData in interface TransportOfferingFacade
      Parameters:
      text - the text
      Returns:
      Map of suggestions results using GlobalSuggestionData objects
    • getDestinationSuggestionData

      public Map<GlobalSuggestionData,List<GlobalSuggestionData>> getDestinationSuggestionData(String originLocation, String text)
      Description copied from interface: TransportOfferingFacade
      Method to retrieve suggestions for the destination search text and origin code
      Specified by:
      getDestinationSuggestionData in interface TransportOfferingFacade
      Parameters:
      originLocation - the origin location
      text - the text
      Returns:
      Map of suggestions results using GlobalSuggestionData objects
    • getOriginSuggestions

      public TravelLocationSuggestionData getOriginSuggestions(String searchText, String destination)
      Method to retrieve suggestions for the origins search text that cover the specific destination
      Specified by:
      getOriginSuggestions in interface TransportOfferingFacade
      Parameters:
      searchText - the origin suggestion
      destination - the destination to be covered from the origin
      Returns:
      the TravelLocationSuggestionData.
    • getDestinationLocationSuggestions

      public TravelLocationSuggestionData getDestinationLocationSuggestions(String searchText, String origin)
      Description copied from interface: TransportOfferingFacade
      Method to retrieve suggestions for the destinations search text that cover the specific origin
      Specified by:
      getDestinationLocationSuggestions in interface TransportOfferingFacade
      Parameters:
      searchText - the destination suggestion
      origin - the origin to be covered from the destination
      Returns:
      TravelLocationSuggestionData of Location suggestions
    • getTransportOffering

      public TransportOfferingData getTransportOffering(List<TransportOfferingOption> options, String transportOfferingCode) throws de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException
      Method to retrieve transport offering details for the transport offering options and transport offering code.
      Specified by:
      getTransportOffering in interface TransportOfferingFacade
      Parameters:
      options - the list of transport offering options
      transportOfferingCode - transport offering code
      Returns:
      TransportOfferingData transport offering data.
      Throws:
      de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException - the unknown identifier exception
    • populateSuggestionsSearchData

      protected SearchData populateSuggestionsSearchData(String searchType, String text, String originLocation, String destinationLocation)
      Method to populate the search criteria for solr suggestions search
      Parameters:
      searchType - the search type
      text - the search text
      originLocation - the origin location
      destinationLocation - the destination location
      Returns:
      search data
    • getTransportOfferingService

      protected TransportOfferingService getTransportOfferingService()
      Returns:
      the transportOfferingService
    • setTransportOfferingService

      public void setTransportOfferingService(TransportOfferingService transportOfferingService)
      Parameters:
      transportOfferingService - the transportOfferingService to set
    • getTravelRouteConverter

      protected de.hybris.platform.servicelayer.dto.converter.Converter<TravelRouteModel,TravelRouteData> getTravelRouteConverter()
      Returns:
      the travelRouteConverter
    • setTravelRouteConverter

      public void setTravelRouteConverter(de.hybris.platform.servicelayer.dto.converter.Converter<TravelRouteModel,TravelRouteData> travelRouteConverter)
      Parameters:
      travelRouteConverter - the travelRouteConverter to set
    • getTransportOfferingConverter

      protected de.hybris.platform.servicelayer.dto.converter.Converter<TransportOfferingModel,TransportOfferingData> getTransportOfferingConverter()
      Returns:
      the transportOfferingConverter
    • setTransportOfferingConverter

      public void setTransportOfferingConverter(de.hybris.platform.servicelayer.dto.converter.Converter<TransportOfferingModel,TransportOfferingData> transportOfferingConverter)
      Parameters:
      transportOfferingConverter - the transportOfferingConverter to set
    • getTransportOfferingConfiguredPopulator

      protected de.hybris.platform.converters.ConfigurablePopulator<TransportOfferingModel,TransportOfferingData,TransportOfferingOption> getTransportOfferingConfiguredPopulator()
      Returns:
      the transportOfferingConfiguredPopulator
    • setTransportOfferingConfiguredPopulator

      public void setTransportOfferingConfiguredPopulator(de.hybris.platform.converters.ConfigurablePopulator<TransportOfferingModel,TransportOfferingData,TransportOfferingOption> transportOfferingConfiguredPopulator)
      Parameters:
      transportOfferingConfiguredPopulator - the transportOfferingConfiguredPopulator to set
    • getTransportOfferingSearchFacade

      protected TransportOfferingSearchFacade<TransportOfferingData> getTransportOfferingSearchFacade()
      Returns:
      the transportOfferingSearchFacade
    • setTransportOfferingSearchFacade

      public void setTransportOfferingSearchFacade(TransportOfferingSearchFacade<TransportOfferingData> transportOfferingSearchFacade)
      Parameters:
      transportOfferingSearchFacade - the transportOfferingSearchFacade to set
    • getTravelRouteService

      protected TravelRouteService getTravelRouteService()
      Returns:
      the travelRouteService
    • setTravelRouteService

      public void setTravelRouteService(TravelRouteService travelRouteService)
      Parameters:
      travelRouteService - the travelRouteService to set
    • getSuggestionsDisplayStrategy

      protected SuggestionsDisplayStrategy getSuggestionsDisplayStrategy()
      Returns:
      the suggestionsDisplayStrategy
    • setSuggestionsDisplayStrategy

      public void setSuggestionsDisplayStrategy(SuggestionsDisplayStrategy suggestionsDisplayStrategy)
      Parameters:
      suggestionsDisplayStrategy - the suggestionsDisplayStrategy to set
    • getTimeService

      protected de.hybris.platform.servicelayer.time.TimeService getTimeService()
      Returns:
      the timeService
    • setTimeService

      public void setTimeService(de.hybris.platform.servicelayer.time.TimeService timeService)
      Parameters:
      timeService - the timeService to set
    • getConfigurationService

      protected de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService()
      Returns:
      the configurationService
    • setConfigurationService

      public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService)
      Parameters:
      configurationService - the configurationService to set
    • getTravelRulesService

      protected TravelRulesService getTravelRulesService()
      Gets travel rules service.
      Returns:
      the travel rules service
    • setTravelRulesService

      public void setTravelRulesService(TravelRulesService travelRulesService)
      Sets travel rules service.
      Parameters:
      travelRulesService - the travel rules service
    • getTransportSuggestionsDisplayStrategy

      protected TransportSuggestionsDisplayStrategy getTransportSuggestionsDisplayStrategy()
      Returns:
      the transportSuggestionsDisplayStrategy
    • setTransportSuggestionsDisplayStrategy

      public void setTransportSuggestionsDisplayStrategy(TransportSuggestionsDisplayStrategy transportSuggestionsDisplayStrategy)
      Parameters:
      transportSuggestionsDisplayStrategy - the transportSuggestionsDisplayStrategy to set
    • getLocationCodesResolvingStrategyMap

      protected Map<LocationType,LocationCodesResolvingStrategy> getLocationCodesResolvingStrategyMap()
      Returns:
      the locationCodesResolvingStrategyMap
    • setLocationCodesResolvingStrategyMap

      public void setLocationCodesResolvingStrategyMap(Map<LocationType,LocationCodesResolvingStrategy> locationCodesResolvingStrategyMap)
      Parameters:
      locationCodesResolvingStrategyMap - the locationCodesResolvingStrategyMap
    • getEnumerationService

      protected de.hybris.platform.enumeration.EnumerationService getEnumerationService()
      Returns:
      enumerationService
    • setEnumerationService

      public void setEnumerationService(de.hybris.platform.enumeration.EnumerationService enumerationService)
      Parameters:
      enumerationService - the enumerationService to set
    • getLocationSuggestionDataConverter

      protected de.hybris.platform.servicelayer.dto.converter.Converter<Map<GlobalSuggestionData,List<GlobalSuggestionData>>,TravelLocationSuggestionData> getLocationSuggestionDataConverter()
      Gets location suggestion data converter.
      Returns:
      the location suggestion data converter
    • setLocationSuggestionDataConverter

      public void setLocationSuggestionDataConverter(de.hybris.platform.servicelayer.dto.converter.Converter<Map<GlobalSuggestionData,List<GlobalSuggestionData>>,TravelLocationSuggestionData> locationSuggestionDataConverter)
      Sets location suggestion data converter.
      Parameters:
      locationSuggestionDataConverter - the location suggestion data converter