Class QuizQuestionHome
java.lang.Object
fr.paris.lutece.plugins.wiki.modules.quiz.business.QuizQuestionHome
Home class for QuizQuestion providing static service methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic QuizQuestioncreate(QuizQuestion question) Creates a new quiz question in the database.static Optional<QuizQuestion>findByPrimaryKey(int nKey) Retrieves a quiz question by its primary key.static intgetNextDisplayOrder(int nIdQuiz) Gets the next display order for a new question in a quiz.static List<QuizQuestion>getQuestionsByQuiz(int nIdQuiz) Retrieves all questions for a specific quiz.getSourcePageIds(int nIdQuestion) Retrieves the IDs of pages that are sources for a question.static voidremove(int nKey) Removes a quiz question from the database.static voidsetSourcePages(int nIdQuestion, List<Integer> listPageIds) Sets the source pages for a question, replacing any existing links.static QuizQuestionupdate(QuizQuestion question) Updates an existing quiz question in the database.
-
Method Details
-
create
Creates a new quiz question in the database.- Parameters:
question- The quiz question to create- Returns:
- The created quiz question with its ID set
-
update
Updates an existing quiz question in the database.- Parameters:
question- The quiz question to update- Returns:
- The updated quiz question
-
remove
public static void remove(int nKey) Removes a quiz question from the database.- Parameters:
nKey- The question ID
-
findByPrimaryKey
Retrieves a quiz question by its primary key.- Parameters:
nKey- The question ID- Returns:
- An optional containing the quiz question if found
-
getQuestionsByQuiz
Retrieves all questions for a specific quiz.- Parameters:
nIdQuiz- The quiz ID- Returns:
- A list of quiz questions for the quiz
-
getNextDisplayOrder
public static int getNextDisplayOrder(int nIdQuiz) Gets the next display order for a new question in a quiz.- Parameters:
nIdQuiz- The quiz ID- Returns:
- The next display order
-
getSourcePageIds
Retrieves the IDs of pages that are sources for a question.- Parameters:
nIdQuestion- The question ID- Returns:
- A list of source page IDs
-
setSourcePages
Sets the source pages for a question, replacing any existing links.- Parameters:
nIdQuestion- The question IDlistPageIds- The list of page IDs to link
-