Class DealAccommodationAvailabilityHandler

java.lang.Object
de.hybris.platform.travelfacades.facades.accommodation.handlers.impl.DealAccommodationAvailabilityHandler
All Implemented Interfaces:
AccommodationDetailsHandler

public class DealAccommodationAvailabilityHandler extends Object implements AccommodationDetailsHandler
Concrete implementation of AccommodationDetailsHandler handling accommodation availability for deals
  • Constructor Details

    • DealAccommodationAvailabilityHandler

      public DealAccommodationAvailabilityHandler()
  • Method Details

    • handle

      public void handle(AccommodationAvailabilityRequestData availabilityRequestData, AccommodationAvailabilityResponseData accommodationAvailabilityResponseData)
      Description copied from interface: AccommodationDetailsHandler
      Handle method.
      Specified by:
      handle in interface AccommodationDetailsHandler
      Parameters:
      availabilityRequestData - the availability request data
      accommodationAvailabilityResponseData - the accommodation availability response data
    • collectAvailability

      protected void collectAvailability(LocalDateTime date, List<Integer> stockLevels, AccommodationOfferingModel accommodationOfferingModel, AccommodationModel accommodation, String accommodationBundleId)
      This methods collect availabilities from accommodation and room rate products given a certain date. From the AccommodationBundleTemplate corresponding to the given accommodationBundleId it finds the room rate product to be applied via date validation. Then retrieves stocklevel and adds the availability value to a list, initialized with the availability value for the given accommodation in that date. If a room rate product is forced to be out of stock, zero is added to the list. If a room rate product is force to be in stock, it is ignored since it won't participate to availability calculation.
      Parameters:
      date - the date
      stockLevels - the list of the availabilities retrieved both for accommodation and room rate products for the rate plan taken into consideration
      accommodationOfferingModel - the AccommodationOfferingModel
      accommodation - the AccommodationModel currently analyzed
      accommodationBundleId - the id of the accommodationBundleTemplate
    • validateRoomRateAgainstDate

      protected boolean validateRoomRateAgainstDate(Date date, ProductModel roomRate)
      This method validates a RoomRateProductModel against a date. The room rate is considered valid if it includes the given date and it is associated to the correct day of week.
      Parameters:
      date -
      roomRate - to be validated
      Returns:
      true if the roomRate is valid, false otherwise
    • isValidDayOfWeek

      protected boolean isValidDayOfWeek(Date date, List<DayOfWeek> daysOfWeek)
      This method performs day of week validation.
      Parameters:
      date -
      daysOfWeek -
      Returns:
      true if the day of week in a given date is among the values of a list
    • updateAccommodationData

      protected void updateAccommodationData(RoomStayData roomStay, List<Integer> stockLevels)
      This method updates the RatePlanData setting the corresponding availability, calculated as the minimum among the values retrieved. The data object is then set against the relative RoomTypeData
      Parameters:
      roomStay - the roomStay to be updated
      stockLevels - the list of values representing availability
    • getProductService

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

      public void setProductService(de.hybris.platform.product.ProductService productService)
      Parameters:
      productService - the productService to set
    • getCommerceStockService

      protected TravelCommerceStockService getCommerceStockService()
      Returns:
      the commerceStockService
    • setCommerceStockService

      public void setCommerceStockService(TravelCommerceStockService commerceStockService)
      Parameters:
      commerceStockService - the commerceStockService to set
    • getEnumerationService

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

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

      protected AccommodationOfferingService getAccommodationOfferingService()
      Returns:
      the accommodationOfferingService
    • setAccommodationOfferingService

      public void setAccommodationOfferingService(AccommodationOfferingService accommodationOfferingService)
      Parameters:
      accommodationOfferingService - the accommodationOfferingService to set
    • getBundleTemplateService

      protected de.hybris.platform.configurablebundleservices.bundle.BundleTemplateService getBundleTemplateService()
      Returns:
      the bundleTemplateService
    • setBundleTemplateService

      public void setBundleTemplateService(de.hybris.platform.configurablebundleservices.bundle.BundleTemplateService bundleTemplateService)
      Parameters:
      bundleTemplateService - the bundleTemplateService to set