Großmarkt

market
Class CSOffer

java.lang.Object
  |
  +--data.AbstractNameable
        |
        +--data.ooimpl.StockItemImpl
              |
              +--data.ooimpl.StockImpl
                    |
                    +--data.ooimpl.CountingStockImpl
                          |
                          +--market.CSOffer
All Implemented Interfaces:
Cloneable, Comparable, CountingStock, DataBasketEntryDestination, DataBasketEntrySource, DataBasketKeys, ListenableStock, Nameable, NameContext, SelfManagingDBEDestination, SelfManagingDBESource, Serializable, Stock, StockItem

public class CSOffer
extends CountingStockImpl

CountingStockImpl that always contains the same keys as its CArticleCatalog source catalog, even if no StockItems have been added or some have been removed completely. Normally the keys of StockItems are removed when their number drops to zero. But this prevents StockItems with an amount of zero to be displayed in tables.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class data.ooimpl.CountingStockImpl
m_cclReferentialIntegrityListener
 
Fields inherited from class data.ooimpl.StockImpl
m_cclEditListener, m_ciCatalog, m_cinlCatalogItemNameListener, m_dbCatalogValidator, m_lhListeners, m_sclEditCreatorListener
 
Fields inherited from class data.AbstractNameable
m_ncContext, m_pcsPropertyListeners
 
Fields inherited from interface data.Nameable
NAME_PROPERTY
 
Fields inherited from interface data.DataBasketKeys
CATALOG_ITEM_MAIN_KEY, STOCK_ITEM_MAIN_KEY
 
Constructor Summary
CSOffer(String sName, CatalogImpl cat)
           
 
Method Summary
 void addZeros(DataBasket db)
          Checks, which CatalogItems have no appropriate StockItems.
 void changeArticleCatalog(Catalog cat)
          Changes the StockItems of this stock according to a new Catalog

All elements that appear in both the old and the new Catalog will be kept.
 Object clone()
           
 void remove(String sKey, int nCount, DataBasket db)
          Removes StockItems from the Stock.
 
Methods inherited from class data.ooimpl.CountingStockImpl
add, add, addStock, commitAdd, commitRemove, contains, containsStock, countItems, createPeer, get, internalSetCatalog, remove, remove, rollbackAdd, rollbackRemove, toString
 
Methods inherited from class data.ooimpl.StockImpl
addStockChangeListener, checkNameChange, compareTo, contains, fillShallowClone, fillStockWithValue, fireCanEditStockItems, fireCanRemoveStockItems, fireEditingStockItems, fireStockItemsAddCommit, fireStockItemsAdded, fireStockItemsAddRollback, fireStockItemsEditCommit, fireStockItemsEditRollback, fireStockItemsRemoveCommit, fireStockItemsRemoved, fireStockItemsRemoveRollback, getCatalog, getEditingItemsContainer, getItemsContainer, getItemsLock, getNCMonitor, getRefIntegrEditContainer, getRefIntegrItemsContainer, getShallowClone, getTemporaryAddedItemsContainer, getTemporaryRemovedItemsContainer, iterator, keySet, nameHasChanged, prepareReferentialIntegrity, removeStockChangeListener, setEditingItemsContainer, setItemsContainer, setRefIntegrEditContainer, setRefIntegrItemsContainer, setStock, setTemporaryAddedItemsContainer, setTemporaryRemovedItemsContainer, size, sumStock
 
Methods inherited from class data.ooimpl.StockItemImpl
equals, getAssociatedItem, getStock
 
Methods inherited from class data.AbstractNameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface data.Stock
contains, fillStockWithValue, getCatalog, iterator, keySet, size, sumStock
 
Methods inherited from interface data.StockItem
getAssociatedItem, getStock
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface data.Nameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 

Constructor Detail

CSOffer

public CSOffer(String sName,
               CatalogImpl cat)
Parameters:
sName - the Stock's name.
cat - the source catalog.
Method Detail

remove

public void remove(String sKey,
                   int nCount,
                   DataBasket db)
Removes StockItems from the Stock. If the item has been removed completely, its index is re-added and its amount is set to 0.

Specified by:
remove in interface CountingStock
Overrides:
remove in class CountingStockImpl
Parameters:
sKey - the ID of the StockItem to be removed.
nCount - the number of Items to be removed.
db - the belonging DataBasket.

addZeros

public void addZeros(DataBasket db)
Checks, which CatalogItems have no appropriate StockItems. If one is found the key of the item is added to the stock. The number of StockItems is set to 0.

Parameters:
db - the DataBasket to be used.

changeArticleCatalog

public void changeArticleCatalog(Catalog cat)
                          throws VetoException
Changes the StockItems of this stock according to a new Catalog

All elements that appear in both the old and the new Catalog will be kept.
All elements that do not appear in the new Catalog will be deleted.
All elements that have not appeared in the old Catalog will be added and their number is set to 0.
This method is used by the filters that filter Stocks by their item's category.

Parameters:
cat - the new Catalog to be set.
VetoException

clone

public Object clone()
Specified by:
clone in interface StockItem
Overrides:
clone in class StockImpl
Returns:
a clone of CSOffer with its StockItems.

Großmarkt