Class PricedItineraryBundleHandler

java.lang.Object
de.hybris.platform.travelfacades.fare.search.handlers.impl.PricedItineraryBundleHandler
All Implemented Interfaces:
FareSearchHandler

public class PricedItineraryBundleHandler extends Object implements FareSearchHandler
Concrete implementation of the FareSearchHandler interface. Handler is responsible for populating the ItineraryPricingInfoData for each PricedItineraryData on FareSelectionData
  • 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:
      handle in interface FareSearchHandler
      Parameters:
      scheduledRoutes - the scheduled routes
      fareSearchRequestData - the fare search request data
      fareSelectionData - the fare selection data
    • showBundleTemplates

      protected void showBundleTemplates(FareSelectionData fareSelectionData, FareSearchRequestData fareSearchRequestData)
      Shows bundles templates based on rules
      Parameters:
      fareSelectionData - the fare selection data
      fareSearchRequestData - the fare search request data
    • filterBundles

      @Deprecated protected void filterBundles(FareSelectionData fareSelectionData, FareSearchRequestData fareSearchRequestData)
      Deprecated.
      since version 4.0
      Filter bundles.
      Parameters:
      fareSelectionData - the fare selection data
      fareSearchRequestData - the fare search request data
    • showBundles

      protected void showBundles(List<String> bundlesToShow, FareSelectionData fareSelectionData)
      Removes all the ItineraryPricingInfoData that have the ignoreRule flag set to false and are not present in the bundleToShow list
      Parameters:
      bundlesToShow - the bundles to show
      fareSelectionData - 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 data
      pricedItinerary - the priced itinerary
      cabinClassModel - the cabin class model
      itineraryPricingInfos - the itinerary pricing infos
      allowedNoOfPricingInfo - 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 itinerary
      fareSearchRequestData - the fare search request data
      cabinClassModel - 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 model
      cabinClassModel - the cabin class model
      transportOfferings - 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 datas
      expectedSize - 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 model
      cabinClassModel - the cabin class model
      transportOfferings - the transport offerings
      fareSearchRequestData - 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 model
      cabinClassModel - the cabin class model
      bundleMap - the bundle map
      transportOfferingModel - 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 model
      cabinClassModel - the cabin class model
      bundleMap - the bundle map
      bundleTemplatesForSector - 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 map
      transportOfferings - the transport offerings
      itineraryPricingInfoDatas - 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 data
      transportOfferings - the transport offerings
      type - 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 datas
      entry - 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 offerings
      bundleMap - the bundle map
      allowMultipleBundles - the allow multiple bundles
    • getTransportOfferings

      protected List<TransportOfferingData> getTransportOfferings(PricedItineraryData pricedItinerary)
      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

      protected String getParameterValue(String key)
      Method to get parameter value from properties file
      Parameters:
      key - the key
      Returns:
      parameter value
    • getTravelRoute

      protected TravelRouteModel getTravelRoute(PricedItineraryData pricedItinerary)
      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

      protected CabinClassModel getCabinClass(FareSearchRequestData fareSearchRequestData)
      This method will return the cabin class from the request data
      Parameters:
      fareSearchRequestData - the fare search request data
      Returns:
      CabinClassModel cabin class
    • 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
    • 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

      protected CabinClassService getCabinClassService()
      Gets cabin class service.
      Returns:
      the cabin class service
    • setCabinClassService

      public void setCabinClassService(CabinClassService cabinClassService)
      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

      protected TravelBundleTemplateService getTravelBundleTemplateService()
      Gets travel bundle template service.
      Returns:
      the travel bundle template service
    • setTravelBundleTemplateService

      public void setTravelBundleTemplateService(TravelBundleTemplateService travelBundleTemplateService)
      Sets travel bundle template service.
      Parameters:
      travelBundleTemplateService - the travel bundle template service
    • 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
    • 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