Interface QuestionRepository

All Known Implementing Classes:
QuestionRepositoryImpl

public interface QuestionRepository
Interface for QuestionRepository.
Version:
0.4.1
Author:
Khalil
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Question question)
    Inserts an instance of Question in the database
    get(int id)
    Finds the question identified by id in the database
    Finds all the questions in the database
    getAllLazy(int offset, int limit)
    Finds all the questions in the database with lazy loading
    getByCategory(int categoryId)
    Finds the question identified by id of the category in the database
    getByCategoryLazy(int categoryId, int offset, int limit)
    Finds the question identified by id of the category in the database with Lazy Loading parameters:
    getBySurveyId(int surveyId)
    Finds the question identified by id in the database
    Finds the question in the database where text is contained in the text of the question
    getByTextLazy(String text, int offset, int limit)
    Finds the question in the database where text is contained in the text of the question with Lazy Loading parameters: offset and limit
    getByUser(int userId)
    Finds the question in the database created by a specified user
    getByUserLazy(int userId, int offset, int limit)
    Finds the question in the database created by a specified user with Lazy Loading parameters:
    void
    modify(Question question)
    Updates a question in the database using a new instance of Question.
    void
    remove(int id)
    Deletes from the database the question identified by id.
  • Method Details

    • add

      void add(Question question)
      Inserts an instance of Question in the database
      Parameters:
      question - an instance of Question
      See Also:
    • get

      Question get(int id) throws NotFoundException
      Finds the question identified by id in the database
      Parameters:
      id - the id of the question to be found
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
      Throws:
      NotFoundException - if no question identified by id has been found
    • getAll

      Finds all the questions in the database
      Returns:
      all the instances of Question, null otherwise
      Throws:
      NotFoundException
    • getAllLazy

      Iterable<Question> getAllLazy(int offset, int limit)
      Finds all the questions in the database with lazy loading
      Parameters:
      offset - initial position for the query
      limit - limiting query results
      Returns:
      all the instances of Question, null otherwise
    • getBySurveyId

      Iterable<Question> getBySurveyId(int surveyId)
      Finds the question identified by id in the database
      Parameters:
      surveyId - the id of the question to be found
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
    • getByText

      Iterable<Question> getByText(String text)
      Finds the question in the database where text is contained in the text of the question
      Parameters:
      text - the text of the question to be found
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
    • getByTextLazy

      Iterable<Question> getByTextLazy(String text, int offset, int limit)
      Finds the question in the database where text is contained in the text of the question with Lazy Loading parameters: offset and limit
      Parameters:
      text - the text of the question to be found
      offset - initial position for the query
      limit - limiting query results
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
    • getByUser

      Iterable<Question> getByUser(int userId)
      Finds the question in the database created by a specified user
      Parameters:
      userId - id of the user
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
    • getByUserLazy

      Iterable<Question> getByUserLazy(int userId, int offset, int limit)
      Finds the question in the database created by a specified user with Lazy Loading parameters:
      Parameters:
      userId - id of the user
      offset - initial position for the query
      limit - limiting query results
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
    • getByCategory

      Iterable<Question> getByCategory(int categoryId)
      Finds the question identified by id of the category in the database
      Parameters:
      categoryId - the id of the category
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
    • getByCategoryLazy

      Iterable<Question> getByCategoryLazy(int categoryId, int offset, int limit)
      Finds the question identified by id of the category in the database with Lazy Loading parameters:
      Parameters:
      categoryId - the id of the category
      offset - initial position for the query
      limit - limiting query results
      Returns:
      an instance of Question if there is a question identified by id, null otherwise
    • remove

      void remove(int id) throws NotFoundException
      Deletes from the database the question identified by id.
      Parameters:
      id - the id of the question to be deleted
      Throws:
      NotFoundException - if no question identified by id has been found
    • modify

      void modify(Question question)
      Updates a question in the database using a new instance of Question.
      Parameters:
      question - the new instance of Question