Class PricedItineraryBundleHandler
java.lang.Object
de.hybris.platform.travelfacades.fare.search.handlers.impl.PricedItineraryBundleHandler
- All Implemented Interfaces:
FareSearchHandler
Concrete implementation of the
FareSearchHandler interface. Handler is responsible for populating the ItineraryPricingInfoData for each PricedItineraryData on FareSelectionData-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanAddBundle(ItineraryPricingInfoData itineraryPricingInfoData, List<TransportOfferingData> transportOfferings, BundleType type) This method ensures that for each transport offering is offered only one bundle per type.protected voidfilterBundles(FareSelectionData fareSelectionData, FareSearchRequestData fareSearchRequestData) Deprecated.since version 4.0protected CabinClassModelgetCabinClass(FareSearchRequestData fareSearchRequestData) This method will return the cabin class from the request dataprotected CabinClassServiceGets cabin class service.protected de.hybris.platform.enumeration.EnumerationServiceGets enumeration service.protected ItineraryPricingInfoDatagetItineraryPricingInfoDataForType(List<ItineraryPricingInfoData> itineraryPricingInfoDatas, Map.Entry<BundleType, List<BundleTemplateModel>> entry) This method will either return an ItineraryPricingInfoData already created for a given type or it will create a new one.protected List<ItineraryPricingInfoData>getItineraryPricingInfosForMultiSector(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, List<TransportOfferingData> transportOfferings) This method populates the bundles for multi-sector itinerary.protected List<ItineraryPricingInfoData>getItineraryPricingInfosForPointToPoint(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, List<TransportOfferingData> transportOfferings, FareSearchRequestData fareSearchRequestData) This method checks if any bundleTemplates configured for transport offering, if yes, populates the bundles in ItineraryPricingInfoData or else, checks if bundles are configured at travelSectors level, if yes populates the bundles in ItineraryPricingInfoData or else populates the default bundle templates.protected StringgetParameterValue(String key) Method to get parameter value from properties fileprotected List<TransportOfferingData>getTransportOfferings(PricedItineraryData pricedItinerary) Method gets the Itinerary data from the pricedItinerary and then gets a list of OriginDestinationOption from the Itinerary object.protected TransportOfferingServiceGets transport offering service.protected de.hybris.platform.servicelayer.dto.converter.Converter<BundleTemplateModel,TravelBundleTemplateData> Gets travel bundle template converter.protected TravelBundleTemplateServiceGets travel bundle template service.protected TravelRouteModelgetTravelRoute(PricedItineraryData pricedItinerary) This method will return the travel route provided origin - destination pair from the itinerary in the priced itineraryprotected TravelRouteServiceGets travel route service.protected TravelRulesServiceGets travel rules service.protected de.hybris.platform.servicelayer.user.UserServiceGets user service.voidhandle(List<ScheduledRouteData> scheduledRoutes, FareSearchRequestData fareSearchRequestData, FareSelectionData fareSelectionData) Populates ItinerarypricingInformation to pricedItinerary For each transport offering there must be always only one bundle per bundle type.protected voidpopulateBundleMap(List<BundleTemplateModel> bundleTemplatesForTransportOfferings, Map<BundleType, List<BundleTemplateModel>> bundleMap, boolean allowMultipleBundles) Creates a map bundleType, bundles.protected voidpopulateBundleMapForRouteOrDefault(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, Map<BundleType, List<BundleTemplateModel>> bundleMap, List<BundleTemplateModel> bundleTemplatesForSector) Populate bundle map for route or default.protected voidpopulateBundleMapForSectorRouteOrDefault(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, Map<BundleType, List<BundleTemplateModel>> bundleMap, TransportOfferingModel transportOfferingModel) Populate bundle map for sector route or default.protected voidpopulateItineraryPricingInformations(PricedItineraryData pricedItinerary, FareSearchRequestData fareSearchRequestData, CabinClassModel cabinClassModel) For each pricedItinerary populate PricingInfo as below Check if the PricingItinerary is of multi-sector, if yes Check if there are any Bundles configured at route level, if yes, populate the pricing information with the bundles.protected voidpopulateItineraryPricingInfosFromBundleMap(Map<BundleType, List<BundleTemplateModel>> bundleMap, List<TransportOfferingData> transportOfferings, List<ItineraryPricingInfoData> itineraryPricingInfoDatas) Instantiate as many itinerary pricing infos as bundletypes and assign them to the itinerary pricing infoprotected voidpopulateUpgradeableBundles(FareSearchRequestData fareSearchRequestData, PricedItineraryData pricedItinerary, CabinClassModel cabinClassModel, List<ItineraryPricingInfoData> itineraryPricingInfos, int allowedNoOfPricingInfo) Populate upgradeable bundles.protected voidremoveNonCommonBundles(List<ItineraryPricingInfoData> itineraryPricingInfoDatas, int expectedSize) This method is only called for multisector with no route-level bundle.voidsetCabinClassService(CabinClassService cabinClassService) Sets cabin class service.voidsetEnumerationService(de.hybris.platform.enumeration.EnumerationService enumerationService) Sets enumeration service.protected voidsetItineraryPricingInfoAvailability(List<ItineraryPricingInfoData> itineraryPricingInfoDatas) This method will mark an itinerary pricing info as unavailable if no bundles are populatedvoidsetTransportOfferingService(TransportOfferingService transportOfferingService) Sets transport offering service.voidsetTravelBundleTemplateConverter(de.hybris.platform.servicelayer.dto.converter.Converter<BundleTemplateModel, TravelBundleTemplateData> travelBundleTemplateConverter) Sets travel bundle template converter.voidsetTravelBundleTemplateService(TravelBundleTemplateService travelBundleTemplateService) Sets travel bundle template service.voidsetTravelRouteService(TravelRouteService travelRouteService) Sets travel route service.voidsetTravelRulesService(TravelRulesService travelRulesService) Sets travel rules service.voidsetUserService(de.hybris.platform.servicelayer.user.UserService userService) Sets user service.protected voidshowBundles(List<String> bundlesToShow, FareSelectionData fareSelectionData) Removes all theItineraryPricingInfoDatathat have the ignoreRule flag set to false and are not present in the bundleToShow listprotected voidshowBundleTemplates(FareSelectionData fareSelectionData, FareSearchRequestData fareSearchRequestData) Shows bundles templates based on rules
-
Constructor Details
-
PricedItineraryBundleHandler
public PricedItineraryBundleHandler()
-
-
Method Details
-
handle
public void handle(List<ScheduledRouteData> scheduledRoutes, FareSearchRequestData fareSearchRequestData, FareSelectionData fareSelectionData) Populates ItinerarypricingInformation to pricedItinerary For each transport offering there must be always only one bundle per bundle type.- Specified by:
handlein interfaceFareSearchHandler- Parameters:
scheduledRoutes- the scheduled routesfareSearchRequestData- the fare search request datafareSelectionData- the fare selection data
-
showBundleTemplates
protected void showBundleTemplates(FareSelectionData fareSelectionData, FareSearchRequestData fareSearchRequestData) Shows bundles templates based on rules- Parameters:
fareSelectionData- the fare selection datafareSearchRequestData- the fare search request data
-
filterBundles
@Deprecated protected void filterBundles(FareSelectionData fareSelectionData, FareSearchRequestData fareSearchRequestData) Deprecated.since version 4.0Filter bundles.- Parameters:
fareSelectionData- the fare selection datafareSearchRequestData- the fare search request data
-
showBundles
Removes all theItineraryPricingInfoDatathat have the ignoreRule flag set to false and are not present in the bundleToShow list- Parameters:
bundlesToShow- the bundles to showfareSelectionData- the fare selection data
-
populateUpgradeableBundles
protected void populateUpgradeableBundles(FareSearchRequestData fareSearchRequestData, PricedItineraryData pricedItinerary, CabinClassModel cabinClassModel, List<ItineraryPricingInfoData> itineraryPricingInfos, int allowedNoOfPricingInfo) Populate upgradeable bundles.- Parameters:
fareSearchRequestData- the fare search request datapricedItinerary- the priced itinerarycabinClassModel- the cabin class modelitineraryPricingInfos- the itinerary pricing infosallowedNoOfPricingInfo- the allowed no of pricing info
-
populateItineraryPricingInformations
protected void populateItineraryPricingInformations(PricedItineraryData pricedItinerary, FareSearchRequestData fareSearchRequestData, CabinClassModel cabinClassModel) For each pricedItinerary populate PricingInfo as below Check if the PricingItinerary is of multi-sector, if yes Check if there are any Bundles configured at route level, if yes, populate the pricing information with the bundles. if not, or if the PricingItinerary is not multi-sector then Check if there are any Bundles configured at transport offering level, if yes, get the common bundles for all transport offerings and populate them in Pricing information. if no bundles configured (or atleast one of the transport offerings in multi-sector has no bundles) then, Check if all the sectors in the itinerary has bundles configured, if yes, get the common bundles for all and populate the pricing information. if still no bundles found, populates the default bundle templates.- Parameters:
pricedItinerary- the priced itineraryfareSearchRequestData- the fare search request datacabinClassModel- the cabin class model
-
getItineraryPricingInfosForMultiSector
protected List<ItineraryPricingInfoData> getItineraryPricingInfosForMultiSector(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, List<TransportOfferingData> transportOfferings) This method populates the bundles for multi-sector itinerary.- Parameters:
travelRouteModel- the travel route modelcabinClassModel- the cabin class modeltransportOfferings- the transport offerings- Returns:
- List
itinerary pricing infos for multi sector
-
setItineraryPricingInfoAvailability
protected void setItineraryPricingInfoAvailability(List<ItineraryPricingInfoData> itineraryPricingInfoDatas) This method will mark an itinerary pricing info as unavailable if no bundles are populated- Parameters:
itineraryPricingInfoDatas- the itinerary pricing info datas
-
removeNonCommonBundles
protected void removeNonCommonBundles(List<ItineraryPricingInfoData> itineraryPricingInfoDatas, int expectedSize) This method is only called for multisector with no route-level bundle. In this case it is only possible to have n number of bundles for each bundle type, where n is number of transport offerings- Parameters:
itineraryPricingInfoDatas- the itinerary pricing info datasexpectedSize- the expected size
-
getItineraryPricingInfosForPointToPoint
protected List<ItineraryPricingInfoData> getItineraryPricingInfosForPointToPoint(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, List<TransportOfferingData> transportOfferings, FareSearchRequestData fareSearchRequestData) This method checks if any bundleTemplates configured for transport offering, if yes, populates the bundles in ItineraryPricingInfoData or else, checks if bundles are configured at travelSectors level, if yes populates the bundles in ItineraryPricingInfoData or else populates the default bundle templates.- Parameters:
travelRouteModel- the travel route modelcabinClassModel- the cabin class modeltransportOfferings- the transport offeringsfareSearchRequestData- the fare search request data- Returns:
- List
itinerary pricing infos for point to point
-
populateBundleMapForSectorRouteOrDefault
protected void populateBundleMapForSectorRouteOrDefault(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, Map<BundleType, List<BundleTemplateModel>> bundleMap, TransportOfferingModel transportOfferingModel) Populate bundle map for sector route or default.- Parameters:
travelRouteModel- the travel route modelcabinClassModel- the cabin class modelbundleMap- the bundle maptransportOfferingModel- the transport offering model
-
populateBundleMapForRouteOrDefault
protected void populateBundleMapForRouteOrDefault(TravelRouteModel travelRouteModel, CabinClassModel cabinClassModel, Map<BundleType, List<BundleTemplateModel>> bundleMap, List<BundleTemplateModel> bundleTemplatesForSector) Populate bundle map for route or default.- Parameters:
travelRouteModel- the travel route modelcabinClassModel- the cabin class modelbundleMap- the bundle mapbundleTemplatesForSector- the bundle templates for sector
-
populateItineraryPricingInfosFromBundleMap
protected void populateItineraryPricingInfosFromBundleMap(Map<BundleType, List<BundleTemplateModel>> bundleMap, List<TransportOfferingData> transportOfferings, List<ItineraryPricingInfoData> itineraryPricingInfoDatas) Instantiate as many itinerary pricing infos as bundletypes and assign them to the itinerary pricing info- Parameters:
bundleMap- the bundle maptransportOfferings- the transport offeringsitineraryPricingInfoDatas- the itinerary pricing info datas
-
canAddBundle
protected boolean canAddBundle(ItineraryPricingInfoData itineraryPricingInfoData, List<TransportOfferingData> transportOfferings, BundleType type) This method ensures that for each transport offering is offered only one bundle per type.- Parameters:
itineraryPricingInfoData- the itinerary pricing info datatransportOfferings- the transport offeringstype- the type- Returns:
- boolean boolean
-
getItineraryPricingInfoDataForType
protected ItineraryPricingInfoData getItineraryPricingInfoDataForType(List<ItineraryPricingInfoData> itineraryPricingInfoDatas, Map.Entry<BundleType, List<BundleTemplateModel>> entry) This method will either return an ItineraryPricingInfoData already created for a given type or it will create a new one.- Parameters:
itineraryPricingInfoDatas- the itinerary pricing info datasentry- the entry- Returns:
- itinerary pricing info data for type
-
populateBundleMap
protected void populateBundleMap(List<BundleTemplateModel> bundleTemplatesForTransportOfferings, Map<BundleType, List<BundleTemplateModel>> bundleMap, boolean allowMultipleBundles) Creates a map bundleType, bundles. If 'allowMultipleBundles' is set to true, it will be possible to have multiple bundles for the same bundletype. This happens only in case of multi sector with no bundle defined at a route level.- Parameters:
bundleTemplatesForTransportOfferings- the bundle templates for transport offeringsbundleMap- the bundle mapallowMultipleBundles- the allow multiple bundles
-
getTransportOfferings
Method gets the Itinerary data from the pricedItinerary and then gets a list of OriginDestinationOption from the Itinerary object. An empty list if return if the list if empty otherwise a list of Transport Offerings is returned.- Parameters:
pricedItinerary- the priced itinerary- Returns:
- List
transport offerings
-
getParameterValue
Method to get parameter value from properties file- Parameters:
key- the key- Returns:
- parameter value
-
getTravelRoute
This method will return the travel route provided origin - destination pair from the itinerary in the priced itinerary- Parameters:
pricedItinerary- the priced itinerary- Returns:
- TravelRouteModel travel route
-
getCabinClass
This method will return the cabin class from the request data- Parameters:
fareSearchRequestData- the fare search request data- Returns:
- CabinClassModel cabin class
-
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
-
getTravelBundleTemplateConverter
protected de.hybris.platform.servicelayer.dto.converter.Converter<BundleTemplateModel,TravelBundleTemplateData> getTravelBundleTemplateConverter()Gets travel bundle template converter.- Returns:
- the travel bundle template converter
-
setTravelBundleTemplateConverter
public void setTravelBundleTemplateConverter(de.hybris.platform.servicelayer.dto.converter.Converter<BundleTemplateModel, TravelBundleTemplateData> travelBundleTemplateConverter) Sets travel bundle template converter.- Parameters:
travelBundleTemplateConverter- the travel bundle template converter
-
getCabinClassService
Gets cabin class service.- Returns:
- the cabin class service
-
setCabinClassService
Sets cabin class service.- Parameters:
cabinClassService- the cabin class service
-
getEnumerationService
protected de.hybris.platform.enumeration.EnumerationService getEnumerationService()Gets enumeration service.- Returns:
- the enumeration service
-
setEnumerationService
public void setEnumerationService(de.hybris.platform.enumeration.EnumerationService enumerationService) Sets enumeration service.- Parameters:
enumerationService- the enumeration service
-
getTravelBundleTemplateService
Gets travel bundle template service.- Returns:
- the travel bundle template service
-
setTravelBundleTemplateService
Sets travel bundle template service.- Parameters:
travelBundleTemplateService- the travel bundle template service
-
getTravelRulesService
Gets travel rules service.- Returns:
- the travel rules service
-
setTravelRulesService
Sets travel rules service.- Parameters:
travelRulesService- the travel rules service
-
getUserService
protected de.hybris.platform.servicelayer.user.UserService getUserService()Gets user service.- Returns:
- the user service
-
setUserService
public void setUserService(de.hybris.platform.servicelayer.user.UserService userService) Sets user service.- Parameters:
userService- the user service
-