Class DefaultFreeSoftInventoryJobService

java.lang.Object
com.broadleafcommerce.inventory.job.freeinventory.service.DefaultFreeSoftInventoryJobService
All Implemented Interfaces:
FreeSoftInventoryJobService

public class DefaultFreeSoftInventoryJobService extends Object implements FreeSoftInventoryJobService
Default implementation of a free soft inventory job service.
Author:
Jacob Mitash
  • Field Details

    • DEFAULT_PAGE_SIZE

      protected static final int DEFAULT_PAGE_SIZE
      See Also:
    • DEFAULT_FREEABLE_TYPES

      protected static final Set<String> DEFAULT_FREEABLE_TYPES
  • Constructor Details

  • Method Details

    • freeSoftInventory

      public void freeSoftInventory(Duration minReservationAge, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: FreeSoftInventoryJobService
      Frees soft inventory reservations that are older than the minimum reservation duration.

      The minimum reservation duration is an expression of the minimum age a soft inventory reservation must be in order to be freed. For example, if the duration was 5 minutes and the time was 17:27, soft inventory reservations created before 17:22 would be freed (assuming they weren't converted to a different type of reservation).

      Specified by:
      freeSoftInventory in interface FreeSoftInventoryJobService
      Parameters:
      minReservationAge - the minimum age a reservation should exist before being a candidate for being freed
      context - the context to free soft inventory in
    • getMaxCreatedDate

      protected Instant getMaxCreatedDate(Duration minReservationAge)
      Get the maximum created date to consider for inventory transactions that should be freed.
      Parameters:
      minReservationAge - the minimum age the inventory transaction should be to be freed.
      Returns:
      the maximum date
    • getStartPageable

      protected org.springframework.data.domain.Pageable getStartPageable()
      Gets the starting pageable to be used for freeing inventory.
      Returns:
      the starting pageable
    • getPageSize

      protected int getPageSize()
      Gets the page size to use for freeing inventory.
      Returns:
      the page size
    • getFreeableTransactionTypes

      protected Set<String> getFreeableTransactionTypes()
      Gets the inventory transaction types that should be considered for freeing inventory.
      Returns:
      a set of inventory transaction types
    • getInventoryTransactionService

      protected InventoryTransactionService<InventoryTransaction> getInventoryTransactionService()
    • getAdjustmentService

      protected SkuInventoryAdjustmentService<SkuInventory> getAdjustmentService()
    • getEnvironment

      protected org.springframework.core.env.Environment getEnvironment()