|
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.sql.WrappedDBClassStoreMapping<T>
com.antelmann.sql.PropertyEntryTableStore<T>
public class PropertyEntryTableStore<T extends PropertyEntry>
a specialized store that provides help for dealing with PropertyEntry objects, assuming that the properties are to be stored in a separate detail table. This implementation wraps the DBClassStore interface to add the additional functionality (as opposed to the DetailRowStore, which wraps the mapper). Additionally, the MappingInfo not only remains to be exposed, but is also extended with the DetailKeys.
PropertyEntryMapping.DetailKey| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.antelmann.sql.PropertyEntryMapping |
|---|
PropertyEntryMapping.DetailKey |
| 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 | |
|---|---|
PropertyEntryTableStore(DBClassStore<T> store,
MappingInfo mi)
allows to obtain the relevant information from a given mapping |
|
PropertyEntryTableStore(DBClassStore<T> store,
String detailTable,
String detailIdColumn,
String detailKeyColumn,
String detailValueColumn)
the String parameters correspond to the PropertyEntryMapping.DetailKey values |
|
| Method Summary | |
|---|---|
void |
deleteAttributeKey(String key)
deletes all property entries with the given key |
protected void |
deleteDetails(Object id)
|
boolean |
deleteEntry(Object id)
removes the entry with the given ID from this store in the database. |
String |
getDetailIdColumn()
|
String |
getDetailKeyColumn()
|
String |
getDetailTable()
|
String |
getDetailValueColumn()
|
String |
getMappingForTopic(Object topic)
provides additional topics from PropertyEntryMapping.DetailKey |
Set<String> |
getPropertyKeys()
returns all property keys currently in the database |
Set<?> |
getValuesForProperty(String key)
returns all values for a given property key; if the key is null, all values are returned |
protected void |
initializeDetails(T entry)
loads the properties into the given entry |
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. |
protected void |
insertDetails(Object id,
T entry)
takes the additional ID since - as for insertAsNew - the ID may be different from the ID of the entry |
void |
renameAttributeKey(String oldName,
String newName)
allows to rename an attribute key; note that only those attribute keys can be renamed where the new attribute key doesn't yet exist |
void |
replaceValuesForKey(String key,
String oldValue,
String newValue)
replaces all old values for the given key with the new value |
void |
update(T entry)
updates the given entry in the database. |
| Methods inherited from class com.antelmann.sql.WrappedDBClassStoreMapping |
|---|
addColumnsForTopic, addTopicMapping, getColumnDisplayMapping, getColumnNames, getColumnsForTopic, getColumnSize, getDisplayColumn, getDisplayNameForColumn, getIDColumn, getSQLTypeforColumn, getSupportedTopicColumns, getTableName, getTableQuery, removeColumnTopics, removeTopicMapping, setColumnsForTopic |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertyEntryTableStore(DBClassStore<T> store,
MappingInfo mi)
public PropertyEntryTableStore(DBClassStore<T> store,
String detailTable,
String detailIdColumn,
String detailKeyColumn,
String detailValueColumn)
throws ClassCastException
PropertyEntryMapping.DetailKey values
store - the given store should only be concerned with mapping
the 'flat' object while disregarding the properties stored within.
The store requires a database that uses a Connection as a database servicedetailTable - the name of the table that contains the detail datadetailIdColumn - the name of the column that contains the ID that
maps to the ID of the associated DBEntry
(this along with the detailKeyColumn ought to be the primary key)detailKeyColumn - the name of the column that contains the key for the propertydetailValueColumn - the name of the column that contains the value for the property
ClassCastException - if the database service of the given store is not a Connection| Method Detail |
|---|
protected void initializeDetails(T entry)
throws SQLException
SQLException
protected void insertDetails(Object id,
T entry)
throws SQLException
SQLException
protected void deleteDetails(Object id)
throws SQLException
SQLExceptionpublic String getDetailTable()
public String getDetailIdColumn()
public String getDetailKeyColumn()
public String getDetailValueColumn()
public boolean deleteEntry(Object id)
throws DatabaseException
DBClassStore
deleteEntry in interface DBClassStore<T extends PropertyEntry>deleteEntry in class WrappedDBClassStore<T extends PropertyEntry>DatabaseException
public Object insertAsNew(T entry)
throws DatabaseException
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 PropertyEntry>insertAsNew in class WrappedDBClassStore<T extends PropertyEntry>DatabaseExceptionDBEntry.getID(),
DBClassStore.generateNewID()
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 PropertyEntry>insert in class WrappedDBClassStore<T extends PropertyEntry>DatabaseExceptionDBClassStore.generateNewID()
public void update(T entry)
throws DatabaseException
DBClassStore
update in interface DBClassStore<T extends PropertyEntry>update in class WrappedDBClassStore<T extends PropertyEntry>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
public Set<String> getPropertyKeys()
throws SQLException
PropertyEntryMapping
getPropertyKeys in interface PropertyEntryMappingSQLException
public Set<?> getValuesForProperty(String key)
throws SQLException
PropertyEntryMapping
getValuesForProperty in interface PropertyEntryMappingSQLException
public void deleteAttributeKey(String key)
throws SQLException
PropertyEntryMapping
deleteAttributeKey in interface PropertyEntryMappingSQLException
public void renameAttributeKey(String oldName,
String newName)
throws SQLException,
NullPointerException
PropertyEntryMapping
renameAttributeKey in interface PropertyEntryMappingSQLException
NullPointerException
public void replaceValuesForKey(String key,
String oldValue,
String newValue)
throws SQLException
PropertyEntryMapping
replaceValuesForKey in interface PropertyEntryMappingSQLExceptionpublic String getMappingForTopic(Object topic)
PropertyEntryMapping.DetailKey
getMappingForTopic in interface MappingInfogetMappingForTopic in class WrappedDBClassStoreMapping<T extends PropertyEntry>
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||