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.
-
Field Summary
Fields inherited from class de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable
flexibleSearchService, modelService, sessionService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetAccommodation(String line) protected Stringprotected AccommodationOfferingServicegetAccommodations(String line) protected List<StockLevelModel>getAccommodationStockLevels(UpdateStockLevelsToAccommodationOfferingCronJobModel updateStockLevelsToAccommodationOfferingCronJobModel, List<AccommodationOfferingModel> accommodationOfferings) protected IntegergetAvailability(String line) protected intgetAvailabilityFromMap(Map<String, Integer> availabilityMap, String accommodation) protected Stringprotected de.hybris.platform.catalog.CatalogVersionServiceprotected de.hybris.platform.servicelayer.config.ConfigurationServiceprotected de.hybris.platform.servicelayer.model.ModelServiceprotected de.hybris.platform.product.ProductServiceprotected List<StockLevelModel>getProductStockLevels(UpdateStockLevelsToAccommodationOfferingCronJobModel updateStockLevelsToAccommodationOfferingCronJobModel, List<AccommodationOfferingModel> accommodationOfferings) protected BufferedReaderprotected Longprotected Booleanprotected intnormalizeValue(int value, Integer maxAvailability) parseAvailabilityFile(String availabilityDataFilePath) parseMappingFile(String mappingFilePath) Deprecated, for removal: This API element is subject to removal in a future version.Since 2003.de.hybris.platform.servicelayer.cronjob.PerformResultperform(UpdateStockLevelsToAccommodationOfferingCronJobModel updateStockLevelsToAccommodationOfferingCronJobModel) voidsetAccommodationOfferingService(AccommodationOfferingService accommodationOfferingService) voidsetBaseExtDir(String baseExtDir) voidsetCatalogVersionService(de.hybris.platform.catalog.CatalogVersionService catalogVersionService) voidsetConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) voidsetProductService(de.hybris.platform.product.ProductService productService) voidsetScheduledDays(Long scheduledDays) voidsetSetForceInStock(Boolean setForceInStock) protected voidsetStockLevelForAccommodation(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 algorithmprotected voidsetStockLevelForRoomRates(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.protected intsetupSimulatedAvailability(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.protected intsetupSimulatedAvailability(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.Methods inherited from class de.hybris.platform.servicelayer.cronjob.AbstractJobPerformable
clearAbortRequestedIfNeeded, isAbortable, isPerformable, setFlexibleSearchService, setModelService, setSessionService
-
Constructor Details
-
UpdateStockLevelsToAccommodationOfferingJob
public UpdateStockLevelsToAccommodationOfferingJob()
-
-
Method Details
-
perform
public de.hybris.platform.servicelayer.cronjob.PerformResult perform(UpdateStockLevelsToAccommodationOfferingCronJobModel updateStockLevelsToAccommodationOfferingCronJobModel) - Specified by:
performin interfacede.hybris.platform.servicelayer.cronjob.JobPerformable<UpdateStockLevelsToAccommodationOfferingCronJobModel>- Specified by:
performin classde.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
- Throws:
FileNotFoundException
-
parseAvailabilityFile
-
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 offeringdate- the date stock level will refer tomaxAvailability- the max availability that can be set in simulation modeavailabilityMap- a map linking accommodations codes and their actual availability (when provided)stockLevelsToSave-
-
setupSimulatedAvailability
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
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 datemaxAvailability- the max availability- Returns:
- simulated availability
-
normalizeValue
-
getAvailabilityFromMap
-
getAccommodations
-
getAccommodationOffering
-
getAvailability
-
getAccommodation
-
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 createdaccommodations- the list of products a stock level will be created forstockLevelsToSave-
-
getModelService
protected de.hybris.platform.servicelayer.model.ModelService getModelService()- Returns:
- the modelService
-
getAccommodationOfferingService
- Returns:
- the accommodationOfferingService
-
setAccommodationOfferingService
public void setAccommodationOfferingService(AccommodationOfferingService accommodationOfferingService) - Parameters:
accommodationOfferingService- the accommodationOfferingService to set
-
getBaseExtDir
- Returns:
- the baseExtDir
-
setBaseExtDir
- 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
- Returns:
- the scheduledDays
-
setScheduledDays
- Parameters:
scheduledDays- the scheduledDays to set
-
isSetForceInStock
- Returns:
- the setForceInStock
-
setSetForceInStock
- 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
-