Class UpdateStockLevelsToAccommodationOfferingJob

java.lang.Object
de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable<UpdateStockLevelsToAccommodationOfferingCronJobModel>
de.hybris.platform.travelservices.cronjob.UpdateStockLevelsToAccommodationOfferingJob
All Implemented Interfaces:
de.hybris.platform.servicelayer.cronjob.JobPerformable<UpdateStockLevelsToAccommodationOfferingCronJobModel>
Direct Known Subclasses:
ShoppingUpdateStockLevelsToAccommodationOfferingJob

public class UpdateStockLevelsToAccommodationOfferingJob extends de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable<UpdateStockLevelsToAccommodationOfferingCronJobModel>
The type Update stock levels to accommodation offering job.
  • Constructor Details

    • UpdateStockLevelsToAccommodationOfferingJob

      public UpdateStockLevelsToAccommodationOfferingJob()
  • Method Details

    • perform

      public de.hybris.platform.servicelayer.cronjob.PerformResult perform(UpdateStockLevelsToAccommodationOfferingCronJobModel updateStockLevelsToAccommodationOfferingCronJobModel)
      Specified by:
      perform in interface de.hybris.platform.servicelayer.cronjob.JobPerformable<UpdateStockLevelsToAccommodationOfferingCronJobModel>
      Specified by:
      perform in class de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable<UpdateStockLevelsToAccommodationOfferingCronJobModel>
    • getAccommodationStockLevels

      protected List<StockLevelModel> getAccommodationStockLevels(UpdateStockLevelsToAccommodationOfferingCronJobModel updateStockLevelsToAccommodationOfferingCronJobModel, List<AccommodationOfferingModel> accommodationOfferings)
    • getProductStockLevels

      protected List<StockLevelModel> getProductStockLevels(UpdateStockLevelsToAccommodationOfferingCronJobModel updateStockLevelsToAccommodationOfferingCronJobModel, List<AccommodationOfferingModel> accommodationOfferings)
    • parseMappingFile

      @Deprecated(since="2003", forRemoval=true) protected Map<String,List<String>> parseMappingFile(String mappingFilePath)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since 2003.
    • getReader

      protected BufferedReader getReader(String completePath) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • parseAvailabilityFile

      protected Map<String,Integer> parseAvailabilityFile(String availabilityDataFilePath)
    • setStockLevelForAccommodation

      protected void setStockLevelForAccommodation(AccommodationOfferingModel accommodationOffering, List<AccommodationModel> accommodations, LocalDateTime date, Integer maxAvailability, Map<String,Integer> availabilityMap, List<StockLevelModel> stockLevelsToSave)
      If a mapping file is provided stock levels are populated according to its content otherwise their availability is simulated by a populating algorithm
      Parameters:
      accommodationOffering - AccommodationOfferingModel to which the stockLevel has to be updated.
      accommodations - list of accommodations for the selected offering
      date - the date stock level will refer to
      maxAvailability - the max availability that can be set in simulation mode
      availabilityMap - a map linking accommodations codes and their actual availability (when provided)
      stockLevelsToSave -
    • setupSimulatedAvailability

      protected int setupSimulatedAvailability(Integer maxAvailability)
      Method that returns the int corresponding to the simulated availability, calculated using a Gaussian distribution with mean equals to maxAvailability / 2 and standard deviance equals to maxAvailability / 4. If the random number is falling outside the range [0, maxAvailability] the value 0 is return, in order to minimize the number of unavailable accommodations.
      Parameters:
      maxAvailability - the max availability
      Returns:
      simulated availability
    • setupSimulatedAvailability

      protected int setupSimulatedAvailability(LocalDateTime date, Integer maxAvailability)
      Method that returns the int corresponding to the simulated availability, calculated using a Gaussian distribution with mean and standard deviance equals to maxAvailability / 2 and then normalized using a date correction.
      Parameters:
      date - the date
      maxAvailability - the max availability
      Returns:
      simulated availability
    • normalizeValue

      protected int normalizeValue(int value, Integer maxAvailability)
    • getAvailabilityFromMap

      protected int getAvailabilityFromMap(Map<String,Integer> availabilityMap, String accommodation)
    • getAccommodations

      protected List<String> getAccommodations(String line)
    • getAccommodationOffering

      protected String getAccommodationOffering(String line)
    • getAvailability

      protected Integer getAvailability(String line)
    • getAccommodation

      protected String getAccommodation(String line)
    • setStockLevelForRoomRates

      protected void setStockLevelForRoomRates(AccommodationOfferingModel accommodationOffering, List<AccommodationModel> accommodations, List<StockLevelModel> stockLevelsToSave)
      This method creates a stock level entry for each room rate product belonging to a rate plan associated with any accommodations that belongs to the accommodation offering, only if SET_FORCE_IN_STOCK is set to true. In that case the stock level status will be set accordingly.
      Parameters:
      accommodationOffering - the accommodation offering where stock will be created
      accommodations - the list of products a stock level will be created for
      stockLevelsToSave -
    • getModelService

      protected de.hybris.platform.servicelayer.model.ModelService getModelService()
      Returns:
      the modelService
    • getAccommodationOfferingService

      protected AccommodationOfferingService getAccommodationOfferingService()
      Returns:
      the accommodationOfferingService
    • setAccommodationOfferingService

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

      protected String getBaseExtDir()
      Returns:
      the baseExtDir
    • setBaseExtDir

      public void setBaseExtDir(String baseExtDir)
      Parameters:
      baseExtDir - the baseExtDir to set
    • 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
    • getCatalogVersionService

      protected de.hybris.platform.catalog.CatalogVersionService getCatalogVersionService()
      Returns:
      the catalogVersionService
    • setCatalogVersionService

      public void setCatalogVersionService(de.hybris.platform.catalog.CatalogVersionService catalogVersionService)
      Parameters:
      catalogVersionService - the catalogVersionService to set
    • getScheduledDays

      protected Long getScheduledDays()
      Returns:
      the scheduledDays
    • setScheduledDays

      public void setScheduledDays(Long scheduledDays)
      Parameters:
      scheduledDays - the scheduledDays to set
    • isSetForceInStock

      protected Boolean isSetForceInStock()
      Returns:
      the setForceInStock
    • setSetForceInStock

      public void setSetForceInStock(Boolean setForceInStock)
      Parameters:
      setForceInStock - the setForceInStock to set
    • getConfigurationService

      protected de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService()
      Returns:
      the configurationService
    • setConfigurationService

      public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService)
      Parameters:
      configurationService - the configurationService to set