Package org.ctan.site.stores.base
Class AbstractIndexingStore<T extends Searchable>
java.lang.Object
io.dropwizard.hibernate.AbstractDAO<T>
org.ctan.site.stores.base.AbstractStore<T>
org.ctan.site.stores.base.AbstractIndexingStore<T>
- Type Parameters:
T- the type of the underlying entity
- All Implemented Interfaces:
IndexingStore
- Direct Known Subclasses:
ArchiveFileStore,AuthorStore,GuestBookStore,LicenseStore,MirrorStore,PkgStore,TopicStore
public abstract class AbstractIndexingStore<T extends Searchable>
extends AbstractStore<T>
implements IndexingStore
The class
AbstractIndexingStore contains the abstract repository
for CRUD operations on an indexed entity.-
Constructor Summary
ConstructorsConstructorDescriptionAbstractIndexingStore(@NonNull org.hibernate.SessionFactory sessionFactory, @NonNull IndexingSession indexingSession) This is the constructor forAbstractStore. -
Method Summary
Modifier and TypeMethodDescriptioncount()The methodcountprovides means to count all entities in the database.findAll()The methodfindAllprovides means to find a list of all entries.booleanThe methodremoveprovides means to remove an entity.The methodsaveprovides means to store an entity in the database.voidThe methodupdateIndexprovides means to update all entries in the database.Methods inherited from class org.ctan.site.stores.base.AbstractStore
getById, list, listQuery, map, remove, removeMethods inherited from class io.dropwizard.hibernate.AbstractDAO
criteriaQuery, currentSession, get, getEntityClass, initialize, list, list, namedQuery, namedTypedQuery, persist, query, uniqueResult, uniqueResult
-
Constructor Details
-
AbstractIndexingStore
public AbstractIndexingStore(@NonNull @NonNull org.hibernate.SessionFactory sessionFactory, @NonNull @NonNull IndexingSession indexingSession) This is the constructor forAbstractStore.- Parameters:
sessionFactory- the session factoryindexingSession- the indexing session
-
-
Method Details
-
count
The methodcountprovides means to count all entities in the database.- Returns:
- the total number of entities
-
findAll
The methodfindAllprovides means to find a list of all entries.- Returns:
- the list of entries
-
remove
The methodremoveprovides means to remove an entity. A new session is created and closed at the end.- Overrides:
removein classAbstractStore<T extends Searchable>- Parameters:
entity- the entity- Returns:
trueiff something has been removed
-
save
The methodsaveprovides means to store an entity in the database.- Overrides:
savein classAbstractStore<T extends Searchable>- Parameters:
entity- the entity- Returns:
- the updated entity
-
updateIndex
The methodupdateIndexprovides means to update all entries in the database. Note that entries which are gone are not removed!- Specified by:
updateIndexin interfaceIndexingStore- Throws:
IOException- in case of an I/O errororg.apache.lucene.index.CorruptIndexException- in case of an error in an index
-