Interface AnswerRepository
- All Known Implementing Classes:
AnswerRepositoryImpl
public interface AnswerRepository
Interface for AnswerRepository.
- Version:
- 0.4.1
- Author:
- Davide Costantini
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clean
(int surveyId, int userId) Deletes the registered answers made by the user identified byuserId
on the survey identified bysurveyId
.void
commit
(int surveyId, int userId) Deletes the registered answers made by the user identified byuserId
on the survey identified bysurveyId
.void
commitInsert
(int surveyId, int userId) Inserts the registered answers made by the user identified byuserId
on 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.void
registerDeleted
(Answer answer) Addsanswer
to the elements to be deleted.void
registerModified
(Answer answer) Addsanswer
to the elements to be modified.void
registerNew
(Answer answer) Addsanswer
to 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 byid
has 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
Addsanswer
to the elements to be inserted.- Parameters:
answer
- the new Answer- See Also:
-
registerDeleted
Addsanswer
to the elements to be deleted.- Parameters:
answer
- the answer to be deleted- See Also:
-
registerModified
Addsanswer
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 byuserId
on 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 byuserId
on 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 byuserId
on the survey identified bysurveyId
.- Parameters:
surveyId
- the id of the surveyuserId
- the id of the user
-