Holger's Java API

## com.antelmann.sql
Class PropertyEntryTableStore<T extends PropertyEntry>

    java.lang.Object
      com.antelmann.db.WrappedDBClassStore<T>
          com.antelmann.sql.WrappedDBClassStoreMapping<T>
              com.antelmann.sql.PropertyEntryTableStore<T>

All Implemented Interfaces:
  DBClassStore<T>, ProcessedFilterOption<T>, TransactionRequired, MappingInfo, PropertyEntryMapping, ProcessorHook<T,DatabaseException>, Wrapped<DBClassStore<T>>

    public class PropertyEntryTableStore<T extends PropertyEntry>

extends WrappedDBClassStoreMapping<T>
implements PropertyEntryMapping

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.

Author:
  Holger Antelmann
See Also:
  `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 com.antelmann.db.WrappedDBClassStore

`add, checkReadAccess, checkWriteAccess, containsID, deleteEntries, deleteEntriesIndividually, exposesInterfaces, fetch, fetchStubs, generateNewID, getAccessFilter, getAccessStubFilter, getDatabase, getEntry, getEntryClass, getFetchProcessor, getPreStoreHandler, getStoreHandler, getStub, getStubProcessor, isApplyFilterProcessingRecursively, isDeleteEntriesIndividually, isEnsureTransactionsOnFetch, isProcessBeforeFiltering, queryForInterface, remove, setAccessFilter, setAccessStubFilter, setApplyFilterProcessingRecursively, setDeleteEntriesIndividually, setEnsureTransactionsOnFetch, setExposesInterfaces, setFetchProcessor, setPreStoreHandler, setProcessBeforeFiltering, setProcessBeforeFiltering, setStoreHandler, setStubProcessor, size, unwrap, wrapFilterForProcessing`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PropertyEntryTableStore

    public PropertyEntryTableStore(DBClassStore<T> store,
                                   MappingInfo mi)

  allows to obtain the relevant information from a given mapping

### PropertyEntryTableStore

    public PropertyEntryTableStore(DBClassStore<T> store,
                                   String detailTable,
                                   String detailIdColumn,
                                   String detailKeyColumn,
                                   String detailValueColumn)
                            throws ClassCastException

  the String parameters correspond to the `PropertyEntryMapping.DetailKey` values

  Parameters:
    `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 service
    `detailTable` - the name of the table that contains the detail data
    `detailIdColumn` - 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 property
    `detailValueColumn` - the name of the column that contains the value for the property
  Throws:
    `ClassCastException` - if the database service of the given store is not a `Connection`

Method Detail

### initializeDetails

    protected void initializeDetails(T entry)
                              throws SQLException

  loads the properties into the given entry

  Throws:
    `SQLException`

### insertDetails

    protected void insertDetails(Object id,
                                 T entry)
                          throws SQLException

  takes the additional ID since - as for insertAsNew - the ID may be different from the ID of the entry

  Throws:
    `SQLException`

### deleteDetails

    protected void deleteDetails(Object id)
                          throws SQLException

  Throws:
    `SQLException`

### getDetailTable

    public String getDetailTable()

### getDetailIdColumn

    public String getDetailIdColumn()

### getDetailKeyColumn

    public String getDetailKeyColumn()

### getDetailValueColumn

    public String getDetailValueColumn()

### deleteEntry

    public boolean deleteEntry(Object id)
                        throws DatabaseException

  Description copied from interface: `DBClassStore`
  removes the entry with the given ID from this store in the database.

  Specified by:
    `deleteEntry` in interface `DBClassStore<T extends PropertyEntry>`
  Overrides:
    `deleteEntry` in class `WrappedDBClassStore<T extends PropertyEntry>`
  Returns:
    true only if the DBEntry with the given ID was actually found and deleted.
  Throws:
    `DatabaseException`

### insertAsNew

    public Object insertAsNew(T entry)
                       throws DatabaseException

  Description copied from interface: `DBClassStore`
  inserts the given entry using an ID generated by `generateNewID` 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.

  Specified by:
    `insertAsNew` in interface `DBClassStore<T extends PropertyEntry>`
  Overrides:
    `insertAsNew` in class `WrappedDBClassStore<T extends PropertyEntry>`
  Returns:
    the newly created ID of the object used as ID for the given entry to be inserted
  Throws:
    `DatabaseException`
  See Also:
    `DBEntry.getID()`, `DBClassStore.generateNewID()`

### insert

    public void insert(T entry)
                throws DatabaseException

  Description copied from interface: `DBClassStore`
  it is suggested to create the entry with an ID obtained through `generateNewID()` before passing it into this method. The ID of the entry must not already exist in the database.

  Specified by:
    `insert` in interface `DBClassStore<T extends PropertyEntry>`
  Overrides:
    `insert` in class `WrappedDBClassStore<T extends PropertyEntry>`
  Throws:
    `DatabaseException`
  See Also:
    `DBClassStore.generateNewID()`

### update

    public void update(T entry)
                throws DatabaseException

  Description copied from interface: `DBClassStore`
  updates the given entry in the database.

  Specified by:
    `update` in interface `DBClassStore<T extends PropertyEntry>`
  Overrides:
    `update` in class `WrappedDBClassStore<T extends PropertyEntry>`
  Throws:
    `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

### getPropertyKeys

    public Set<String> getPropertyKeys()
                                throws SQLException

  Description copied from interface: `PropertyEntryMapping`
  returns all property keys currently in the database

  Specified by:
    `getPropertyKeys` in interface `PropertyEntryMapping`
  Throws:
    `SQLException`

### getValuesForProperty

    public Set<?> getValuesForProperty(String key)
                                throws SQLException

  Description copied from interface: `PropertyEntryMapping`
  returns all values for a given property key; if the key is null, all values are returned

  Specified by:
    `getValuesForProperty` in interface `PropertyEntryMapping`
  Throws:
    `SQLException`

### deleteAttributeKey

    public void deleteAttributeKey(String key)
                            throws SQLException

  Description copied from interface: `PropertyEntryMapping`
  deletes all property entries with the given key

  Specified by:
    `deleteAttributeKey` in interface `PropertyEntryMapping`
  Throws:
    `SQLException`

### renameAttributeKey

    public void renameAttributeKey(String oldName,
                                   String newName)
                            throws SQLException,
                                   NullPointerException

  Description copied from interface: `PropertyEntryMapping`
  allows to rename an attribute key; note that only those attribute keys can be renamed where the new attribute key doesn't yet exist

  Specified by:
    `renameAttributeKey` in interface `PropertyEntryMapping`
  Throws:
    `SQLException`
    `NullPointerException`

### replaceValuesForKey

    public void replaceValuesForKey(String key,
                                    String oldValue,
                                    String newValue)
                             throws SQLException

  Description copied from interface: `PropertyEntryMapping`
  replaces all old values for the given key with the new value

  Specified by:
    `replaceValuesForKey` in interface `PropertyEntryMapping`
  Throws:
    `SQLException`

### getMappingForTopic

    public String getMappingForTopic(Object topic)

  provides additional topics from `PropertyEntryMapping.DetailKey`

  Specified by:
    `getMappingForTopic` in interface `MappingInfo`
  Overrides:
    `getMappingForTopic` in class `WrappedDBClassStoreMapping<T extends PropertyEntry>`
  Returns:
    either a table name, a column name, a query string or null - depending on the given topic

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads