|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.db.WrappedDBClassStore<T>
com.antelmann.db.ReadOnlyStore<T>
public class ReadOnlyStore<T extends DBEntry>
a wrapper around a DBClassStore that disables altering the store's content
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.antelmann.db.DBClassStore |
|---|
DBClassStore.DBMethod |
| Field Summary |
|---|
| Fields inherited from class com.antelmann.db.WrappedDBClassStore |
|---|
store |
| Constructor Summary | |
|---|---|
ReadOnlyStore(DBClassStore<T> store)
calls this(store, false) |
|
ReadOnlyStore(DBClassStore<T> store,
boolean allowGenerateNewID)
if allowGenerateNewID is true, the method generateNewID() will delegate to the embedded store |
|
| Method Summary | |
|---|---|
int |
deleteEntries(Filter<? super T> filter)
deletes all DBEntry objects that match the given filter; if the filter is null, all resources are deleted. |
boolean |
deleteEntry(Object id)
removes the entry with the given ID from this store in the database. |
Object |
generateNewID()
this method is to generate unique new IDs for the DBEntry at hand - if the application has no other specific way of providing new IDs for this implementation. |
void |
insert(T entry)
it is suggested to create the entry with an ID obtained through generateNewID() before passing it into
this method. |
Object |
insertAsNew(T entry)
inserts the given entry using an ID generated by generateNewID
while ignoring the ID of the given entry. |
void |
update(T entry)
updates the given entry in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReadOnlyStore(DBClassStore<T> store)
public ReadOnlyStore(DBClassStore<T> store,
boolean allowGenerateNewID)
generateNewID() will delegate to the embedded store
| Method Detail |
|---|
public boolean deleteEntry(Object id)
throws DatabaseException
DBClassStore
deleteEntry in interface DBClassStore<T extends DBEntry>deleteEntry in class WrappedDBClassStore<T extends DBEntry>DatabaseException
public int deleteEntries(Filter<? super T> filter)
throws DatabaseException
DBClassStoreDBClassStore.deleteEntry(Object)
is called for each entry passing the filter (although stores may choose to do so)!
Consequently, if a store's implementation does not call DBClassStore.deleteEntry(Object)
on each instance, calling this method may result in changes that are hard to monitor
for versioning purposes.
deleteEntries in interface DBClassStore<T extends DBEntry>deleteEntries in class WrappedDBClassStore<T extends DBEntry>DatabaseExceptionWrappedDBClassStore.setProcessBeforeFiltering(boolean)
public void insert(T entry)
throws DatabaseException
DBClassStoregenerateNewID() before passing it into
this method.
The ID of the entry must not already exist in the database.
insert in interface DBClassStore<T extends DBEntry>insert in class WrappedDBClassStore<T extends DBEntry>DatabaseExceptionDBClassStore.generateNewID()
public Object generateNewID()
throws DatabaseException,
UnsupportedOperationException
DBClassStore
generateNewID in interface DBClassStore<T extends DBEntry>generateNewID in class WrappedDBClassStore<T extends DBEntry>DatabaseException
UnsupportedOperationExceptionSessionIdGenerator,
DBEntry.getID()
public Object insertAsNew(T entry)
throws DatabaseException,
UnsupportedOperationException
DBClassStoregenerateNewID
while ignoring the ID of the given entry.
With this method, the same Object (with the same ID) can be inserted
multiple times, stored with a new ID on each call; the ID creation is handled
automatically.
This is an optional feature that might not be implemented in all cases.
insertAsNew in interface DBClassStore<T extends DBEntry>insertAsNew in class WrappedDBClassStore<T extends DBEntry>DatabaseException
UnsupportedOperationExceptionDBEntry.getID(),
DBClassStore.generateNewID()
public void update(T entry)
throws DatabaseException,
IllegalArgumentException
DBClassStore
update in interface DBClassStore<T extends DBEntry>update in class WrappedDBClassStore<T extends DBEntry>DatabaseException - if the database was not able to perform the update
or it the entry didn't exist in the database before calling this method
IllegalArgumentException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||