Class DefaultTransportOfferingFacade
java.lang.Object
de.hybris.platform.travelfacades.facades.impl.DefaultTransportOfferingFacade
- All Implemented Interfaces:
TransportOfferingFacade
- Direct Known Subclasses:
DefaultShoppingTransportOfferingFacade
Default implementation of the
TransportOfferingFacade interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildInitialTransportOfferings(Queue<List<TransportOfferingData>> routeCombinations, List<TransportOfferingData> transportOfferings) Method creates individual lists for eachTransportOfferingDataand before adding the list to the Queue.protected voidbuildScheduledRoutes(Queue<List<TransportOfferingData>> transportOfferingConnections, TravelRouteData travelRoute, List<ScheduledRouteData> scheduledRoutes, int referenceNumber) Method takes the queue which contains a list ofTransportOfferingDataand creates aScheduledRouteDatafor each element before adding to theScheduledRouteDatalist.protected Queue<List<TransportOfferingData>>buildTransportOfferingConnections(OriginDestinationInfoData originDestinationInfo, List<TravelSectorData> travelSectors, FareSearchRequestData fareSearchRequestData) 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.protected booleancheckForOverNightTransportOfferingConnections(Queue<List<TransportOfferingData>> transportOfferingConnections) Method to check if the a TransportOffering has an overnight connection.protected SearchDatacreateSearchData(TravelSectorData travelSector, Date departureDate) protected de.hybris.platform.servicelayer.config.ConfigurationServicegetDestinationLocationSuggestions(String searchText, String origin) Method to retrieve suggestions for the destinations search text that cover the specific origingetDestinationSuggestionData(String originLocation, String text) Method to retrieve suggestions for the destination search text and origin codegetDestinationSuggestions(String originLocation, String text) Method to retrieve suggestions for the destination search text and origin codeprotected de.hybris.platform.enumeration.EnumerationServiceprotected LocationCodesResolvingStrategygetLocationCodesResolvingStrategy(LocationType locationType) Method returning a LocationCodesResolvingStrategy according to the LocatiionType passed as an argumentprotected Map<LocationType,LocationCodesResolvingStrategy> protected de.hybris.platform.servicelayer.dto.converter.Converter<Map<GlobalSuggestionData,List<GlobalSuggestionData>>, TravelLocationSuggestionData> Gets location suggestion data converter.protected Queue<List<TransportOfferingData>>Method returns a new PriorityQueue<List> object with a comparator Method to retrieve suggestions for the origin search textgetOriginSuggestions(String text) Method to retrieve suggestions for the origin search textgetOriginSuggestions(String searchText, String destination) Method to retrieve suggestions for the origins search text that cover the specific destinationgetScheduledRoutes(FareSearchRequestData fareSearchRequestData) Method uses the arrivalLocation and departureLocation formOriginDestinationInfoDataonFareSearchRequestData** to get a list ofTravelRouteModelfrom the Database.protected SuggestionsDisplayStrategyprotected de.hybris.platform.servicelayer.time.TimeServicegetTransportOffering(String code) Get a TransportOfferingData by code.getTransportOffering(List<TransportOfferingOption> options, String transportOfferingCode) Method to retrieve transport offering details for the transport offering options and transport offering code.protected de.hybris.platform.converters.ConfigurablePopulator<TransportOfferingModel,TransportOfferingData, TransportOfferingOption> protected de.hybris.platform.servicelayer.dto.converter.Converter<TransportOfferingModel,TransportOfferingData> getTransportOfferings(String number, Date departureDate, List<TransportOfferingOption> options) Get a list of TransportOfferingData by number and departureDate.getTransportOfferings(List<TransportOfferingOption> options, List<TransportOfferingModel> transportOfferingModelList) Get a list of TransportOfferingData for TransportOfferingModels.protected TransportOfferingServiceprotected TransportSuggestionsDisplayStrategyprotected de.hybris.platform.servicelayer.dto.converter.Converter<TravelRouteModel,TravelRouteData> protected List<TravelRouteData>getTravelRoutes(OriginDestinationInfoData originDestinationInfo) Method returns List of TravelRouteData that contains the origin destination sent in the request.protected TravelRouteServiceprotected TravelRulesServiceGets travel rules service.protected booleanisConnectionValid(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 attributebooleanisMultiSectorRoute(List<String> transportOfferings) Method to check if the route is multi sectorprotected booleanisTransportOfferingConnectionFeasible(Date arrivalDate, Date departureDate) Method takes arrivalDate and departureDateDateobjects and run the following check:protected SearchDatapopulateSuggestionsSearchData(String searchType, String text, String originLocation) Method to populate the search criteria for solr suggestions searchprotected SearchDatapopulateSuggestionsSearchData(String searchType, String text, String originLocation, String destinationLocation) Method to populate the search criteria for solr suggestions searchprotected List<TransportOfferingData>searchTransportOfferings(TravelSectorData travelSector, Date departureDate, FareSearchRequestData fareSearchRequestData) Method which makes a call to Solr and returns a list ofTransportOfferingDatabased on theTravelSectorDataOrigin and Destination codes andOriginDestinationInfodepartureDate.voidsetConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) voidsetEnumerationService(de.hybris.platform.enumeration.EnumerationService enumerationService) voidsetLocationCodesResolvingStrategyMap(Map<LocationType, LocationCodesResolvingStrategy> locationCodesResolvingStrategyMap) voidsetLocationSuggestionDataConverter(de.hybris.platform.servicelayer.dto.converter.Converter<Map<GlobalSuggestionData, List<GlobalSuggestionData>>, TravelLocationSuggestionData> locationSuggestionDataConverter) Sets location suggestion data converter.voidsetSuggestionsDisplayStrategy(SuggestionsDisplayStrategy suggestionsDisplayStrategy) voidsetTimeService(de.hybris.platform.servicelayer.time.TimeService timeService) voidsetTransportOfferingConfiguredPopulator(de.hybris.platform.converters.ConfigurablePopulator<TransportOfferingModel, TransportOfferingData, TransportOfferingOption> transportOfferingConfiguredPopulator) voidsetTransportOfferingConverter(de.hybris.platform.servicelayer.dto.converter.Converter<TransportOfferingModel, TransportOfferingData> transportOfferingConverter) voidsetTransportOfferingSearchFacade(TransportOfferingSearchFacade<TransportOfferingData> transportOfferingSearchFacade) voidsetTransportOfferingService(TransportOfferingService transportOfferingService) voidsetTransportSuggestionsDisplayStrategy(TransportSuggestionsDisplayStrategy transportSuggestionsDisplayStrategy) voidsetTravelRouteConverter(de.hybris.platform.servicelayer.dto.converter.Converter<TravelRouteModel, TravelRouteData> travelRouteConverter) voidsetTravelRouteService(TravelRouteService travelRouteService) voidsetTravelRulesService(TravelRulesService travelRulesService) Sets travel rules service.
-
Constructor Details
-
DefaultTransportOfferingFacade
public DefaultTransportOfferingFacade()
-
-
Method Details
-
getTransportOfferings
public List<TransportOfferingData> getTransportOfferings(String number, Date departureDate, List<TransportOfferingOption> options) Description copied from interface:TransportOfferingFacadeGet a list of TransportOfferingData by number and departureDate.- Specified by:
getTransportOfferingsin interfaceTransportOfferingFacade- Parameters:
number- the number of requested transport offeringdepartureDate- the departure date of requested transport offeringoptions- 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:TransportOfferingFacadeGet a list of TransportOfferingData for TransportOfferingModels.- Specified by:
getTransportOfferingsin interfaceTransportOfferingFacade- Parameters:
options- the options for populating the TransportOfferingDatatransportOfferingModelList- list of TransportOfferingModels- Returns:
- List
transport offerings
-
getScheduledRoutes
Description copied from interface:TransportOfferingFacadeMethod uses the arrivalLocation and departureLocation formOriginDestinationInfoDataonFareSearchRequestData** to get a list ofTravelRouteModelfrom the Database. EachTravelRouteModelis then converted to a list ofTravelRouteDataby theTravelRoutePopulator. The method then queries Solr for a list ofTransportOfferingDatafor eachTravelSectorDatawithin eachTravelRouteDataand then runs an algorithm to matchTransportOfferingDatafor eachTravelSectorDatabefore building theScheduledRouteData** consisting of validTransportOfferingDatacombinations perTravelRouteModel- Specified by:
getScheduledRoutesin interfaceTransportOfferingFacade- 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
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
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 ofTransportOfferingDatatransportOfferings- list ofTransportOfferingData- Returns:
-
buildInitialTransportOfferings
protected void buildInitialTransportOfferings(Queue<List<TransportOfferingData>> routeCombinations, List<TransportOfferingData> transportOfferings) Method creates individual lists for eachTransportOfferingDataand before adding the list to the Queue.- Parameters:
routeCombinations- the queue containing a list ofTransportOfferingDatathat will contain the list ofTransportOfferingDatatransportOfferings- list ofTransportOfferingDatawhich will then be converted to individual list items containing a singleTransportOfferingDataelement
-
isTransportOfferingConnectionFeasible
Method takes arrivalDate and departureDateDateobjects 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 applieddepartureDate- 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 ofTransportOfferingDataand creates aScheduledRouteDatafor each element before adding to theScheduledRouteDatalist.- Parameters:
transportOfferingConnections- the queue containing a list ofTransportOfferingDataelementstravelRoute- the TravelRouteData which is to be added to theScheduledRouteDatascheduledRoutes- theScheduledRouteDatalist where eachScheduledRouteDataobject will be added too.referenceNumber- the referenceNumber for this route which will be added to theScheduledRouteDataobject
-
isConnectionValid
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 ofTransportOfferingDatabased on theTravelSectorDataOrigin and Destination codes andOriginDestinationInfodepartureDate.- Parameters:
travelSector- theTravelSectorDatawhich will be used in the solr querydepartureDate- theDatewhich will be used in the solr query- Returns:
- List
-
createSearchData
-
getTransportOffering
Description copied from interface:TransportOfferingFacadeGet a TransportOfferingData by code.- Specified by:
getTransportOfferingin interfaceTransportOfferingFacade- Parameters:
code- the unique code for a transport offering- Returns:
- TransportOfferingData transport offering
-
isMultiSectorRoute
Description copied from interface:TransportOfferingFacadeMethod to check if the route is multi sector- Specified by:
isMultiSectorRoutein interfaceTransportOfferingFacade- Parameters:
transportOfferings- the transport offerings- Returns:
- boolean boolean
-
getOriginSuggestions
Description copied from interface:TransportOfferingFacadeMethod to retrieve suggestions for the origin search text- Specified by:
getOriginSuggestionsin interfaceTransportOfferingFacade- Parameters:
text- the text- Returns:
- Map of suggestions results
-
getDestinationSuggestions
Description copied from interface:TransportOfferingFacadeMethod to retrieve suggestions for the destination search text and origin code- Specified by:
getDestinationSuggestionsin interfaceTransportOfferingFacade- Parameters:
originLocation- the origin locationtext- 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
Description copied from interface:TransportOfferingFacadeMethod to retrieve suggestions for the origin search text- Specified by:
getOriginSuggestionDatain interfaceTransportOfferingFacade- 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:TransportOfferingFacadeMethod to retrieve suggestions for the destination search text and origin code- Specified by:
getDestinationSuggestionDatain interfaceTransportOfferingFacade- Parameters:
originLocation- the origin locationtext- the text- Returns:
- Map of suggestions results using GlobalSuggestionData objects
-
getOriginSuggestions
Method to retrieve suggestions for the origins search text that cover the specific destination- Specified by:
getOriginSuggestionsin interfaceTransportOfferingFacade- Parameters:
searchText- the origin suggestiondestination- the destination to be covered from the origin- Returns:
- the TravelLocationSuggestionData.
-
getDestinationLocationSuggestions
public TravelLocationSuggestionData getDestinationLocationSuggestions(String searchText, String origin) Description copied from interface:TransportOfferingFacadeMethod to retrieve suggestions for the destinations search text that cover the specific origin- Specified by:
getDestinationLocationSuggestionsin interfaceTransportOfferingFacade- Parameters:
searchText- the destination suggestionorigin- 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:
getTransportOfferingin interfaceTransportOfferingFacade- Parameters:
options- the list of transport offering optionstransportOfferingCode- transport offering code- Returns:
TransportOfferingDatatransport 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 typetext- the search textoriginLocation- the origin locationdestinationLocation- the destination location- Returns:
- search data
-
getTransportOfferingService
- Returns:
- the transportOfferingService
-
setTransportOfferingService
- 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, getTransportOfferingConfiguredPopulator()TransportOfferingOption> - Returns:
- the transportOfferingConfiguredPopulator
-
setTransportOfferingConfiguredPopulator
public void setTransportOfferingConfiguredPopulator(de.hybris.platform.converters.ConfigurablePopulator<TransportOfferingModel, TransportOfferingData, TransportOfferingOption> transportOfferingConfiguredPopulator) - Parameters:
transportOfferingConfiguredPopulator- the transportOfferingConfiguredPopulator to set
-
getTransportOfferingSearchFacade
- Returns:
- the transportOfferingSearchFacade
-
setTransportOfferingSearchFacade
public void setTransportOfferingSearchFacade(TransportOfferingSearchFacade<TransportOfferingData> transportOfferingSearchFacade) - Parameters:
transportOfferingSearchFacade- the transportOfferingSearchFacade to set
-
getTravelRouteService
- Returns:
- the travelRouteService
-
setTravelRouteService
- Parameters:
travelRouteService- the travelRouteService to set
-
getSuggestionsDisplayStrategy
- Returns:
- the suggestionsDisplayStrategy
-
setSuggestionsDisplayStrategy
- 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
Gets travel rules service.- Returns:
- the travel rules service
-
setTravelRulesService
Sets travel rules service.- Parameters:
travelRulesService- the travel rules service
-
getTransportSuggestionsDisplayStrategy
- Returns:
- the transportSuggestionsDisplayStrategy
-
setTransportSuggestionsDisplayStrategy
public void setTransportSuggestionsDisplayStrategy(TransportSuggestionsDisplayStrategy transportSuggestionsDisplayStrategy) - Parameters:
transportSuggestionsDisplayStrategy- the transportSuggestionsDisplayStrategy to set
-
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>>, getLocationSuggestionDataConverter()TravelLocationSuggestionData> 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
-