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:
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 methodcount
provides means to count the entities in the database.findAll()
The methodfindAll
provides means to find a list of all entries.boolean
The methodremove
provides means to remove an entity.The methodsave
provides means to store an entity in the database.void
The methodupdateIndex
provides means to update all entries in the database.Methods inherited from class org.ctan.site.stores.base.AbstractStore
getById, list, listQuery, map, remove, remove
Methods 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 methodcount
provides means to count the entities in the database.- Returns:
- the total number of entities
-
findAll
The methodfindAll
provides means to find a list of all entries.- Returns:
- the list of entries
-
remove
The methodremove
provides means to remove an entity. A new session is created and closed at the end.- Overrides:
remove
in classAbstractStore<T extends Searchable>
- Parameters:
entity
- the entity- Returns:
true
iff something has been removed
-
save
The methodsave
provides means to store an entity in the database.- Overrides:
save
in classAbstractStore<T extends Searchable>
- Parameters:
entity
- the entity- Returns:
- the updated entity
-
updateIndex
The methodupdateIndex
provides means to update all entries in the database. Note that entries which are gone are not removed!- Specified by:
updateIndex
in interfaceIndexingStore
- Throws:
IOException
- in case of an I/O errororg.apache.lucene.index.CorruptIndexException
- in case of an error in an index
-