org.salespointframework.core.data
Class StockItemImpl

java.lang.Object
  extended by org.salespointframework.core.data.AbstractNameable
      extended by org.salespointframework.core.data.StockItemImpl
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<java.lang.Object>, Recoverable, DataBasketKeys, Nameable, SpItem, StockItem
Direct Known Subclasses:
StockImpl

public class StockItemImpl
extends AbstractNameable
implements StockItem, DataBasketKeys, Recoverable

Pure Java implementation of the StockItem interface. See the documentation for StockItem for a description of the semantics of this class.

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

Field Summary
 
Fields inherited from class org.salespointframework.core.data.AbstractNameable
m_ncContext, m_pcsPropertyListeners, SOME_PROPERTY
 
Fields inherited from interface org.salespointframework.core.data.interfaces.Nameable
NAME_PROPERTY
 
Fields inherited from interface org.salespointframework.core.data.interfaces.DataBasketKeys
CATALOG_ITEM_MAIN_KEY, STOCK_ITEM_MAIN_KEY
 
Constructor Summary
StockItemImpl(java.lang.String sName)
          Create a new StockItemImpl.
 
Method Summary
 java.lang.Object clone()
          Clone this StockItem.
 int compareTo(java.lang.Object o)
          Compare this StockItem to the given object.
 boolean equals(java.lang.Object o)
          Check whether this StockItem equals the given object.
 void firePropertyChanged()
          Signals persistence layer to update objects values
 CatalogItem getAssociatedItem(DataBasket db)
          Get the CatalogItem that is associated with this StockItem.
 StockItemImpl getShallowClone()
          Get a shallow clone of this item.
 StockImpl<?,?,?> getStock()
          Get the Stock that contains this StockItem.
 void recover(java.util.Map<java.lang.String,java.lang.Object> data, java.lang.Object recoveryContext, boolean reInit)
          Set the stock on recovery
protected  void setStock(StockImpl<?,?,?> sti)
          Set the Stock that contains this StockItem.
 java.lang.String toString()
          Return a String representation of the item.
 
Methods inherited from class org.salespointframework.core.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 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
 

Constructor Detail

StockItemImpl

public StockItemImpl(java.lang.String sName)
Create a new StockItemImpl.

Parameters:
sName - the name of the new item.
Method Detail

getStock

public StockImpl<?,?,?> getStock()
Get the Stock that contains this StockItem.

Specified by:
getStock in interface StockItem

getAssociatedItem

public CatalogItem getAssociatedItem(DataBasket db)
Get the CatalogItem that is associated with this StockItem.

If the StockItem has a Stock, the associated CatalogItem is the CatalogItem of the same name that is found in the Stock's associated Catalog. Otherwise, it is null.

Specified by:
getAssociatedItem in interface StockItem
Parameters:
db - the DataBasket used to determine visibility.

setStock

protected void setStock(StockImpl<?,?,?> sti)
Set the Stock that contains this StockItem.


clone

public java.lang.Object clone()
Clone this StockItem.

Specified by:
clone in interface StockItem
Overrides:
clone in class java.lang.Object

getShallowClone

public StockItemImpl getShallowClone()
Get a shallow clone of this item.

For a normal item, shallow and deep clones are identical, which is why the default implementation returns ((StockItemImpl) clone()). However, when making a shallow clone of a Stock, the individual StockItems will not be cloned.


equals

public boolean equals(java.lang.Object o)
Check whether this StockItem equals the given object.

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Compare this StockItem to the given object.

Specified by:
compareTo in interface java.lang.Comparable<java.lang.Object>
Throws:
java.lang.ClassCastException - if the given object cannot be converted into a StockItem.

toString

public java.lang.String toString()
Return a String representation of the item.

Overrides:
toString in class java.lang.Object

recover

public void recover(java.util.Map<java.lang.String,java.lang.Object> data,
                    java.lang.Object recoveryContext,
                    boolean reInit)
Set the stock on recovery

Specified by:
recover in interface Recoverable
Parameters:
data - field to value mapping
reInit - true, id recover was called more than one time on this object

firePropertyChanged

public void firePropertyChanged()
Signals persistence layer to update objects values