java.lang.Object
fr.paris.lutece.plugins.wiki.modules.quiz.business.QuizAttemptDAO
All Implemented Interfaces:
IQuizAttemptDAO

@ApplicationScoped public class QuizAttemptDAO extends Object implements IQuizAttemptDAO
Implementation of quiz attempt data access object.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    countByQuizAndUser(int nIdQuiz, String strUserGuid, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Counts the number of attempts for a specific quiz by a specific user.
    void
    insert(QuizAttempt attempt, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Inserts a new quiz attempt into the database.
    load(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Loads a quiz attempt by its primary key.
    selectByQuiz(int nIdQuiz, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Retrieves all attempts for a specific quiz.
    selectByQuizAndUser(int nIdQuiz, String strUserGuid, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Retrieves all attempts for a specific quiz by a specific user.
    void
    store(QuizAttempt attempt, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Updates an existing quiz attempt in the database.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • QuizAttemptDAO

      public QuizAttemptDAO()
  • Method Details

    • insert

      public void insert(QuizAttempt attempt, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Inserts a new quiz attempt into the database.
      Specified by:
      insert in interface IQuizAttemptDAO
      Parameters:
      attempt - The quiz attempt to insert
      plugin - The plugin instance
    • load

      public Optional<QuizAttempt> load(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Loads a quiz attempt by its primary key.
      Specified by:
      load in interface IQuizAttemptDAO
      Parameters:
      nKey - The attempt ID
      plugin - The plugin instance
      Returns:
      An optional containing the quiz attempt if found
    • store

      public void store(QuizAttempt attempt, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Updates an existing quiz attempt in the database.
      Specified by:
      store in interface IQuizAttemptDAO
      Parameters:
      attempt - The quiz attempt to update
      plugin - The plugin instance
    • selectByQuiz

      public List<QuizAttempt> selectByQuiz(int nIdQuiz, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Retrieves all attempts for a specific quiz.
      Specified by:
      selectByQuiz in interface IQuizAttemptDAO
      Parameters:
      nIdQuiz - The quiz ID
      plugin - The plugin instance
      Returns:
      A list of quiz attempts for the quiz
    • selectByQuizAndUser

      public List<QuizAttempt> selectByQuizAndUser(int nIdQuiz, String strUserGuid, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Retrieves all attempts for a specific quiz by a specific user.
      Specified by:
      selectByQuizAndUser in interface IQuizAttemptDAO
      Parameters:
      nIdQuiz - The quiz ID
      strUserGuid - The user GUID
      plugin - The plugin instance
      Returns:
      A list of quiz attempts for the quiz and user
    • countByQuizAndUser

      public int countByQuizAndUser(int nIdQuiz, String strUserGuid, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Counts the number of attempts for a specific quiz by a specific user.
      Specified by:
      countByQuizAndUser in interface IQuizAttemptDAO
      Parameters:
      nIdQuiz - The quiz ID
      strUserGuid - The user GUID
      plugin - The plugin instance
      Returns:
      The count of attempts