Package org.ctan.site.stores
Class VoteStore
java.lang.Object
io.dropwizard.hibernate.AbstractDAO<Vote>
The class
VoteStore contains the repository for votes.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe classCountInfocontains the transport object for the statistics data. -
Constructor Summary
ConstructorsConstructorDescriptionVoteStore(org.hibernate.SessionFactory sessionFactory) This is the constructor for theVoteStore. -
Method Summary
Modifier and TypeMethodDescriptionThe methodcountprovides means to retrieve a mean and number of votes for a package by its key.findByAccount(User user) The methodfindByAccountprovides means to retrieve the votes of a user.The methodfindByPkgprovides means to retrieve a list of votes for a package.getByAccountAndPkg(User user, Pkg pkg) The methodgetByAccountAndPkgprovides means to retrieve the vote of a user for a package.protected jakarta.persistence.criteria.Root<Vote> listQuery(String term, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<Vote> 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.Methods inherited from class org.ctan.site.stores.base.AbstractStore
getById, list, remove, remove, remove, saveMethods inherited from class io.dropwizard.hibernate.AbstractDAO
criteriaQuery, currentSession, get, getEntityClass, initialize, list, list, namedQuery, namedTypedQuery, persist, query, uniqueResult, uniqueResult
-
Constructor Details
-
VoteStore
public VoteStore(org.hibernate.SessionFactory sessionFactory) This is the constructor for theVoteStore.- Parameters:
sessionFactory- the session factory
-
-
Method Details
-
count
The methodcountprovides means to retrieve a mean and number of votes for a package by its key.- Parameters:
key- the key of the package- Returns:
- the summary
-
findByAccount
The methodfindByAccountprovides means to retrieve the votes of a user.- Parameters:
user- the user
-
findByPkg
The methodfindByPkgprovides means to retrieve a list of votes for a package.- Parameters:
pkg- the package key- Returns:
- the list of votes ordered by modification time
-
getByAccountAndPkg
The methodgetByAccountAndPkgprovides means to retrieve the vote of a user for a package.- Parameters:
user- the userpkg- the package
-
listQuery
protected jakarta.persistence.criteria.Root<Vote> listQuery(String term, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<Vote> query) The methodlistQueryprovides means to construct a query for the list of entities for a search.- Specified by:
listQueryin classAbstractStore<Vote>- Parameters:
term- the search termcb- the criteria builderquery- the query- Returns:
- the root
- See Also:
-
map
The methodmapprovides means to format a list for external use.- Specified by:
mapin classAbstractStore<Vote>- Parameters:
list- the list of entries- Returns:
- the formatted list
- See Also:
-