Class VoteStore

java.lang.Object
io.dropwizard.hibernate.AbstractDAO<Vote>
org.ctan.site.stores.base.AbstractStore<Vote>
org.ctan.site.stores.VoteStore

public class VoteStore extends AbstractStore<Vote>
The class VoteStore contains the repository for votes.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The class CountInfo contains the transport object for the statistics data.
  • Constructor Summary

    Constructors
    Constructor
    Description
    VoteStore(org.hibernate.SessionFactory sessionFactory)
    This is the constructor for the VoteStore.
  • Method Summary

    Modifier and Type
    Method
    Description
    The method count provides means to retrieve a mean and number of votes for a package by its key.
    The method findByAccount provides means to retrieve the votes of a user.
    The method findByPkg provides means to retrieve a list of votes for a package.
    The method getByAccountAndPkg provides 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 method listQuery provides means to construct a query for the list of entities for a search.
    protected List<Map<String,Object>>
    map(List<Vote> list)
    The method map provides means to format a list for external use.

    Methods inherited from class org.ctan.site.stores.base.AbstractStore

    getById, list, remove, remove, remove, save

    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

    • VoteStore

      public VoteStore(org.hibernate.SessionFactory sessionFactory)
      This is the constructor for the VoteStore.
      Parameters:
      sessionFactory - the session factory
  • Method Details

    • count

      public VoteStore.CountInfo count(String key)
      The method count provides 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

      public List<Vote> findByAccount(User user)
      The method findByAccount provides means to retrieve the votes of a user.
      Parameters:
      user - the user
    • findByPkg

      public List<Vote> findByPkg(Pkg pkg)
      The method findByPkg provides 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

      public Vote getByAccountAndPkg(User user, Pkg pkg)
      The method getByAccountAndPkg provides means to retrieve the vote of a user for a package.
      Parameters:
      user - the user
      pkg - the package
    • listQuery

      protected jakarta.persistence.criteria.Root<Vote> listQuery(String term, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<Vote> query)
      The method listQuery provides means to construct a query for the list of entities for a search.
      Specified by:
      listQuery in class AbstractStore<Vote>
      Parameters:
      term - the search term
      cb - the criteria builder
      query - the query
      Returns:
      the root
      See Also:
    • map

      protected List<Map<String,Object>> map(List<Vote> list)
      The method map provides means to format a list for external use.
      Specified by:
      map in class AbstractStore<Vote>
      Parameters:
      list - the list of entries
      Returns:
      the formatted list
      See Also: