001 package data.ooimpl; 002 003 import data.*; // This is to help javadoc... 004 005 /** 006 * DataBasketEntry that describes operations with StoringStock's items. The 007 * fields of the <code>DataBasketEntry</code> are set as follows: 008 * 009 * <table border=1> 010 * <tr><td><strong>Field</strong></td><td><strong>Value</strong></td></tr> 011 * <tr><td>{@link DataBasketEntry#getMainKey main key}</td> 012 * <td>{@link DataBasketKeys#STOCK_ITEM_MAIN_KEY STOCK_ITEM_MAIN_KEY} 013 * </td> 014 * </tr> 015 * <tr><td>{@link DataBasketEntry#getSecondaryKey secondary key}</td> 016 * <td>{@link StockItem#getName name} of the StockItem in question</td> 017 * </tr> 018 * <tr><td>{@link DataBasketEntry#getSource source}</td> 019 * <td>{@link Stock source stock}<td> 020 * </tr> 021 * <tr><td>{@link DataBasketEntry#getDestination destination}</td> 022 * <td>{@link Stock destination stock}<td> 023 * </tr> 024 * <tr><td>{@link DataBasketEntry#getValue value}</td> 025 * <td>{@link StockItem} that was moved.<td> 026 * </tr> 027 * </table> 028 * 029 * @author Steffen Zschaler 030 * @version 2.0 19/09/1999 031 * @since v2.0 032 */ 033 public class StoringStockItemDBEntry extends StockItemDBEntry { 034 035 /** 036 * Create a new StoringStockItemDBEntry. 037 * 038 * @param sstiSource the source Stock. 039 * @param sstiDest the destination Stock. 040 * @param siiItem the item that was operated on. 041 */ 042 public StoringStockItemDBEntry(StoringStockImpl sstiSource, StoringStockImpl sstiDest, 043 StockItemImpl siiItem) { 044 super(siiItem.getName(), sstiSource, sstiDest, siiItem); 045 } 046 047 /** 048 * Rollback the destination part of the operation described by this {@link data.DataBasketEntry}. 049 * 050 * <p>The method will correctly update the underlying DataBasket.</p> 051 * 052 * <p><strong>Attention</strong>: The method is public as an implementation detail and should not be called 053 * directly.</p> 054 * 055 * @override Never 056 */ 057 public void rollbackDestination() { 058 DataBasketEntryImpl dbe = new StoringStockItemDBEntry(null, (StoringStockImpl)getDestination(), 059 (StockItemImpl)getValue()); 060 061 dbe.setOwner(m_dbiOwner); 062 063 m_dbedDest = null; 064 065 dbe.rollback(); 066 } 067 068 /** 069 * Commit the source part of the operation described by this {@link data.DataBasketEntry}. 070 * 071 * <p>The method will correctly update the underlying DataBasket.</p> 072 * 073 * <p><strong>Attention</strong>: The method is public as an implementation detail and should not be called 074 * directly.</p> 075 * 076 * @override Never 077 */ 078 public void commitSource() { 079 DataBasketEntryImpl dbe = new StoringStockItemDBEntry((StoringStockImpl)getSource(), null, 080 (StockItemImpl)getValue()); 081 dbe.setOwner(m_dbiOwner); 082 083 m_dbesSource = null; 084 085 dbe.commit(); 086 } 087 }