fr.paris.lutece.plugins.quiz.business
Class QuestionGroupDAO

java.lang.Object
  extended by fr.paris.lutece.plugins.quiz.business.QuestionGroupDAO
All Implemented Interfaces:
IQuestionGroupDAO

public final class QuestionGroupDAO
extends Object
implements IQuestionGroupDAO

This class provides Data Access methods for QuestionGroup objects


Constructor Summary
QuestionGroupDAO()
           
 
Method Summary
 void changePositionDown(int nIdQuiz, QuestionGroup group, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Move down a group
 void changePositionUp(int nIdQuiz, QuestionGroup group, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Move up a group
 void delete(int nIdQuiz, int nGroupId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Delete a record from the table
 void deleteByQuiz(int nIdQuiz, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Delete for a quiz
 int findLastByQuiz(int nIdQuiz, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Find the id of last group in quiz
 boolean hasGroupDisplayScore(int nIdQuiz, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Check if a quiz has a free HTML group that will display the score of the quiz
 void insert(int nIdQuiz, QuestionGroup group, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Insert a new record in the table.
 QuestionGroup load(int nId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the data from the table
 QuestionGroup selectQuestionGroupByPosition(int nIdQuiz, int nPosition, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Find a group by its quiz and position
 List<QuestionGroup> selectQuestionGroupsList(int nIdQuiz, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the data of all the group objects and returns them as a List
 fr.paris.lutece.util.ReferenceList selectQuestionGroupsReferenceList(int nIdQuiz, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns a list of groups
 void store(QuestionGroup group, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update the record in the table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuestionGroupDAO

public QuestionGroupDAO()
Method Detail

insert

public void insert(int nIdQuiz,
                   QuestionGroup group,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Insert a new record in the table.

Specified by:
insert in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The quiz ID
group - instance of the QuestionGroup object to inssert
plugin - the Plugin

load

public QuestionGroup load(int nId,
                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the data from the table

Specified by:
load in interface IQuestionGroupDAO
Parameters:
nId - The identifier of the group
plugin - the Plugin
Returns:
The instance of the group

delete

public void delete(int nIdQuiz,
                   int nGroupId,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Delete a record from the table

Specified by:
delete in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The Quiz ID
nGroupId - int identifier of the QuestionGroup to delete
plugin - the Plugin

store

public void store(QuestionGroup group,
                  fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update the record in the table

Specified by:
store in interface IQuestionGroupDAO
Parameters:
group - the reference of the QuestionGroup
plugin - the Plugin

selectQuestionGroupsList

public List<QuestionGroup> selectQuestionGroupsList(int nIdQuiz,
                                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the data of all the group objects and returns them as a List

Specified by:
selectQuestionGroupsList in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The Quiz Id
plugin - the Plugin
Returns:
The List which contains the data of all the group objects

selectQuestionGroupsReferenceList

public fr.paris.lutece.util.ReferenceList selectQuestionGroupsReferenceList(int nIdQuiz,
                                                                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns a list of groups

Specified by:
selectQuestionGroupsReferenceList in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The Quiz ID
plugin - The plugin
Returns:
The list

selectQuestionGroupByPosition

public QuestionGroup selectQuestionGroupByPosition(int nIdQuiz,
                                                   int nPosition,
                                                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Find a group by its quiz and position

Specified by:
selectQuestionGroupByPosition in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The quiz ID
nPosition - The position of the required group
plugin - the Plugin
Returns:
The requested group, or null if no group has the given position

deleteByQuiz

public void deleteByQuiz(int nIdQuiz,
                         fr.paris.lutece.portal.service.plugin.Plugin plugin)
Delete for a quiz

Specified by:
deleteByQuiz in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The Quiz ID
plugin - The plugin

changePositionUp

public void changePositionUp(int nIdQuiz,
                             QuestionGroup group,
                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Move up a group

Specified by:
changePositionUp in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The quiz Id
group - The group
plugin - The plugin

changePositionDown

public void changePositionDown(int nIdQuiz,
                               QuestionGroup group,
                               fr.paris.lutece.portal.service.plugin.Plugin plugin)
Move down a group

Specified by:
changePositionDown in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The quiz Id
group - The group
plugin - The plugin

findLastByQuiz

public int findLastByQuiz(int nIdQuiz,
                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
Find the id of last group in quiz

Specified by:
findLastByQuiz in interface IQuestionGroupDAO
Parameters:
nIdQuiz - the quiz id
plugin - the plugin
Returns:
the id of corresponding group

hasGroupDisplayScore

public boolean hasGroupDisplayScore(int nIdQuiz,
                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
Check if a quiz has a free HTML group that will display the score of the quiz

Specified by:
hasGroupDisplayScore in interface IQuestionGroupDAO
Parameters:
nIdQuiz - The id of the quiz
plugin - The plugin
Returns:
True if the quiz has a free HTML group that will display the result of the quiz, false otherwise


Copyright © 2014 Mairie de Paris. All Rights Reserved.