Interface AnswerRepository

All Known Implementing Classes:
AnswerRepositoryImpl

public interface AnswerRepository
Interface for AnswerRepository.
Version:
0.4.1
Author:
Davide Costantini
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clean(int surveyId, int userId)
    Deletes the registered answers made by the user identified by userId on the survey identified by surveyId.
    void
    commit(int surveyId, int userId)
    Deletes the registered answers made by the user identified by userId on the survey identified by surveyId.
    void
    commitInsert(int surveyId, int userId)
    Inserts the registered answers made by the user identified by userId on the survey identified by surveyId.
    get(int id)
    Finds the answer identified by id in the database
    getSurveyAnswersForUser(int surveyId, int userId)
    Finds all the answers the user created for a survey.
    void
    Adds answer to the elements to be deleted.
    void
    Adds answer to the elements to be modified.
    void
    Adds answer to the elements to be inserted.
  • Method Details

    • get

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

      Iterable<Answer> getSurveyAnswersForUser(int surveyId, int userId)
      Finds all the answers the user created for a survey.
      Parameters:
      surveyId - the id of the Survey
      userId - the id of the User
      Returns:
      an instance of Answer if there is an answer identified by id, null otherwise
      See Also:
    • registerNew

      void registerNew(Answer answer)
      Adds answer to the elements to be inserted.
      Parameters:
      answer - the new Answer
      See Also:
    • registerDeleted

      void registerDeleted(Answer answer)
      Adds answer to the elements to be deleted.
      Parameters:
      answer - the answer to be deleted
      See Also:
    • registerModified

      void registerModified(Answer answer)
      Adds answer to the elements to be modified.
      Parameters:
      answer - the answer that will replace the Answer with the same id
      See Also:
    • commitInsert

      void commitInsert(int surveyId, int userId)
      Inserts the registered answers made by the user identified by userId on the survey identified by surveyId.
      Parameters:
      surveyId - the id of the survey
      userId - the id of the user
    • commit

      void commit(int surveyId, int userId)
      Deletes the registered answers made by the user identified by userId on the survey identified by surveyId.
      Parameters:
      surveyId - the id of the survey
      userId - the id of the user
    • clean

      void clean(int surveyId, int userId)
      Deletes the registered answers made by the user identified by userId on the survey identified by surveyId.
      Parameters:
      surveyId - the id of the survey
      userId - the id of the user