Interface AnswerRepository
- All Known Implementing Classes:
AnswerRepositoryImpl
public interface AnswerRepository
Interface for AnswerRepository.
- Version:
- 0.4.1
- Author:
- Davide Costantini
-
Method Summary
Modifier and TypeMethodDescriptionvoidclean(int surveyId, int userId) Deletes the registered answers made by the user identified byuserIdon the survey identified bysurveyId.voidcommit(int surveyId, int userId) Deletes the registered answers made by the user identified byuserIdon the survey identified bysurveyId.voidcommitInsert(int surveyId, int userId) Inserts the registered answers made by the user identified byuserIdon the survey identified bysurveyId.get(int id) Finds the answer identified by id in the databasegetSurveyAnswersForUser(int surveyId, int userId) Finds all the answers the user created for a survey.voidregisterDeleted(Answer answer) Addsanswerto the elements to be deleted.voidregisterModified(Answer answer) Addsanswerto the elements to be modified.voidregisterNew(Answer answer) Addsanswerto the elements to be inserted.
-
Method Details
-
get
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 byidhas been found
-
getSurveyAnswersForUser
Finds all the answers the user created for a survey.- Parameters:
surveyId- the id of the SurveyuserId- the id of the User- Returns:
- an instance of Answer if there is an answer identified by id, null otherwise
- See Also:
-
registerNew
Addsanswerto the elements to be inserted.- Parameters:
answer- the new Answer- See Also:
-
registerDeleted
Addsanswerto the elements to be deleted.- Parameters:
answer- the answer to be deleted- See Also:
-
registerModified
Addsanswerto 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 byuserIdon the survey identified bysurveyId.- Parameters:
surveyId- the id of the surveyuserId- the id of the user
-
commit
void commit(int surveyId, int userId) Deletes the registered answers made by the user identified byuserIdon the survey identified bysurveyId.- Parameters:
surveyId- the id of the surveyuserId- the id of the user
-
clean
void clean(int surveyId, int userId) Deletes the registered answers made by the user identified byuserIdon the survey identified bysurveyId.- Parameters:
surveyId- the id of the surveyuserId- the id of the user
-