Class AccommodationAvailabilityHandler

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

public class AccommodationAvailabilityHandler extends Object implements AccommodationDetailsHandler
Concrete implementation of AccommodationDetailsHandler handling accommodation availability
  • Constructor Details

    • AccommodationAvailabilityHandler

      public AccommodationAvailabilityHandler()
  • 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(RatePlanModel ratePlan, LocalDateTime date, List<Integer> stockLevels, AccommodationOfferingModel accommodationOfferingModel, AccommodationModel accommodation)
      This methods collect availabilities from accommodation and room rate products given a certain date. For the given rate plan linked to the given accommodation 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:
      ratePlan - the RatePlanModel currently taken into consideration
      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
    • 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(RatePlanModel ratePlanModel, RoomStayData roomStay, List<Integer> stockLevels)
      This method creates a RatePlanData object and set the corresponding availability, calculated as the minimum among the values retrieved. The data object is then set against the relative RoomTypeData
      Parameters:
      ratePlanModel - ratePlanModel to be created
      roomStay - to be updated
      stockLevels - list of values representing availability
    • getProductService

      protected de.hybris.platform.product.ProductService getProductService()
    • setProductService

      public void setProductService(de.hybris.platform.product.ProductService productService)
    • getCommerceStockService

      protected TravelCommerceStockService getCommerceStockService()
    • setCommerceStockService

      public void setCommerceStockService(TravelCommerceStockService commerceStockService)
    • getAccommodationService

      protected AccommodationService getAccommodationService()
    • setAccommodationService

      public void setAccommodationService(AccommodationService accommodationService)
    • getEnumerationService

      protected de.hybris.platform.enumeration.EnumerationService getEnumerationService()
    • setEnumerationService

      public void setEnumerationService(de.hybris.platform.enumeration.EnumerationService enumerationService)
    • getAccommodationOfferingService

      protected AccommodationOfferingService getAccommodationOfferingService()
      Returns:
      the accommodationOfferingService
    • setAccommodationOfferingService

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