org.salespointframework.core.data.interfaces
Interface CountingStock<T extends StockItem,CT extends CatalogItem>

All Superinterfaces:
java.lang.Cloneable, java.lang.Comparable<java.lang.Object>, DataBasketEntryDestination, DataBasketEntrySource, DatasourceChangeListener, ExternalModificationListener, java.lang.Iterable<T>, Nameable, SpAggregate, SpItem, Stock<T,CT>, StockItem
All Known Subinterfaces:
MoneyBag
All Known Implementing Classes:
CountingStockFilter, CountingStockImpl, MoneyBagFilter, MoneyBagImpl

public interface CountingStock<T extends StockItem,CT extends CatalogItem>
extends Stock<T,CT>, SpAggregate

A Stock that counts for each CatalogItem in the associated Catalog how many objects of that type are actually available.

In contrast to StoringStocks, the StockItems for the same key have no differences when using CountingStocks. Therefore, only two pieces of information are needed: the key and the number of items for that key.

CountingStocks are by far the more common type of Stock.

Since:
v2.0
Version:
2.0 18/08/1999
Author:
Steffen Zschaler

Field Summary
 
Fields inherited from interface org.salespointframework.core.data.interfaces.Nameable
NAME_PROPERTY
 
Method Summary
 void add(java.lang.String sKey, int nCount, DataBasket db)
          Add a number of items of a given key to the Stock.
 void remove(java.lang.String sKey, int nCount, DataBasket db)
          Remove a number of items of a given key from the Stock.
 
Methods inherited from interface org.salespointframework.core.data.interfaces.Stock
add, addStock, contains, contains, containsStock, countItems, fillStockWithValue, get, getCatalog, iterator, keySet, remove, remove, size, sumStock
 
Methods inherited from interface org.salespointframework.core.data.interfaces.StockItem
clone, getAssociatedItem, getStock
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.salespointframework.core.data.interfaces.Nameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from interface org.salespointframework.core.data.interfaces.SpItem
getName
 
Methods inherited from interface org.salespointframework.core.data.events.DatasourceChangeListener
DatasourceChanged
 
Methods inherited from interface org.salespointframework.core.data.events.ExternalModificationListener
externalModificationOccurred
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

add

void add(java.lang.String sKey,
         int nCount,
         DataBasket db)
Add a number of items of a given key to the Stock.

As with any Stock the added items will not at once be visible to users of other DataBaskets.

In general the method behaves as though it would call Stock.add(T, org.salespointframework.core.data.interfaces.DataBasket) nCount times. Especially, the same exceptions might occur and the same constraints hold.

Parameters:
sKey - the key for which to add a number of items.
nCount - how many items are to be added?
db - the DataBasket relative to which the adding is performed.
Throws:
java.lang.IllegalArgumentException - if nCount <= 0.
CatalogConflictException - if the key cannot be found in the Catalog.

remove

void remove(java.lang.String sKey,
            int nCount,
            DataBasket db)
            throws VetoException
Remove a number of items of a given key from the Stock.

In general the method behaves as though it would call Stock.remove(java.lang.String, org.salespointframework.core.data.interfaces.DataBasket) nCount times. Especially, the same exceptions might occur and the same constraints hold.

Parameters:
sKey - the key for which to remove a number of items.
nCount - how many items are to be removed?
db - the DataBasket relative to which the removal is performed.
Throws:
VetoException - if a listener vetos the removal.
NotEnoughElementsException - if there are not enough elements to fulfill the request. If this exception is thrown no items will have been removed.
java.lang.IllegalArgumentException - if nCount <= 0