Class SkuInventory

java.lang.Object
com.broadleafcommerce.inventory.domain.SkuInventory
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable

public class SkuInventory extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware
See Also:
  • Constructor Details

    • SkuInventory

      public SkuInventory()
  • Method Details

    • hasChildren

      public boolean hasChildren()
      Additional getter for hasChildren for readability.

      Intentionally not using Accessors.fluent() to follow JavaBeans Specification.

    • getQuantityOnOrder

      public Integer getQuantityOnOrder()
      Don't return any quantity on order if future stock is disabled.
    • updateQuantityAvailable

      public void updateQuantityAvailable()
      Calculates the quantity available by subtracting safetyStock and quantityReserved from the summation of quantityOnHand and quantityOnOrder. 0 is returned if the result is negative, which can happen since safetyStock is an indicator of the desired amount of the item that is not for sale and therefore can be greater than the actual quantity on hand.

      The system will only consider an item available if the "(quantity on hand + quantity on order) - quantity reserved" is greater than the safety stock.

    • getId

      public String getId()
      This is the contextId of the Sku Inventory record.
    • getQuantityAvailable

      public Integer getQuantityAvailable()
      Summary field to indicate how many are available at this location. This is a calculated field (quantityOnHand - quantityReserved - safetyStock) set upon creation and update, this should not be manually set.
      See Also:
    • getQuantityReserved

      public Integer getQuantityReserved()
      Number of items that have been reserved but that have not been fulfilled.
      See Also:
    • getFutureQuantityReserved

      public Integer getFutureQuantityReserved()
      Number of items that have been reserved in the future but do not yet have the quantity on hand to fulfill.
      See Also:
    • getQuantityOnHand

      public Integer getQuantityOnHand()
      Number of physical items that are expected to be available if an inventory count was done.
      See Also:
    • getSafetyStock

      public Integer getSafetyStock()
      A value that indicates a desired amount of the item that is not for sale.
      See Also:
    • isFutureStockEnabled

      public boolean isFutureStockEnabled()
      Whether or not this inventory entry should allow configuration of future stock. For example, if configuration of preorder or backorder quantities is desired, set this to true.
    • isFutureStockLimited

      public boolean isFutureStockLimited()
      Whether or not the future stock is limited. If set to false, no availability checks will be made when reserving future stock.
    • getFutureStockType

      public String getFutureStockType()
      The type of future stock that is configured for this SKU inventory.
    • getExpectedFutureRestockDate

      public Instant getExpectedFutureRestockDate()
      The expected date for the configured future stock to be available.
    • getInventoryLocationContextId

      public String getInventoryLocationContextId()
      The ID of the InventoryLocation associated with this SkuInventory record.
    • getSkuRef

      public SkuRef getSkuRef()
      A soft reference to the SKU for which this inventory is managed.
    • isSerialized

      public boolean isSerialized()
      Informs the system that this is a serialized (aka detail) record.

      Consider stadium suites at a football game, there may be 10 gold suites, represented with SKU FOOTBALL-GM1-GOLD-SUITE. Serialized sku inventories are used to represent each individual suite (suite 1-10), in which case the getSerializationValue() would be 1, 2, and so on.

    • isHasChildren

      public boolean isHasChildren()
      Informs the system that this sku inventory is a parent.

      Consider stadium suites at a football game, there may be 10 gold suites, represented with SKU FOOTBALL-GM1-GOLD-SUITE. A parent sku inventory is used to represent the inventory for all the gold suites, without specifying any suite number. This is useful when selling suites without assigning a specific suite number to a given order, defers the suite assignment till closer to the event date.

    • getParentSkuInventoryId

      public String getParentSkuInventoryId()
      The parent sku inventory id.

      Serialized records must have a parent representing a non-serialized SkuInventory.

      See Also:
      • serialized
    • getSerializationValue

      public String getSerializationValue()
      The value of the serialized sku inventory.

      For example, this can be "100" when representing inventory for suite 100 in a stadium.

      This value is required for records where isSerialized() is true.

      See Also:
      • serialized
    • getVendorRef

      @Nullable public String getVendorRef()
      Soft reference to the vendor associated with this sku inventory. This value can be null, in which case, no vendor is associated.
      Returns:
      Soft reference to the vendor associated with this location.
    • getArchivalReason

      public String getArchivalReason()
      Stores the reason why a particular sku_inventory was deleted/archived. Used to identify the records that have been deleted/archived as a result of their inventory_location being archived. For such records, the archivalReason would be DefaultSkuInventoryArchivalReasons.LOCATION_ARCHIVED. In other cases, it would be null by default.
    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
    • setId

      public void setId(String id)
      This is the contextId of the Sku Inventory record.
    • setQuantityAvailable

      public void setQuantityAvailable(Integer quantityAvailable)
      Summary field to indicate how many are available at this location. This is a calculated field (quantityOnHand - quantityReserved - safetyStock) set upon creation and update, this should not be manually set.
      See Also:
    • setQuantityReserved

      public void setQuantityReserved(Integer quantityReserved)
      Number of items that have been reserved but that have not been fulfilled.
      See Also:
    • setFutureQuantityReserved

      public void setFutureQuantityReserved(Integer futureQuantityReserved)
      Number of items that have been reserved in the future but do not yet have the quantity on hand to fulfill.
      See Also:
    • setQuantityOnHand

      public void setQuantityOnHand(Integer quantityOnHand)
      Number of physical items that are expected to be available if an inventory count was done.
      See Also:
    • setQuantityOnOrder

      public void setQuantityOnOrder(Integer quantityOnOrder)
      Number of items that have been ordered and are expected to arrive in the warehouse.
      See Also:
    • setSafetyStock

      public void setSafetyStock(Integer safetyStock)
      A value that indicates a desired amount of the item that is not for sale.
      See Also:
    • setFutureStockEnabled

      public void setFutureStockEnabled(boolean futureStockEnabled)
      Whether or not this inventory entry should allow configuration of future stock. For example, if configuration of preorder or backorder quantities is desired, set this to true.
    • setFutureStockLimited

      public void setFutureStockLimited(boolean futureStockLimited)
      Whether or not the future stock is limited. If set to false, no availability checks will be made when reserving future stock.
    • setFutureStockType

      public void setFutureStockType(String futureStockType)
      The type of future stock that is configured for this SKU inventory.
    • setExpectedFutureRestockDate

      public void setExpectedFutureRestockDate(Instant expectedFutureRestockDate)
      The expected date for the configured future stock to be available.
    • setInventoryLocationContextId

      public void setInventoryLocationContextId(String inventoryLocationContextId)
      The ID of the InventoryLocation associated with this SkuInventory record.
    • setSkuRef

      public void setSkuRef(SkuRef skuRef)
      A soft reference to the SKU for which this inventory is managed.
    • setSerialized

      public void setSerialized(boolean serialized)
      Informs the system that this is a serialized (aka detail) record.

      Consider stadium suites at a football game, there may be 10 gold suites, represented with SKU FOOTBALL-GM1-GOLD-SUITE. Serialized sku inventories are used to represent each individual suite (suite 1-10), in which case the getSerializationValue() would be 1, 2, and so on.

    • setHasChildren

      public void setHasChildren(boolean hasChildren)
      Informs the system that this sku inventory is a parent.

      Consider stadium suites at a football game, there may be 10 gold suites, represented with SKU FOOTBALL-GM1-GOLD-SUITE. A parent sku inventory is used to represent the inventory for all the gold suites, without specifying any suite number. This is useful when selling suites without assigning a specific suite number to a given order, defers the suite assignment till closer to the event date.

    • setParentSkuInventoryId

      public void setParentSkuInventoryId(String parentSkuInventoryId)
      The parent sku inventory id.

      Serialized records must have a parent representing a non-serialized SkuInventory.

      See Also:
      • serialized
    • setSerializationValue

      public void setSerializationValue(String serializationValue)
      The value of the serialized sku inventory.

      For example, this can be "100" when representing inventory for suite 100 in a stadium.

      This value is required for records where isSerialized() is true.

      See Also:
      • serialized
    • setVendorRef

      public void setVendorRef(@Nullable String vendorRef)
      Soft reference to the vendor associated with this sku inventory. This value can be null, in which case, no vendor is associated.
      Parameters:
      vendorRef - Soft reference to the vendor associated with this location.
    • setArchivalReason

      public void setArchivalReason(String archivalReason)
      Stores the reason why a particular sku_inventory was deleted/archived. Used to identify the records that have been deleted/archived as a result of their inventory_location being archived. For such records, the archivalReason would be DefaultSkuInventoryArchivalReasons.LOCATION_ARCHIVED. In other cases, it would be null by default.
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object