java.lang.Object
de.hybris.platform.travelfacades.ancillary.search.accommodation.handlers.TravelAccommodationMapHandler
All Implemented Interfaces:
AncillarySearchHandler
Direct Known Subclasses:
ShoppingTravelAccommodationMapHandler

public class TravelAccommodationMapHandler extends Object implements AncillarySearchHandler
Handler to populate seat map options for a transport vehicle retrieved from DB based on mapping between the vehicle config and configured accommodations
  • Constructor Details

    • TravelAccommodationMapHandler

      public TravelAccommodationMapHandler()
  • Method Details

    • handle

      public void handle(OfferRequestData offerRequestData, OfferResponseData offerResponseData)
      Populates seat map based on following rules : 1) Get all itineraries from request 2) Get origindestinationoption for each itinerary and then for each transport offering in origindestinationoption get the transport vehicle to retrieve seat map for that vehicle 3) Using vehicle info code and transport offering, route and sector, accommodation map is retrieved 4) Finally all configured accommodation(decks, cabins, rows, columns and seats) are retrieved and populated in the AccommodationMapResponseData in respective DTOs.
      Specified by:
      handle in interface AncillarySearchHandler
      Parameters:
      offerRequestData - the offer request data
      offerResponseData - the offer response data
    • populateAccomodationMapForODOptions

      protected void populateAccomodationMapForODOptions(OfferRequestData offerRequestData, OfferResponseData offerResponseData, ItineraryData itineraryData, OriginDestinationOptionData originDestinationOptionData)
      Populate accomodation map for od options.
      Parameters:
      offerRequestData - the offer request data
      offerResponseData - the offer response data
      itineraryData - the itinerary data
      originDestinationOptionData - the origin destination option data
    • getSelectedAccommodations

      protected List<SelectedAccommodationModel> getSelectedAccommodations(OfferRequestData offerRequestData, TransportOfferingModel transportOffering)
      Create the status parameters to find selected accommodations that belong to an order, for making accommodations already selected and already added to order(not in cancelled state), unavailable
      Parameters:
      offerRequestData - the offer request data
      transportOffering - the transport offering
      Returns:
      selected accommodations
    • createAccommodationMapResonseData

      protected SeatMapResponseData createAccommodationMapResonseData()
      Creates instance of SeatMapResponseData
      Returns:
      seat map response data
    • populateAccommodationMap

      protected void populateAccommodationMap(OfferRequestData offerRequestData, SeatMapResponseData seatMapResonseData, List<ConfiguredAccommodationModel> seatMapConfigurations, TransportOfferingData transportOfferingData, List<SelectedAccommodationModel> selectedAccommodations, TransportOfferingModel transportOffering, ItineraryData itineraryData, String accommodationMapCode)
      This method does following : 1)Checks if seatMapConfigurations i.e. Deck(s) exist, if not then it returns. 2)Else : a)it instantiates a seatmapdata for current transport offering(within the loop) b)instantiates and associate a seatmapdetail(containing a list of cabins) to seatmapdata c)adds seatmapdata to the list of seatmaps belonging to SeatMapResponseData. 3)Creates a modifiable list of current list of configured accommodations(i.e. deck) so as to sort them based on deck no. using configuredAccomNumberComparator, this can be used to position more than one decks. 4)Start looping through current list of configured accommodations i.e., and for first Deck, calls "populateAccommodationMapDetailData" to populate child configured accommodation(cabin, row, columns etc.) belonging to each deck.
      Parameters:
      offerRequestData - the offer request data
      seatMapResonseData - the seat map resonse data
      seatMapConfigurations - the seat map configurations
      transportOfferingData - the transport offering data
      selectedAccommodations - the selected accommodations
      transportOffering - the transport offering
      itineraryData - the itinerary data
      accommodationMapCode - the accommodation map code
    • populateAccommodationMapDetailData

      protected void populateAccommodationMapDetailData(OfferRequestData offerRequestData, SeatMapDetailData seatMapDetail, ConfiguredAccommodationModel deck, List<SelectedAccommodationModel> selectedAccommodations, TransportOfferingModel transportOffering, ItineraryData itineraryData, Map<ProductModel,Long> productStockMap)
      This method does following : 1) Checks if current configured accommodation(deck) contains cabin, if Not it returns 2) Else : a)Create a modifiable list of cabins, to sort them based on number using configuredAccomNumberComparator b)For each configured accommodation(cabin) get all the rows and create a modifiable list of rows to sort them based on number using configuredAccomNumberComparator. 3)Gets the row number of first row from sorted rows and sets that as starting row num of current cabin, gets last row num of the sorted rows and sets that as ending row num of the cabin(these are used to draw total rows of a cabin on FE) 4)Check and set upper deck indicator, associates cabin class data to determine cabin class on FE and set column headers for all accommodation columns belonging to current cabin. 5)Finally it calls "populateRowInfo" to populate rows, columns and accommodation info of all accommodations within current cabin.
      Parameters:
      offerRequestData - the offer request data
      seatMapDetail - the seat map detail
      deck - the deck
      selectedAccommodations - the selected accommodations
      transportOffering - the transport offering
      itineraryData - the itinerary data
      productStockMap - the product stock map
    • populateFromPrice

      protected void populateFromPrice(OfferRequestData offerRequestData, CabinData cabinData)
      This method gets all accommodations belonging to all row/column of a cabin, and sort them in ascending order by price, to get the lowest accommodation fare of the cabin, this is done to display "From LowestPrice" for a cabin on FE.
      Parameters:
      offerRequestData - the offer request data
      cabinData - the cabin data
    • populateRowInfo

      protected void populateRowInfo(OfferRequestData offerRequestData, CabinData cabinData, List<ConfiguredAccommodationModel> rows, TransportOfferingModel transportOffering, ItineraryData itineraryData, List<SelectedAccommodationModel> selectedAccommodations, Map<ProductModel,Long> productStockMap)
      This method does following : 1)Checks if the rows(belonging to a cabin) and passed to it as parameter is empty, it returns if the theres no rows. 2)Else : a)Loop through all the rows and for each row create a RowInfoData and calls "populateSeatInfo" to associate accommodation info of all accommodations belonging to current row. b)adds this rowinfodata to list of rowinfos belonging to a cabin
      Parameters:
      offerRequestData - the offer request data
      cabinData - the cabin data
      rows - the rows
      transportOffering - the transport offering
      itineraryData - the itinerary data
      selectedAccommodations - the selected accommodations
      productStockMap - the product stock map
    • populateSeatInfo

      protected void populateSeatInfo(OfferRequestData offerRequestData, ConfiguredAccommodationModel row, RowInfoData rowInfoData, CabinData cabinData, TransportOfferingModel transportOffering, ItineraryData itineraryData, List<SelectedAccommodationModel> selectedAccommodations, Map<ProductModel,Long> productStockMap)
      This method does following : 1)For the row passed to it as parameter it gets all columns and sort them using configuredAccomNumberComparator to have column sorted based on number. 2)It checks if modifiable list of column is empty, returns if it is empty, Else : a)Loop through columns of the row, and for each column, gets all accommodations belonging to the column. b)Calls "createSeat" method to create the accommodation info.
      Parameters:
      offerRequestData - the offer request data
      row - the row
      rowInfoData - the row info data
      cabinData - the cabin data
      transportOffering - the transport offering
      itineraryData - the itinerary data
      selectedAccommodations - the selected accommodations
      productStockMap - the product stock map
    • createSeats

      protected void createSeats(OfferRequestData offerRequestData, CabinData cabinData, TransportOfferingModel transportOffering, ItineraryData itineraryData, List<SelectedAccommodationModel> selectedAccommodations, Map<ProductModel,Long> productStockMap, List<SeatInfoData> seatInfo, int colNum, List<ConfiguredAccommodationModel> seats)
      Creates seats for given column
      Parameters:
      offerRequestData - the offer request data
      cabinData - the cabin data
      transportOffering - the transport offering
      itineraryData - the itinerary data
      selectedAccommodations - the selected accommodations
      productStockMap - the product stock map
      seatInfo - the seat info
      colNum - the col num
      seats - the seats
    • populateSeatFeatureData

      protected void populateSeatFeatureData(OfferRequestData offerRequestData, ProximityItemModel proximityItemModel, SeatFeatureData seatFeatureData)
      Create SeatFeatureData for each proximity item associated with a seat
      Parameters:
      offerRequestData - the offer request data
      proximityItemModel - the proximity item model
      seatFeatureData - the seat feature data
    • getAccommodationMapConfiguration

      protected List<ConfiguredAccommodationModel> getAccommodationMapConfiguration(OfferRequestData offerRequestData, AccommodationMapModel accommodationMap)
      Gets and return list of configured accommodations belonging to an accommodation map
      Parameters:
      offerRequestData - the offer request data
      accommodationMap - the accommodation map
      Returns:
      accommodation map configuration
    • getAccommodationMap

      protected AccommodationMapModel getAccommodationMap(OfferRequestData offerRequestData, ItineraryData itineraryData, TransportOfferingModel transportOffering, TravelSectorData travelSector, String vehicleInfoCode)
      Gets and return accommodation map for transport offering, route, sector and vehicle info code
      Parameters:
      offerRequestData - the offer request data
      itineraryData - the itinerary data
      transportOffering - the transport offering
      travelSector - the travel sector
      vehicleInfoCode - the vehicle info code
      Returns:
      accommodation map
    • getTransportVehicleInfo

      protected TransportVehicleInfoData getTransportVehicleInfo(OfferRequestData offerRequestData, TransportVehicleData transportVehicle)
      Gets and returns Transport vehicle info data from the transport vehicle data passed as param
      Parameters:
      offerRequestData - the offer request data
      transportVehicle - the transport vehicle
      Returns:
      transport vehicle info
    • getTransportVehicle

      protected TransportVehicleData getTransportVehicle(OfferRequestData offerRequestData, TransportOfferingData transportOfferingData)
      Gets and returns Transport vehicle associated with a transport offering
      Parameters:
      offerRequestData - the offer request data
      transportOfferingData - the transport offering data
      Returns:
      transport vehicle
    • createSeat

      protected void createSeat(OfferRequestData offerRequestData, List<SeatInfoData> seatInfo, int colNum, ConfiguredAccommodationModel seat, CabinData cabinData, TransportOfferingModel transportOffering, ItineraryData itineraryData, List<SelectedAccommodationModel> selectedAccommodations, Map<ProductModel,Long> productStockMap)
      This method does following : 1)Create a seatinfodata object for an accommodation, and adds it to list of seatinfos passed to it as parameter 2)Sets the column no. to which this accommodation belong. 3)Check if seat have proximity items(WC, GALLEY etc.) associated with it, if yes then creates proximity item data and associate it with seat. 4)Calls "populateSeatFare" to set fare for each seat 5)Calls "populateSeatAvailability" to set the availabilty of seat.
      Parameters:
      offerRequestData - the offer request data
      seatInfo - the seat info
      colNum - the col num
      seat - the seat
      cabinData - the cabin data
      transportOffering - the transport offering
      itineraryData - the itinerary data
      selectedAccommodations - the selected accommodations
      productStockMap - the product stock map
    • getSeatFeatureData

      protected SeatFeatureData getSeatFeatureData(AccommodationCharacteristicsModel characteristic)
      Gets the seat feature data.
      Parameters:
      characteristic - the characteristic
      Returns:
      the seat feature data
    • populateSeatAvailability

      protected void populateSeatAvailability(OfferRequestData offerRequestData, CabinData cabinData, ConfiguredAccommodationModel seat, List<SelectedAccommodationModel> selectedAccommodations, TransportOfferingModel transportOffering, Map<ProductModel,Long> productStockMap)
      This method does following : 1)For the seat passed to it as parameter, it gets product associated with the seat. 2)If the product is not null, it checks if productStockMap passed as param has entry of the product as key, if found, it gets stock of that product as value against the key. 3)If product is not found, it checks stock of product in DB, and sets it as key/value pair in productStockMap(to avoid hitting DB to check stock of same product, in case theres same product associated with another seat) 4)If stock is 0, it calls "createSeatAvailabilityData" to create SeatAvailabilityData for that seat with availability indicator = N 5)If stock is not 0, it checks for selected accommodation for this seat in the selectedAccommodations(list of all accommodations belonging to this transport offering already added to order) passed to it as param. 6)If selectedAccommodation is found for this seat, it calls "createSeatAvailabilityData" to create SeatAvailabilityData for that seat with availability indicator = N
      Parameters:
      offerRequestData - the offer request data
      cabinData - the cabin data
      seat - the seat
      selectedAccommodations - the selected accommodations
      transportOffering - the transport offering
      productStockMap - the product stock map
    • populateDisableSeatAvailability

      protected void populateDisableSeatAvailability(OfferRequestData offerRequestData, CabinData cabinData, ConfiguredAccommodationModel seat)
      create a seat availabilty data for a seat and set its availability indicator to D (disable) to represent non-availability of that seat.
      Parameters:
      offerRequestData - the offer request data
      cabinData - the cabin data
      seat - the seat
    • createSeatAvailabilityData

      protected void createSeatAvailabilityData(OfferRequestData offerRequestData, CabinData cabinData, ConfiguredAccommodationModel seat, SelectedAccommodationModel selectedAccommodationModel)
      create a seat availabilty data for a seat and set its availability indicator to N to represent non-availability of that seat.
      Parameters:
      offerRequestData - the offer request data
      cabinData - the cabin data
      seat - the seat
      selectedAccommodationModel - the selected accommodation model
    • populateSeatFare

      protected void populateSeatFare(OfferRequestData offerRequestData, SeatInfoData seatInfoData, ConfiguredAccommodationModel seat, TransportOfferingModel transportOffering, ItineraryData itineraryData)
      This method does following : For seat passed to it as parameter : 1)Gets associated product. 2)Gets price information for associated product and transport offering 3)If not found, look for price information for associated product and travel sector 4)If not found, look for price information for associated product and travel route 5)If not found, look for price information for associated product 6)If still not found then do not associate price with the seat else, create TotalFareData based on price information and associate it with seatInfoData(representing current seat) passed as param
      Parameters:
      offerRequestData - the offer request data
      seatInfoData - the seat info data
      seat - the seat
      transportOffering - the transport offering
      itineraryData - the itinerary data
    • setSeatInfoPrice

      protected void setSeatInfoPrice(SeatInfoData seatInfoData, PriceData priceData)
      Sets seat info price.
      Parameters:
      seatInfoData - the seat info data
      priceData - the price data
    • createPriceData

      protected PriceData createPriceData(OfferRequestData offerRequestData, de.hybris.platform.jalo.order.price.PriceInformation priceInfo)
      Method takes a PriceInformation object and performs a null check. If the object a is null then null will be returned otherwise the PriceDataFactory is invoked and a new PriceData object is created and returned using the PriceValue on the PriceInformation object
      Parameters:
      offerRequestData - the offer request data
      priceInfo - the price info
      Returns:
      price data
    • getAccommodationMapService

      protected AccommodationMapService getAccommodationMapService()
      Gets accommodation map service.
      Returns:
      the accommodationMapService
    • setAccommodationMapService

      public void setAccommodationMapService(AccommodationMapService accommodationMapService)
      Sets accommodation map service.
      Parameters:
      accommodationMapService - the accommodationMapService to set
    • getTransportOfferingService

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

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

      protected TravelCommerceStockService getCommerceStockService()
      Gets commerce stock service.
      Returns:
      the commerceStockService
    • setCommerceStockService

      public void setCommerceStockService(TravelCommerceStockService commerceStockService)
      Sets commerce stock service.
      Parameters:
      commerceStockService - the commerceStockService to set
    • getTravelCommercePriceService

      protected TravelCommercePriceService getTravelCommercePriceService()
      Gets travel commerce price service.
      Returns:
      the travelCommercePriceService
    • setTravelCommercePriceService

      public void setTravelCommercePriceService(TravelCommercePriceService travelCommercePriceService)
      Sets travel commerce price service.
      Parameters:
      travelCommercePriceService - the travelCommercePriceService to set
    • getPriceDataFactory

      @Deprecated protected de.hybris.platform.commercefacades.product.PriceDataFactory getPriceDataFactory()
      Deprecated.
      Deprecated since version 3.0.
      Gets price data factory.
      Returns:
      the priceDataFactory
    • setPriceDataFactory

      @Deprecated public void setPriceDataFactory(de.hybris.platform.commercefacades.product.PriceDataFactory priceDataFactory)
      Deprecated.
      Deprecated since version 3.0.
      Sets price data factory.
      Parameters:
      priceDataFactory - the priceDataFactory to set
    • getConfiguredAccomNumberComparator

      protected Comparator<ConfiguredAccommodationModel> getConfiguredAccomNumberComparator()
      Gets configured accom number comparator.
      Returns:
      the configuredAccomNumberComparator
    • setConfiguredAccomNumberComparator

      public void setConfiguredAccomNumberComparator(Comparator<ConfiguredAccommodationModel> configuredAccomNumberComparator)
      Sets configured accom number comparator.
      Parameters:
      configuredAccomNumberComparator - the configuredAccomNumberComparator to set
    • getAccommodationInfoDataComparator

      protected Comparator<SeatInfoData> getAccommodationInfoDataComparator()
      Gets accommodation info data comparator.
      Returns:
      the accommodationInfoDataComparator
    • setAccommodationInfoDataComparator

      public void setAccommodationInfoDataComparator(Comparator<SeatInfoData> accommodationInfoDataComparator)
      Sets accommodation info data comparator.
      Parameters:
      accommodationInfoDataComparator - the accommodationInfoDataComparator to set
    • getTravellerDataConverter

      protected de.hybris.platform.servicelayer.dto.converter.Converter<TravellerModel,TravellerData> getTravellerDataConverter()
      Gets traveller data converter.
      Returns:
      the traveller data converter
    • setTravellerDataConverter

      public void setTravellerDataConverter(de.hybris.platform.servicelayer.dto.converter.Converter<TravellerModel,TravellerData> travellerDataConverter)
      Sets traveller data converter.
      Parameters:
      travellerDataConverter - the traveller data converter
    • getProductReferenceService

      protected de.hybris.platform.catalog.references.ProductReferenceService getProductReferenceService()
      Gets product reference service.
      Returns:
      the product reference service
    • setProductReferenceService

      public void setProductReferenceService(de.hybris.platform.catalog.references.ProductReferenceService productReferenceService)
      Sets product reference service.
      Parameters:
      productReferenceService - the product reference service
    • getProductService

      protected de.hybris.platform.product.ProductService getProductService()
      Gets product service.
      Returns:
      the product service
    • setProductService

      public void setProductService(de.hybris.platform.product.ProductService productService)
      Sets product service.
      Parameters:
      productService - the product service
    • getSeatPredicate

      protected BiPredicate<SeatAvailabilityData,SeatInfoData> getSeatPredicate()
      Gets seat predicate.
      Returns:
      the seatPredicate
    • setSeatPredicate

      public void setSeatPredicate(BiPredicate<SeatAvailabilityData,SeatInfoData> seatPredicate)
      Sets seat predicate.
      Parameters:
      seatPredicate - the seatPredicate to set
    • getTravelCommercePriceFacade

      protected TravelCommercePriceFacade getTravelCommercePriceFacade()
      Gets travel commerce price facade.
      Returns:
      the travelCommercePriceFacade
    • setTravelCommercePriceFacade

      public void setTravelCommercePriceFacade(TravelCommercePriceFacade travelCommercePriceFacade)
      Sets travel commerce price facade.
      Parameters:
      travelCommercePriceFacade - the travelCommercePriceFacade to set