Interface SurveyRepository
- All Known Implementing Classes:
SurveyRepositoryImpl
public interface SurveyRepository
Repository for SurveyRepository.
- Version:
- 0.4.1
- Author:
- Luca Milazzo
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts an instance of Survey in the databaseget
(int id) Finds the survey identified by id in the databasegetAll()
Returns all surveys in the database.getAllLazy
(int offset, int limit) Returns all surveys in the database with lazy Loading.getByCompilationCode
(String code) Finds the Survey in the database where text is contained in the name of the surveygetByTextLazy
(String text, int offset, int limit) Finds the Survey in the database where text is contained in the name of the survey with Lazy Loadingvoid
modifyName
(String name, int id) Updates the survey namevoid
modifyQuestions
(Set<SurveyQuestions> surveyQuestions, int surveyId) Updates all the questions of survey in the database.void
remove
(int id) Deletes from the database the survey identified by id.
-
Method Details
-
add
Inserts an instance of Survey in the database- Parameters:
survey
- an instance of Survey- Throws:
FormatException
-
get
Finds the survey identified by id in the database- Parameters:
id
- the id of the survey to be found- Returns:
- an instance of Survey if there is a survey identified by id, null otherwise
- Throws:
NotFoundException
-
getByText
Finds the Survey in the database where text is contained in the name of the survey- Parameters:
text
- the text to be found in the name of the survey- Returns:
- a list of Surveys the text is contained in the name of the survey
- Throws:
NotFoundException
-
getByTextLazy
Finds the Survey in the database where text is contained in the name of the survey with Lazy Loading- Parameters:
text
- the text to be found in the name of the surveyoffset
-limit
-- Returns:
- a list of Surveys the text is contained in the name of the survey
- Throws:
NotFoundException
-
getAll
Returns all surveys in the database.- Returns:
- a Set of Surveys
- Throws:
NotFoundException
-
getAllLazy
Returns all surveys in the database with lazy Loading.- Parameters:
offset
-limit
-- Returns:
- a Set of Surveys
- Throws:
NotFoundException
-
remove
Deletes from the database the survey identified by id.- Parameters:
id
- the id of the survey to be deleted- Throws:
FormatException
-
modifyQuestions
Updates all the questions of survey in the database.- Parameters:
surveyQuestions
- new questions of Survey- Throws:
FormatException
- See Also:
-
SurveyRepository#modify
-
modifyName
Updates the survey name- Parameters:
survey
- the new instance of Survey- Throws:
FormatException
EmptyFieldException
NotFoundException
- See Also:
-
SurveyRepository#modify
-
getByCompilationCode
- Throws:
NotFoundException
-