com.antelmann.sql
Class CategoryStore<T extends Category<?> & DBEntry>
java.lang.Object
com.antelmann.db.WrappedDBClassStore<T>
com.antelmann.sql.WrappedDBClassStoreMapping<T>
com.antelmann.sql.CategoryStore<T>
- All Implemented Interfaces:
- CategoryManager, DBClassStore<T>, ProcessedFilterOption<T>, TransactionRequired, MappingInfo, ProcessorHook<T,DatabaseException>, Wrapped<DBClassStore<T>>
public class CategoryStore<T extends Category<?> & DBEntry>
- extends WrappedDBClassStoreMapping<T>
- implements CategoryManager
provides an SQL-based store wrapper to handle categories more easily
based on a column that contains the parent-category-id.
- Since:
- 01.11.2011, 11:20:14
- Author:
- Holger Antelmann
|
Method Summary |
static
|
createDefaultMapper(Database<Connection> db,
String table,
String idColumn,
String nameColumn,
String parentColumn,
IDFactory factory,
Class<T> type)
|
static
|
createStandardExtractor(DBClassStore<T> store)
|
static
|
createStandardExtractor(String categoryIdColumn,
Class<T> type)
|
boolean |
deleteEntry(Object id)
removes the entry with the given ID from this store in the database. |
Iterable<Object> |
getAllSubCategoryIDs(DBReference categoryRef)
|
|
getCategoryUsageFilterFor(Class<S> type,
Object categoryId)
|
Collection<DBClassStore<?>> |
getCategoryUserStores()
|
protected List<T> |
getList(Filter<? super T> filter)
|
List<T> |
getSubCategories(DBReference categoryRef)
|
List<T> |
getTopCategories()
|
boolean |
isLeaf(DBReference categoryRef)
|
boolean |
isUsed(DBReference categoryRef)
|
|
registerCategoryUse(DBClassStore<S> store,
PatternExtractor<Object,Filter<S>> filterCreator)
|
static
|
registerCategoryUser(DBClassStore<T> store,
String categoryIdColumn,
Class<? extends Category<?>> categoryClass)
|
| 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 |
PARENT_CATEGORY_COLUMN
public static final Object PARENT_CATEGORY_COLUMN
- used as the topic mappping for the column where the parent category is stored
CategoryStore
public CategoryStore(DBClassStore<T> store,
String parentCategoryIDColumn)
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 Category<?> & DBEntry>- Overrides:
deleteEntry in class WrappedDBClassStore<T extends Category<?> & DBEntry>
- Returns:
- true only if the DBEntry with the given ID was actually found and deleted.
- Throws:
DatabaseException
isUsed
public boolean isUsed(DBReference categoryRef)
throws DatabaseException,
IllegalArgumentException
- Specified by:
isUsed in interface CategoryManager
- Throws:
DatabaseException
IllegalArgumentException
isLeaf
public boolean isLeaf(DBReference categoryRef)
throws DatabaseException,
IllegalArgumentException
- Specified by:
isLeaf in interface CategoryManager
- Throws:
DatabaseException
IllegalArgumentException
getTopCategories
public List<T> getTopCategories()
throws DatabaseException
- Specified by:
getTopCategories in interface CategoryManager
- Throws:
DatabaseException
getSubCategories
public List<T> getSubCategories(DBReference categoryRef)
throws DatabaseException
- Specified by:
getSubCategories in interface CategoryManager
- Throws:
DatabaseException
getAllSubCategoryIDs
public Iterable<Object> getAllSubCategoryIDs(DBReference categoryRef)
throws DatabaseException,
IllegalArgumentException
- Specified by:
getAllSubCategoryIDs in interface CategoryManager
- Throws:
DatabaseException
IllegalArgumentException
getList
protected List<T> getList(Filter<? super T> filter)
throws DatabaseException
- Throws:
DatabaseException
registerCategoryUse
public <S extends DBEntry> PatternExtractor<Object,Filter<S>> registerCategoryUse(DBClassStore<S> store,
PatternExtractor<Object,Filter<S>> filterCreator)
- Specified by:
registerCategoryUse in interface CategoryManager
filterCreator - creates a filter based on an object id- See Also:
registerCategoryUser(DBClassStore, String, Class)
getCategoryUserStores
public Collection<DBClassStore<?>> getCategoryUserStores()
- Specified by:
getCategoryUserStores in interface CategoryManager
getCategoryUsageFilterFor
public <S extends DBEntry> Filter<S> getCategoryUsageFilterFor(Class<S> type,
Object categoryId)
- Specified by:
getCategoryUsageFilterFor in interface CategoryManager
createStandardExtractor
public static <T extends DBEntry> PatternExtractor<Object,Filter<T>> createStandardExtractor(DBClassStore<T> store)
createStandardExtractor
public static <T extends DBEntry> PatternExtractor<Object,Filter<T>> createStandardExtractor(String categoryIdColumn,
Class<T> type)
registerCategoryUser
public static <T extends DBEntry> void registerCategoryUser(DBClassStore<T> store,
String categoryIdColumn,
Class<? extends Category<?>> categoryClass)
- See Also:
CategoryManager.registerCategoryUse(DBClassStore, PatternExtractor)
createDefaultMapper
public static <T extends Category.Entry> BaseRowMapper<T> createDefaultMapper(Database<Connection> db,
String table,
String idColumn,
String nameColumn,
String parentColumn,
IDFactory factory,
Class<T> type)
throws DatabaseException
- Throws:
DatabaseException
(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads