com.elasticpath.domain.catalog.impl
Class InventoryImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractValueObjectImpl
              extended by com.elasticpath.domain.catalog.impl.InventoryImpl
All Implemented Interfaces:
Inventory, EpDomain, Persistence, ValueObject, java.io.Serializable

public class InventoryImpl
extends AbstractValueObjectImpl
implements Inventory

Represents inventory information about a ProductSku.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
InventoryImpl()
           
 
Method Summary
 void decrementInventory(int quantity)
          Decrement the inventory by the given quantity.
 int getAvailableQuantity()
          Get the available quantity.
 int getQuantityOnHand()
          Get the quantity on hand.
 int getReorderMinimum()
          Get the reorder minimum quantity.
 int getReservedQuantity()
          Get the reserved quantity.
 java.util.Date getRestockDate()
          Get the expected date when this inventory item will be restocked.
 boolean hasSufficientInventory(int quantity)
          Returns true if there is sufficient stock of this Inventory to sell the specified quantity of items.
 boolean isInfiniteQuantityOnHand()
          Returns true if the quantity on hand is presumed to allways be infinite.
 boolean isVisibleWhenOutOfStock()
          True if this Inventory is visible in the when out of stock.
 void setInfiniteQuantityOnHand(boolean isInfiniteQuantityOnHand)
          Set if the quantity on hand is presumed to be infinite.
 void setQuantityOnHand(int quantityOnHand)
          Set the quantity on hand.
 void setReorderMinimum(int reorderMinimum)
          Set the reorder minimum quantity.
 void setReservedQuantity(int reservedQuantity)
          Set the reserved quantity.
 void setRestockDate(java.util.Date restockDate)
          Set the restock date.
 void setVisibleWhenOutOfStock(boolean isVisibleWhenOutOfStock)
          Set to true if this Inventory is visible in the when out of stock.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

InventoryImpl

public InventoryImpl()
Method Detail

decrementInventory

public void decrementInventory(int quantity)
Decrement the inventory by the given quantity.

Specified by:
decrementInventory in interface Inventory
Parameters:
quantity - the qunatity to decrement the Inventory by
Throws:
InsufficientInventoryException - if there is insufficient inventory

getAvailableQuantity

public int getAvailableQuantity()
Get the available quantity. This is the quantity on hand - the reserved quantity

Specified by:
getAvailableQuantity in interface Inventory
Returns:
the quantity on hand

getQuantityOnHand

public int getQuantityOnHand()
Get the quantity on hand.

Specified by:
getQuantityOnHand in interface Inventory
Returns:
the quantity on hand

getReorderMinimum

public int getReorderMinimum()
Get the reorder minimum quantity. This inventory item should be reported as below minimum quantity if the quantity on hand is below this value.

Specified by:
getReorderMinimum in interface Inventory
Returns:
the reorder minimum quantity

getReservedQuantity

public int getReservedQuantity()
Get the reserved quantity. Skus should not be sold if the quantity is below the reserved quantity.

Specified by:
getReservedQuantity in interface Inventory
Returns:
the reserved quantity

getRestockDate

public java.util.Date getRestockDate()
Get the expected date when this inventory item will be restocked.

Specified by:
getRestockDate in interface Inventory
Returns:
the restock date

hasSufficientInventory

public boolean hasSufficientInventory(int quantity)
Returns true if there is sufficient stock of this Inventory to sell the specified quantity of items.

Specified by:
hasSufficientInventory in interface Inventory
Parameters:
quantity - the quantity of items to check for availability
Returns:
true if quantity items can be sold

isInfiniteQuantityOnHand

public boolean isInfiniteQuantityOnHand()
Returns true if the quantity on hand is presumed to allways be infinite.

Specified by:
isInfiniteQuantityOnHand in interface Inventory
Returns:
true if QuantityOnHand is presumed to be infinite

isVisibleWhenOutOfStock

public boolean isVisibleWhenOutOfStock()
True if this Inventory is visible in the when out of stock.

Specified by:
isVisibleWhenOutOfStock in interface Inventory
Returns:
true if this SKU is visible in the when out of stock

setInfiniteQuantityOnHand

public void setInfiniteQuantityOnHand(boolean isInfiniteQuantityOnHand)
Set if the quantity on hand is presumed to be infinite.

Specified by:
setInfiniteQuantityOnHand in interface Inventory
Parameters:
isInfiniteQuantityOnHand - set to true if infinite on hand quantity is required

setQuantityOnHand

public void setQuantityOnHand(int quantityOnHand)
Set the quantity on hand.

Specified by:
setQuantityOnHand in interface Inventory
Parameters:
quantityOnHand - the quantity on hand

setReorderMinimum

public void setReorderMinimum(int reorderMinimum)
Set the reorder minimum quantity.

Specified by:
setReorderMinimum in interface Inventory
Parameters:
reorderMinimum - the reorder minimum

setReservedQuantity

public void setReservedQuantity(int reservedQuantity)
Set the reserved quantity.

Specified by:
setReservedQuantity in interface Inventory
Parameters:
reservedQuantity - the reserved quantity

setRestockDate

public void setRestockDate(java.util.Date restockDate)
Set the restock date.

Specified by:
setRestockDate in interface Inventory
Parameters:
restockDate - the restock date

setVisibleWhenOutOfStock

public void setVisibleWhenOutOfStock(boolean isVisibleWhenOutOfStock)
Set to true if this Inventory is visible in the when out of stock.

Specified by:
setVisibleWhenOutOfStock in interface Inventory
Parameters:
isVisibleWhenOutOfStock - true if visible