Holger's
Java API

com.antelmann.sql
Class TaggableSQLStore<T extends Taggable<G> & DBEntry,G extends Keyword>

java.lang.Object
  extended by com.antelmann.db.WrappedDBClassStore<T>
      extended by com.antelmann.sql.WrappedDBClassStoreMapping<T>
          extended by com.antelmann.sql.TaggableSQLStore<T,G>
All Implemented Interfaces:
DBClassStore<T>, ProcessedFilterOption<T>, TransactionRequired, MappingInfo, TaggableMapping, ProcessorHook<T,DatabaseException>, Wrapped<DBClassStore<T>>
Direct Known Subclasses:
SortedGroupableSQLStore

public class TaggableSQLStore<T extends Taggable<G> & DBEntry,G extends Keyword>
extends WrappedDBClassStoreMapping<T>
implements TaggableMapping

provides a store that can wrap any given store to provide persistence for its grouping capacity based on Keyword objects.

Since:
07.11.2008, 12:11:22
Author:
Holger Antelmann
See Also:
Keyword

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.antelmann.db.DBClassStore
DBClassStore.DBMethod
 
Field Summary
protected  TaggableMappingImpl gmi
           
 
Fields inherited from class com.antelmann.db.WrappedDBClassStore
store
 
Constructor Summary
TaggableSQLStore(DBClassStore<T> store, String groupTable, String idColumn, String groupColumn, Class<G> groupType)
           
 
Method Summary
protected  G createGroup(Object name)
           
 boolean deleteEntry(Object id)
          removes the entry with the given ID from this store in the database.
protected  void deleteGroups(Object entryID)
           
 void deleteTag(String group)
          deletes the given tag so that no entry is in the given group anymore
 TreeSet<G> getExistingTags()
          allows to retrieve all existing groups from the database
 String getGroupNameColumn()
           
 String getTagIdColumn()
           
 String getTagTable()
           
 Class<? extends Keyword> getTagType()
          returns the type of the tag
protected  void initGroups(T entry)
           
 void renameTag(String oldName, String newName)
          allows to rename all occurrences of a tag name into another
protected  ArrayList<G> retrieveGroups(Object id)
           
protected  void storeGroups(T entry)
           
 
Methods inherited from class com.antelmann.sql.WrappedDBClassStoreMapping
addColumnsForTopic, addTopicMapping, getColumnDisplayMapping, getColumnNames, getColumnsForTopic, getColumnSize, getDisplayColumn, getDisplayNameForColumn, getIDColumn, getMappingForTopic, 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, insert, insertAsNew, isApplyFilterProcessingRecursively, isDeleteEntriesIndividually, isEnsureTransactionsOnFetch, isProcessBeforeFiltering, queryForInterface, remove, setAccessFilter, setAccessStubFilter, setApplyFilterProcessingRecursively, setDeleteEntriesIndividually, setEnsureTransactionsOnFetch, setExposesInterfaces, setFetchProcessor, setPreStoreHandler, setProcessBeforeFiltering, setProcessBeforeFiltering, setStoreHandler, setStubProcessor, size, unwrap, update, wrapFilterForProcessing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gmi

protected final TaggableMappingImpl gmi
Constructor Detail

TaggableSQLStore

@Warning(value="The embedded JDBCRowStore better has fasDelete set to false!")
public TaggableSQLStore(DBClassStore<T> store,
                                     String groupTable,
                                     String idColumn,
                                     String groupColumn,
                                     Class<G> groupType)
Parameters:
store - the embedded store to be wrapped to provide persistent grouping capacities; the associated database must be based on a Connection.
groupTable - the name of the table containing the groups for the groupable entries
idColumn - specifies the column in the groupTable that contains the id for the groupable entry
groupColumn - specifies the column in the groupTable that contains the name for the group
Method Detail

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 Taggable<G> & DBEntry>
Overrides:
deleteEntry in class WrappedDBClassStore<T extends Taggable<G> & DBEntry>
Returns:
true only if the DBEntry with the given ID was actually found and deleted.
Throws:
DatabaseException

getTagTable

public String getTagTable()
Specified by:
getTagTable in interface TaggableMapping

getTagIdColumn

public String getTagIdColumn()
Specified by:
getTagIdColumn in interface TaggableMapping

getGroupNameColumn

public String getGroupNameColumn()
Specified by:
getGroupNameColumn in interface TaggableMapping

storeGroups

protected void storeGroups(T entry)
                    throws DatabaseException
Throws:
DatabaseException

deleteGroups

protected void deleteGroups(Object entryID)
                     throws DatabaseException
Throws:
DatabaseException

initGroups

protected void initGroups(T entry)
                   throws DatabaseException
Throws:
DatabaseException

retrieveGroups

protected ArrayList<G> retrieveGroups(Object id)
                                               throws SQLException
Throws:
SQLException

createGroup

protected G createGroup(Object name)

getTagType

public Class<? extends Keyword> getTagType()
Description copied from interface: TaggableMapping
returns the type of the tag

Specified by:
getTagType in interface TaggableMapping

getExistingTags

public TreeSet<G> getExistingTags()
                                           throws SQLException
allows to retrieve all existing groups from the database

Specified by:
getExistingTags in interface TaggableMapping
Throws:
SQLException

renameTag

public void renameTag(String oldName,
                      String newName)
               throws SQLException,
                      NullPointerException
Description copied from interface: TaggableMapping
allows to rename all occurrences of a tag name into another

Specified by:
renameTag in interface TaggableMapping
Throws:
SQLException
NullPointerException

deleteTag

public void deleteTag(String group)
               throws SQLException
Description copied from interface: TaggableMapping
deletes the given tag so that no entry is in the given group anymore

Specified by:
deleteTag in interface TaggableMapping
Throws:
SQLException


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