Class AuthorStore

All Implemented Interfaces:
IndexingStore

public class AuthorStore extends AbstractIndexingStore<Author>
The class AuthorStore contains the repository for authors.
  • Constructor Details

    • AuthorStore

      public AuthorStore(org.hibernate.SessionFactory sessionFactory, IndexingSession indexingSession)
      This is the constructor for the AuthorStore.
      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.
      Overrides:
      count in class AbstractIndexingStore<Author>
      Returns:
      the total number of entities
    • findAll

      public List<Author> findAll()
      The method findAll provides means to retrieve authors.
      Overrides:
      findAll in class AbstractIndexingStore<Author>
      Returns:
      the list of authors sorted by key
    • findAllByKeyStartingWith

      public List<Author> findAllByKeyStartingWith(String s)
      The method findAllByKeyStartingWith provides means to retrieve authors where the key is starting with a given string. The comparison is done case-insensitive.
      Parameters:
      s - the initial segment
      Returns:
      the list of authors ordered by the key
    • findAllByNameContaining

      public List<Author> findAllByNameContaining(String s)
      The method findAllByNameContaining provides means to search for authors.
      Parameters:
      s - the string contained in the name
      Returns:
      the list of authors ordered by the key
    • findAllByNameStartingWith

      public List<Author> findAllByNameStartingWith(String s)
      The method findAllByNameStartingWith provides means to retrieve authors where the sort text is starting with a given string. The comparison is done case-insensitive.
      Parameters:
      s - the initial segment
      Returns:
      the list of authors ordered by the sort text
    • getByEmail

      public Author getByEmail(String email)
      The method getByEmail provides means to find an author by it email address.
      Parameters:
      email - the email address
      Returns:
      the author or null
    • getByKey

      public Author getByKey(String key)
      The method getByKey provides means to find an author by its key.
      Parameters:
      key - the key
      Returns:
      the author or null
    • list

      public GeneralPage list(String term, int page, int pageSize, String orderBy, boolean asc)
      The method list provides means to extract a page of items.
      Overrides:
      list in class AbstractStore<Author>
      Parameters:
      term - the search term
      page - the current page
      pageSize - the page size
      orderBy - the order
      asc - the indicator for ascending
      Returns:
      the paged results
    • listQuery

      protected jakarta.persistence.criteria.Root<Author> listQuery(String term, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<Author> query)
      The method listQuery provides means to construct a query for the list of entities for a search.
      Specified by:
      listQuery in class AbstractStore<Author>
      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<Author> list)
      The method map provides means to format a list for external use.
      Specified by:
      map in class AbstractStore<Author>
      Parameters:
      list - the list of entries
      Returns:
      the formatted list
      See Also:
    • set

      public Author set(@NonNull @NonNull String key, String attribute, String value)
      The method set provides means to set a single attribute to a new value.
      Parameters:
      key - the key
      attribute - the attribute name
      value - the attribute value
      Returns:
      true iff the change has been saved