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

    Constructors
    Constructor
    Description
    AbstractIndexingStore(@NonNull org.hibernate.SessionFactory sessionFactory, @NonNull IndexingSession indexingSession)
    This is the constructor for AbstractStore.
  • Method Summary

    Modifier and Type
    Method
    Description
    The method count provides means to count the entities in the database.
    The method findAll provides means to find a list of all entries.
    boolean
    remove(T entity)
    The method remove provides means to remove an entity.
    save(T entity)
    The method save provides means to store an entity in the database.
    void
    The method updateIndex 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractIndexingStore

      public AbstractIndexingStore(@NonNull @NonNull org.hibernate.SessionFactory sessionFactory, @NonNull @NonNull IndexingSession indexingSession)
      This is the constructor for AbstractStore.
      Parameters:
      sessionFactory - the session factory
      indexingSession - the indexing session
  • Method Details

    • count

      public Long count()
      The method count provides means to count the entities in the database.
      Returns:
      the total number of entities
    • findAll

      public List<T> findAll()
      The method findAll provides means to find a list of all entries.
      Returns:
      the list of entries
    • remove

      public boolean remove(@NonNull T entity)
      The method remove provides means to remove an entity. A new session is created and closed at the end.
      Overrides:
      remove in class AbstractStore<T extends Searchable>
      Parameters:
      entity - the entity
      Returns:
      true iff something has been removed
    • save

      public T save(@NonNull T entity)
      The method save provides means to store an entity in the database.
      Overrides:
      save in class AbstractStore<T extends Searchable>
      Parameters:
      entity - the entity
      Returns:
      the updated entity
    • updateIndex

      public void updateIndex() throws org.apache.lucene.index.CorruptIndexException, IOException
      The method updateIndex provides means to update all entries in the database. Note that entries which are gone are not removed!
      Specified by:
      updateIndex in interface IndexingStore
      Throws:
      IOException - in case of an I/O error
      org.apache.lucene.index.CorruptIndexException - in case of an error in an index