|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Catalog<T extends CatalogItem>
A Catalog.
Catalogs are - usually system global - lists of items. Each Catalog has a name unique to its scope of
usage. It is identified by this name. Catalogs consist of CatalogItems
, which comprise
a key (String
), possibly a value (Value
) and any number of additional attributes as needed
to correctly describe the item.
A Catalog is capable to test whether it contains CatalogItems with a certain key or matching a given CatalogItem. It will make available for editing the CatalogItem of a given key, if this key is contained in the Catalog.
Catalogs support the usage of DataBaskets
so that all operations on the Catalog can
be performed in a transactional style.
As a Catalog is itself a CatalogItem, constructing arbitrarily nested Catalogs is possible.
A Catalog is serializable to allow for it to be stored to an ObjectOutputStream.
Stock
Field Summary |
---|
Fields inherited from interface data.CatalogItem |
---|
VALUE_PROPERTY |
Fields inherited from interface data.Nameable |
---|
NAME_PROPERTY |
Method Summary | |
---|---|
void |
add(T ci,
DataBasket db)
Add a CatalogItem to the Catalog. |
boolean |
contains(String sKey,
DataBasket db)
Check whether the Catalog contains a certain CatalogItem. |
T |
get(String sKey,
DataBasket db,
boolean fForEdit)
Get a CatalogItem by its key. |
Iterator<T> |
iterator(DataBasket db,
boolean fForEdit)
Return an iterator of all items in the Catalog. |
Set<String> |
keySet(DataBasket db)
Get a set of all keys currently in the Catalog. |
T |
remove(String sKey,
DataBasket db)
Remove a CatalogItem from the Catalog. |
T |
remove(T ci,
DataBasket db)
Remove a CatalogItem from the Catalog. |
int |
size(DataBasket db)
Calculate the size of the Catalog. |
Methods inherited from interface data.CatalogItem |
---|
addValueListener, getCatalog, getValue, removeValueListener |
Methods inherited from interface data.Nameable |
---|
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Method Detail |
---|
void add(T ci, DataBasket db)
The added item will only be visible to users of the same DataBasket. Only after a
commit()
was executed on the DataBasket, the added item will become visible
to other users of the Catalog.
For a ListenableCatalog
, a addedCatalogItem
event will be fired.
ci
- the CatalogItem to be added. This item must not be contained in another Catalog.db
- the DataBasket relative to which the operation is to be performed.
NotEditableException
- if the Catalog is currently not editable.
DuplicateKeyException
- if a CatalogItem of the same name does already exist in the Catalog.
DataBasketConflictException
- if the CatalogItem cannot be added because an item of the same
name has already been added/removed using another DataBasket.T remove(T ci, DataBasket db) throws VetoException
The item's removal will be immediately visible to all users of the Catalog. However, only users of the
same DataBasket that was used to remove the item will be able to add an item with the same key later.
Only after a commit()
was executed on the DataBasket, other users of the
Catalog will have a chance to add an item with the same key.
For a ListenableCatalog
, canRemoveCatalogItem
and
removedCatalogItem
events will be fired. If one of the listeners vetos the removal, a
VetoException
will be thrown.
ci
- the CatalogItem to be removed.db
- the DataBasket relative to which the operation is to be performed.
NotEditableException
- if the Catalog is currently not editable.
VetoException
- if one of the listeners vetos the removal.
DataBasketConflictException
- if the CatalogItem cannot be removed because an item of the same
name has already been added using another DataBasket.T remove(String sKey, DataBasket db) throws VetoException
The item's removal will be immediately visible to all users of the Catalog. However, only users of the
same DataBasket that was used to remove the item will be able to add an item with the same key later.
Only after a commit()
was executed on the DataBasket, other users of the
Catalog will have a chance to add an item with the same key.
For a ListenableCatalog
, canRemoveCatalogItem
and
removedCatalogItem
events will be fired. If one of the listeners vetos the removal, a
VetoException
will be thrown.
sKey
- the key of the CatalogItem to be removed.db
- the DataBasket relative to which the operation is to be performed.
NotEditableException
- if the Catalog is currently not editable.
VetoException
- if one of the listeners vetos the removal.
DataBasketConflictException
- if the CatalogItem cannot be removed because an item of the same
name has already been added using another DataBasket.T get(String sKey, DataBasket db, boolean fForEdit) throws VetoException
There are two distinct possibilities when getting a CatalogItem from a Catalog:
fForEdit
== false):fForEdit
== true):DataBasket.commit()
is performed
on the DataBasket. It is legal to edit the retrieved item (however, not necessarily the same item
that was retrieved earlier using possibility 1 !!!), and all editing can be commited or rolled back
using the DataBasket. This possibility can, however, be vetoed if this is a
ListenableCatalog
.ListenableCatalog
, canEditCatalogItem
and
editingCatalogItem
events will be fired. If one of the listeners vetos the editing, a
VetoException
will be thrown.
sKey
- the key of the CatalogItem to be retrieved.db
- the DataBasket relative to which the operation is to be performed.fForEdit
- if true, the CatalogItem will be retrieved for editing.
NotEditableException
- if the Catalog is not currently editable, but an attempt is made to edit
one of its items.
VetoException
- if one of the listeners vetos the editing.
DataBasketConflictException
- if the CatalogItem cannot be retrieved because it is not visible
to users of the given DataBasket.boolean contains(String sKey, DataBasket db)
Will return true only if an item of the given key is contained in the Catalog and if that item is visible to users of the given DataBasket.
sKey
- the key for which to check containment.db
- the DataBasket that defines visibility of items. See add(T, data.DataBasket)
and remove(T, data.DataBasket)
for
details on visibility.Iterator<T> iterator(DataBasket db, boolean fForEdit)
The iterator will conceptually call get(java.lang.String, data.DataBasket, boolean)
for each CatalogItem, using the given parameters.
db
- the DataBasket that defines visibility.fForEdit
- if true, the items are retrieved for editing. VetoException will be converted into
UnsupportedOperationException
s.Set<String> keySet(DataBasket db)
This will retrieve a static set that gives the state of the Catalog at the time of the call.
db
- the DataBasket used to determine visibility of elements.int size(DataBasket db)
db
- the DataBasket used to determine visibility.
|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |