Class QuizQuestionHome

java.lang.Object
fr.paris.lutece.plugins.wiki.modules.quiz.business.QuizQuestionHome

public final class QuizQuestionHome extends Object
Home class for QuizQuestion providing static service methods.
  • Method Details

    • create

      public static QuizQuestion create(QuizQuestion question)
      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

      public static QuizQuestion update(QuizQuestion question)
      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

      public static Optional<QuizQuestion> findByPrimaryKey(int nKey)
      Retrieves a quiz question by its primary key.
      Parameters:
      nKey - The question ID
      Returns:
      An optional containing the quiz question if found
    • getQuestionsByQuiz

      public static List<QuizQuestion> getQuestionsByQuiz(int nIdQuiz)
      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

      public static List<Integer> getSourcePageIds(int nIdQuestion)
      Retrieves the IDs of pages that are sources for a question.
      Parameters:
      nIdQuestion - The question ID
      Returns:
      A list of source page IDs
    • setSourcePages

      public static void setSourcePages(int nIdQuestion, List<Integer> listPageIds)
      Sets the source pages for a question, replacing any existing links.
      Parameters:
      nIdQuestion - The question ID
      listPageIds - The list of page IDs to link