Package org.ctan.site.stores.base
Class AbstractStore<T>
java.lang.Object
io.dropwizard.hibernate.AbstractDAO<T>
org.ctan.site.stores.base.AbstractStore<T>
- Type Parameters:
T
- the type of the entity
- Direct Known Subclasses:
AbstractIndexingStore
,MessageStore
,StopwordStore
,TexArchiveNotesStore
,UploadStore
,UserStopwordStore
,VoteStore
public abstract class AbstractStore<T>
extends io.dropwizard.hibernate.AbstractDAO<T>
The class
AbstractStore
contains the abstract repository for
CRUD operations on an entity.-
Constructor Summary
ConstructorsConstructorDescriptionAbstractStore
(org.hibernate.SessionFactory sessionFactory) This is the constructor forAbstractStore
. -
Method Summary
Modifier and TypeMethodDescriptionThe methodgetById
provides means to retrieve the entity by its id.The methodlist
provides means to extract a page of items.protected abstract jakarta.persistence.criteria.Root
<T> listQuery
(String term, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<T> query) The methodlistQuery
provides means to construct a query for the list of entities for a search.The methodmap
provides means to format a list for external use.boolean
The methodremove
provides means to remove an entity by its id.void
The methodremove
provides means to remove a list of entities.boolean
The methodremove
provides means to remove an entity.The methodsave
provides means to store an entity in the database.Methods inherited from class io.dropwizard.hibernate.AbstractDAO
criteriaQuery, currentSession, get, getEntityClass, initialize, list, list, namedQuery, namedTypedQuery, persist, query, uniqueResult, uniqueResult
-
Constructor Details
-
AbstractStore
public AbstractStore(org.hibernate.SessionFactory sessionFactory) This is the constructor forAbstractStore
.- Parameters:
sessionFactory
- the session factory
-
-
Method Details
-
getById
The methodgetById
provides means to retrieve the entity by its id.- Parameters:
id
- the id- Returns:
- the entity or
null
if non is present
-
list
The methodlist
provides means to extract a page of items.- Parameters:
term
- the search termpage
- the current pagepageSize
- the page sizeorderBy
- the orderasc
- the indicator for ascending- Returns:
- the page
-
listQuery
protected abstract jakarta.persistence.criteria.Root<T> listQuery(String term, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<T> query) The methodlistQuery
provides means to construct a query for the list of entities for a search.- Parameters:
term
- the search termcb
- the criteria builderquery
- the query- Returns:
- the root
-
map
The methodmap
provides means to format a list for external use.- Parameters:
list
- the list of entries- Returns:
- the formatted list
-
remove
The methodremove
provides means to remove a list of entities.- Parameters:
list
- the list of entries
-
remove
The methodremove
provides means to remove an entity by its id.- Parameters:
id
- the id- Returns:
true
iff something has been removed
-
remove
The methodremove
provides means to remove an entity.- Parameters:
entity
- the entity- Returns:
true
iff something has been removed
-
save
The methodsave
provides means to store an entity in the database.- Parameters:
entity
- the entity- Returns:
- the entity
-