|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object data.ooimpl.DataBasketImpl
public class 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.
Nested 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<String,DataBasketImpl.SubDataBasket> |
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) . |
Fields inherited from interface data.DataBasket |
---|
DEFAULTSUBBASKET_NAME, LOG_MODE_ALL, LOG_MODE_COMMITS_ONLY, LOG_MODE_NONE, LOG_MODE_ROLLBACKS_ONLY |
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<DataBasketEntry> |
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<DataBasketEntry> |
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<String,DataBasketImpl.SubDataBasket> 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()
rollback
in interface DataBasket
DataBasket.commit()
public void commit()
commit
in interface DataBasket
DataBasket.rollback()
public void rollback(DataBasketCondition dbc)
rollback
in interface DataBasket
dbc
- the condition to be matched. null
means rollback
unconditionally.public void commit(DataBasketCondition dbc)
commit
in interface DataBasket
dbc
- the condition to be matched. null
means commit
unconditionally.public void rollbackSubBasket(String sName)
rollbackSubBasket
in interface DataBasket
sName
- the name of the subbasket.DataBasket.setCurrentSubBasket(java.lang.String)
,
DataBasket.commitSubBasket(java.lang.String)
public void rollbackCurrentSubBasket()
rollbackCurrentSubBasket
in interface DataBasket
DataBasket.setCurrentSubBasket(java.lang.String)
,
DataBasket.commitCurrentSubBasket()
public void commitSubBasket(String sName)
commitSubBasket
in interface DataBasket
sName
- the name of the subbasket.DataBasket.setCurrentSubBasket(java.lang.String)
,
DataBasket.rollbackSubBasket(java.lang.String)
public void commitCurrentSubBasket()
commitCurrentSubBasket
in interface DataBasket
DataBasket.setCurrentSubBasket(java.lang.String)
,
DataBasket.rollbackCurrentSubBasket()
public void setCurrentSubBasket(String sName)
setCurrentSubBasket
in interface DataBasket
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.DataBasket.commitSubBasket(java.lang.String)
,
DataBasket.rollbackSubBasket(java.lang.String)
,
DataBasket.commitCurrentSubBasket()
,
DataBasket.rollbackCurrentSubBasket()
,
DataBasket.DEFAULTSUBBASKET_NAME
public Iterator<DataBasketEntry> iterator(DataBasketCondition dbc)
iterator
in interface DataBasket
dbc
- the condition to be matched.
remove()
method.public Iterator<DataBasketEntry> subBasketIterator(String sName, DataBasketCondition dbc)
subBasketIterator
in interface DataBasket
dbc
- the condition to be matched.sName
- the name of the SubBasket. A NullPointerException
may
be thrown if this SubBasket does not exist.
remove()
method.public Value sumBasket(DataBasketCondition dbc, BasketEntryValue bev, Value vInit)
sumBasket
in interface DataBasket
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)
sumSubBasket
in interface DataBasket
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)
sumCurrentSubBasket
in interface DataBasket
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
.
put
in interface DataBasket
dbe
- the entry to be put in.
ClassCastException
- if ! (dbe instanceof DataBasketEntryImpl
)
.public void exchange(DataBasketEntry dbeOrg, DataBasketEntry dbeNew)
exchange
in interface DataBasket
dbeOrg
- the original DataBasketEntry, to be replaced.dbeNew
- the replacement.public DataBasketEntry get(DataBasketCondition dbc)
get
in interface DataBasket
dbc
- the condition
public boolean contains(DataBasketCondition dbc)
contains
in interface DataBasket
dbc
- the condition
public 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.
setLogContext
in interface DataBasket
lcNew
- the new log context
log(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.
setLogMode
in interface DataBasket
nLogMode
- the new log mode.
log(int, log.Loggable)
public int getLogMode()
setLogMode(int)
.
getLogMode
in interface DataBasket
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()
handled
, but so far have not
been removed from the DataBasket.
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)
addDataBasketListener
in interface ListenableDataBasket
dbl
- the listener.public void removeDataBasketListener(DataBasketListener dbl)
removeDataBasketListener
in interface ListenableDataBasket
dbl
- the listener.public void fireDataBasketChanged()
fireDataBasketChanged
in interface ListenableDataBasket
protected void fireDBEAdded(DataBasketEntry dbe)
protected void fireDBERemoved(DataBasketEntry dbe)
|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |