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 methodgetByIdprovides means to retrieve the entity by its id.The methodlistprovides 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 methodlistQueryprovides means to construct a query for the list of entities for a search.The methodmapprovides means to format a list for external use.booleanThe methodremoveprovides means to remove an entity by its id.voidThe methodremoveprovides means to remove a list of entities.booleanThe methodremoveprovides means to remove an entity.The methodsaveprovides 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 methodgetByIdprovides means to retrieve the entity by its id.- Parameters:
id- the id- Returns:
- the entity or
nullif non is present
-
list
The methodlistprovides 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 methodlistQueryprovides 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 methodmapprovides means to format a list for external use.- Parameters:
list- the list of entries- Returns:
- the formatted list
-
remove
The methodremoveprovides means to remove a list of entities.- Parameters:
list- the list of entries
-
remove
The methodremoveprovides means to remove an entity by its id.- Parameters:
id- the id- Returns:
trueiff something has been removed
-
remove
The methodremoveprovides means to remove an entity.- Parameters:
entity- the entity- Returns:
trueiff something has been removed
-
save
The methodsaveprovides means to store an entity in the database.- Parameters:
entity- the entity- Returns:
- the entity
-