|
SalesPoint Framework v3.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--data.ooimpl.DataBasketImpl
Pure Java implementation of the DataBasketImpl.SubDataBasket
interface.
This DataBasket implementation can be used together with the Catalog and
Stock implementations that come with the framework as well as with any other data
container that manages all its internal structure on its own, instead of delegating them, e.g. to a data
base. For a data base backing you should use other implementations of Stock
, Catalog
and
DataBasketImpl.SubDataBasket
, but these are not yet part of the framework.
Inner Class Summary | |
static class |
DataBasketImpl.DataBasketImplLogEntry
A LogEntry that describes an action on a DataBasket. |
protected static class |
DataBasketImpl.SubDataBasket
Internal helper class used by DataBasketImpl , representing a subbasket of a DataBasket . |
Field Summary | |
static int |
COMMIT_ACTION
Action constant for log(int, log.Loggable) . |
static int |
EXCHANGE_REMOVE_ACTION
Action constant for log(int, log.Loggable) . |
static LogEntryFilter |
LOGENTRYFILTER_COMMIT_ACTIONS
A LogEntryFilter that will accept only LogEntries that were produced by a DataBasketImpl and that describe a commit action. |
static LogEntryFilter |
LOGENTRYFILTER_DATABASKETIMPLACTIONS
A LogEntryFilter that will accept only LogEntries that were produced by a DataBasketImpl. |
static LogEntryFilter |
LOGENTRYFILTER_EXCHANGE_REMOVE_ACTIONS
A LogEntryFilter that will accept only LogEntries that were produced by a DataBasketImpl and that describe a exchange_remove action. |
static LogEntryFilter |
LOGENTRYFILTER_NO_DATABASKETIMPLACTIONS
A LogEntryFilter that will accept only LogEntries that were not produced by a DataBasketImpl. |
static LogEntryFilter |
LOGENTRYFILTER_PUT_ACTIONS
A LogEntryFilter that will accept only LogEntries that were produced by a DataBasketImpl and that describe a put action. |
static LogEntryFilter |
LOGENTRYFILTER_ROLLBACK_ACTIONS
A LogEntryFilter that will accept only LogEntries that were produced by a DataBasketImpl and that describe a rollback action. |
protected ListenerHelper |
m_lhListeners
The listeners currently listening for events from this DataBasket. |
protected Map |
m_mpsdbChildren
The subbaskets of this DataBasket. |
static int |
PUT_ACTION
Action constant for log(int, log.Loggable) . |
static int |
ROLLBACK_ACTION
Action constant for log(int, log.Loggable) . |
Constructor Summary | |
DataBasketImpl()
Create a new DataBasketImpl. |
Method Summary | |
void |
addDataBasketListener(DataBasketListener dbl)
Add a listener that will receive events when the DataBasket's contents change. |
protected void |
clean()
Remove any items that have already been handled, but so far have not been removed from the DataBasket. |
void |
commit()
Commit the contents of all subbaskets of this DataBasket. |
void |
commit(DataBasketCondition dbc)
Commit all items in all subbaskets that do match the given condition. |
void |
commitCurrentSubBasket()
Commit the current subbasket's contents. |
void |
commitSubBasket(String sName)
Commit all entries in a given subbasket. |
boolean |
contains(DataBasketCondition dbc)
Check whether any entries matching a particular condition are contained in the DataBasket. |
void |
exchange(DataBasketEntry dbeOrg,
DataBasketEntry dbeNew)
Exchange a DataBasketEntry with another. |
void |
fireDataBasketChanged()
Fire an event to all listeners listening to this DataBasket. |
protected void |
fireDBEAdded(DataBasketEntry dbe)
Fire an event to all listeners listening to this DataBasket. |
protected void |
fireDBERemoved(DataBasketEntry dbe)
Fire an event to all listeners listening to this DataBasket. |
DataBasketEntry |
get(DataBasketCondition dbc)
Get the first entry in the DataBasket that matches the condition. |
protected Object |
getChildrenLock()
Return the monitor used to synchronize access to the list of children. |
Object |
getDBIMonitor()
Return the monitor used to synchronize access to the internal data structures of the DataBasket. |
int |
getLogMode()
Return the current log mode of the DataBasket. |
Iterator |
iterator(DataBasketCondition dbc)
Iterate all entries in all subbaskets that match the condition. |
void |
log(int nAction,
Loggable la)
Log the given event wrapped in a LogEntry that describes the action. |
void |
put(DataBasketEntry dbe)
Put a DataBasketEntry into the current subbasket. |
void |
removeDataBasketListener(DataBasketListener dbl)
Remove a listener that received events when the DataBasket's contents changed. |
void |
rollback()
Rollback the contents of all subbaskets of this DataBasket. |
void |
rollback(DataBasketCondition dbc)
Rollback all items in all subbaskets that do match the given condition. |
void |
rollbackCurrentSubBasket()
Rollback the current subbasket's contents. |
void |
rollbackSubBasket(String sName)
Rollback all entries in a given subbasket. |
void |
setCurrentSubBasket(String sName)
Set the current subbasket. |
LogContext |
setLogContext(LogContext lcNew)
Set the log context for this DataBasket. |
int |
setLogMode(int nLogMode)
Set the log mode for this DataBasket. |
Iterator |
subBasketIterator(String sName,
DataBasketCondition dbc)
Iterate all entries in a given subbasket that match the given condition. |
Value |
sumBasket(DataBasketCondition dbc,
BasketEntryValue bev,
Value vInit)
Sum up all entries in the DataBasket that match the given condition. |
Value |
sumCurrentSubBasket(DataBasketCondition dbc,
BasketEntryValue bev,
Value vInit)
Sum up all entries in the current subbasket that match the given condition. |
Value |
sumSubBasket(String sName,
DataBasketCondition dbc,
BasketEntryValue bev,
Value vInit)
Sum up all entries in a given subbasket that match the given condition. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected Map m_mpsdbChildren
protected ListenerHelper m_lhListeners
public static final int PUT_ACTION
log(int, log.Loggable)
.public static final int EXCHANGE_REMOVE_ACTION
log(int, log.Loggable)
.public static final int COMMIT_ACTION
log(int, log.Loggable)
.public static final int ROLLBACK_ACTION
log(int, log.Loggable)
.public static final LogEntryFilter LOGENTRYFILTER_DATABASKETIMPLACTIONS
public static final LogEntryFilter LOGENTRYFILTER_NO_DATABASKETIMPLACTIONS
public static final LogEntryFilter LOGENTRYFILTER_PUT_ACTIONS
put
action.public static final LogEntryFilter LOGENTRYFILTER_EXCHANGE_REMOVE_ACTIONS
exchange_remove
action.public static final LogEntryFilter LOGENTRYFILTER_COMMIT_ACTIONS
commit
action.public static final LogEntryFilter LOGENTRYFILTER_ROLLBACK_ACTIONS
rollback
action.Constructor Detail |
public DataBasketImpl()
Method Detail |
protected final Object getChildrenLock()
public void rollback()
public void commit()
public void rollback(DataBasketCondition dbc)
dbc
- the condition to be matched. null
means rollback
unconditionally.public void commit(DataBasketCondition dbc)
dbc
- the condition to be matched. null
means commit
unconditionally.public void rollbackSubBasket(String sName)
sName
- the name of the subbasket.public void rollbackCurrentSubBasket()
public void commitSubBasket(String sName)
sName
- the name of the subbasket.public void commitCurrentSubBasket()
public void setCurrentSubBasket(String sName)
sName
- the name of the new current subbasket. If the subbasket does not yet exist, it
is created prior to being made the current subbasket.public Iterator iterator(DataBasketCondition dbc)
dbc
- the condition to be matched.public Iterator subBasketIterator(String sName, DataBasketCondition dbc)
dbc
- the condition to be matched.public Value sumBasket(DataBasketCondition dbc, BasketEntryValue bev, Value vInit)
dbc
- the condition to be matched.bev
- an object used for determining the value of a DataBasketEntry
.vInit
- the value that is to be used for adding up. All adding is performed by calling
Value.addAccumulating(data.Value)
on this object.vInit
.public Value sumSubBasket(String sName, DataBasketCondition dbc, BasketEntryValue bev, Value vInit)
sName
- the name of the subbasket that is to be summed up.dbc
- the condition to be matched.bev
- an object used for determining the value of a DataBasketEntry
.vInit
- the value that is to be used for adding up. All adding is performed by calling
Value.addAccumulating(data.Value)
on this object.vInit
.public Value sumCurrentSubBasket(DataBasketCondition dbc, BasketEntryValue bev, Value vInit)
dbc
- the condition to be matched.bev
- an object used for determining the value of a DataBasketEntry
.vInit
- the value that is to be used for adding up. All adding is performed by calling
Value.addAccumulating(data.Value)
on this object.vInit
.public void put(DataBasketEntry dbe)
DataBasketEntryImpl
.dbe
- the entry to be put in.! (dbe instanceof DataBasketEntryImpl
)
.public void exchange(DataBasketEntry dbeOrg, DataBasketEntry dbeNew)
dbeOrg
- the original DataBasketEntry, to be replaced.dbeNew
- the replacement.public DataBasketEntry get(DataBasketCondition dbc)
dbc
- the conditionpublic boolean contains(DataBasketCondition dbc)
dbc
- the conditionpublic LogContext setLogContext(LogContext lcNew)
All operations as defined through setLogMode(int)
will be logged using the given log context. If
the current log context is null
no logging of any kind will occur.
The actual LogEntries written are defined by the DataBasketEntries that participate in the activities that are logged. The DataBasket will wrap those LogEntries into LogEntries that give the type of operation performed.
lcNew
- the new log contextlog(int, log.Loggable)
public int setLogMode(int nLogMode)
The current log mode decides what operations on the DataBasket are being logged. The default value is
DataBasket.LOG_MODE_NONE
, indicating that no logging occurs. Other possibilities are:
DataBasket.LOG_MODE_ALL
All operations on the DataBasket are being logged.
DataBasket.LOG_MODE_COMMITS_ONLY
Only commits are being logged. There will
be one entry for each single step in the commit process.DataBasket.LOG_MODE_ROLLBACKS_ONLY
Only rollbacks are being logged. There
will be one entry for each single step in the rollback process.The actual LogEntries written are defined by the DataBasketEntries that participate in the activities that are logged. The DataBasket will wrap those LogEntries into LogEntries that give the type of operation performed.
nLogMode
- the new log mode.log(int, log.Loggable)
public int getLogMode()
setLogMode(int)
.public void log(int nAction, Loggable la)
If the action needs to be logged in the current log mode, a new DataBasketImpl.DataBasketImplLogEntry
is
created that wraps the LogEntry produced by the given Loggable. This LogEntry is then logged using the
current LogContext.
setLogContext(log.LogContext)
,
setLogMode(int)
public Object getDBIMonitor()
protected void clean()
This method is usually called by the framework only. It assumes, that it is called from within a
synchronized
block synchronizing on the monitor returned by getDBIMonitor()
.
public void addDataBasketListener(DataBasketListener dbl)
public void removeDataBasketListener(DataBasketListener dbl)
public void fireDataBasketChanged()
protected void fireDBEAdded(DataBasketEntry dbe)
protected void fireDBERemoved(DataBasketEntry dbe)
|
SalesPoint Framework v3.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |