SalesPoint Framework v3.1

data.ooimpl
Class DataBasketEntryImpl

java.lang.Object
  extended bydata.ooimpl.DataBasketEntryImpl
All Implemented Interfaces:
DataBasketEntry, DataBasketKeys, Loggable, Serializable
Direct Known Subclasses:
CatalogItemDataBasketEntry, StockItemDBEntry

public class DataBasketEntryImpl
extends Object
implements DataBasketEntry, Loggable, Serializable

Basic simple implementation of the DataBasketEntry interface. DataBasketEntries may be coalesced, meaning that two separate operations may be expressed by one DataBasketEntry, if this is possible. Applications that inspect DataBasketEntries directly should not make assumptions about whether or not they have been coalesced.

Since:
v2.0
Author:
Steffen Zschaler
See Also:
Serialized Form

Field Summary
protected  DataBasketEntryDestination m_dbedDest
          The destination of the operation.
protected  DataBasketEntrySource m_dbesSource
          The source of the operation.
protected  DataBasketImpl m_dbiOwner
          The DataBasket owning this entry..
protected  boolean m_fHandled
          true if the entry was commited or rolled back completely.
protected  Object m_oValue
          The object moved by the operation.
protected  String m_sMainKey
          The entry's main key.
protected  String m_sSecondaryKey
          The entry's secondary key.
 
Fields inherited from interface data.DataBasketKeys
CATALOG_ITEM_MAIN_KEY, STOCK_ITEM_MAIN_KEY
 
Constructor Summary
DataBasketEntryImpl(String sMainKey, String sSecondaryKey, DataBasketEntrySource dbesSource, DataBasketEntryDestination dbedDest, Object oValue)
          Create a new DataBasketEntryImpl.
 
Method Summary
 void commit()
          Commit the operation.
 DataBasketEntryDestination getDestination()
          Get the entry's destination.
 LogEntry getLogData()
          Return a LogEntry that describes this DataBasketEntry.
 String getMainKey()
          Get the entry's main key.
 DataBasket getOwner()
          Return the DataBasket containing this DataBasketEntry.
 String getSecondaryKey()
          Get the entry's secondary key.
 DataBasketEntrySource getSource()
          Get the entry's source.
 Object getValue()
          Get the entry's value, i.e.
 boolean isHandled()
          Return true, if the entry has been either completely commited or rolled back.
 void rollback()
          Rollback the operation.
 void setOwner(DataBasket dbOwner)
          Set the DataBasket owning this DataBasketEntry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_dbesSource

protected DataBasketEntrySource m_dbesSource
The source of the operation.


m_dbedDest

protected DataBasketEntryDestination m_dbedDest
The destination of the operation.


m_oValue

protected Object m_oValue
The object moved by the operation.


m_sMainKey

protected String m_sMainKey
The entry's main key.


m_sSecondaryKey

protected String m_sSecondaryKey
The entry's secondary key.


m_fHandled

protected boolean m_fHandled
true if the entry was commited or rolled back completely.


m_dbiOwner

protected DataBasketImpl m_dbiOwner
The DataBasket owning this entry..

Constructor Detail

DataBasketEntryImpl

public DataBasketEntryImpl(String sMainKey,
                           String sSecondaryKey,
                           DataBasketEntrySource dbesSource,
                           DataBasketEntryDestination dbedDest,
                           Object oValue)
Create a new DataBasketEntryImpl.

Parameters:
sMainKey - the entry's main key.
sSecondaryKey - the entry's secondary key.
dbesSource - the operation's source. Assumed to be a SelfManagingDBESource.
dbedDest - the operation's destination. Assumed to be a SelfManagingDBEDestination.
oValue - the object moved by the operation.
Method Detail

rollback

public void rollback()
Rollback the operation. This is done by first calling SelfManagingDBEDestination.rollbackAdd(data.DataBasket, data.DataBasketEntry) in the destination and then SelfManagingDBESource.rollbackRemove(data.DataBasket, data.DataBasketEntry) in the source of the entry.

Specified by:
rollback in interface DataBasketEntry
Override:
Never

commit

public void commit()
Commit the operation. This is done by first calling SelfManagingDBESource.commitRemove(data.DataBasket, data.DataBasketEntry) in the source and then SelfManagingDBEDestination.commitAdd(data.DataBasket, data.DataBasketEntry) in the destination of the entry.

Specified by:
commit in interface DataBasketEntry
Override:
Never

setOwner

public void setOwner(DataBasket dbOwner)
Set the DataBasket owning this DataBasketEntry.

This method is public as an implementation detail and must not be called directly.

Specified by:
setOwner in interface DataBasketEntry
Parameters:
dbOwner - the DataBasket that owns this DataBasketEntry. Can be null.
Override:
Never

getOwner

public DataBasket getOwner()
Return the DataBasket containing this DataBasketEntry. Initially null. Once setOwner(data.DataBasket) has been called, always returns the last value of the dbOwner parameter passed to setOwner.

Specified by:
getOwner in interface DataBasketEntry
Returns:
the DataBasket containing this DataBasketEntry.

getSource

public DataBasketEntrySource getSource()
Get the entry's source.

Specified by:
getSource in interface DataBasketEntry
Override:
Never

getDestination

public DataBasketEntryDestination getDestination()
Get the entry's destination.

Specified by:
getDestination in interface DataBasketEntry
Override:
Never

getValue

public Object getValue()
Get the entry's value, i.e. the object that was moved by the operation.

Specified by:
getValue in interface DataBasketEntry
Override:
Never

getMainKey

public String getMainKey()
Get the entry's main key.

Specified by:
getMainKey in interface DataBasketEntry
Override:
Never

getSecondaryKey

public String getSecondaryKey()
Get the entry's secondary key.

Specified by:
getSecondaryKey in interface DataBasketEntry
Override:
Never

isHandled

public boolean isHandled()
Return true, if the entry has been either completely commited or rolled back.

Specified by:
isHandled in interface DataBasketEntry
Override:
Never

getLogData

public LogEntry getLogData()
Return a LogEntry that describes this DataBasketEntry.

Specified by:
getLogData in interface Loggable
Returns:
the data to be stored in the log file.
Override:
Always The default implementation is generic and therefore usually not optimal for a subclass implementation.

SalesPoint Framework v3.1