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

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

public final class AnswerDAO
extends Object
implements IAnswerDAO

This class provides Data Access methods for Answer objects


Constructor Summary
AnswerDAO()
           
 
Method Summary
 void delete(int nAnswerId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Delete a record from the table
 void deleteAnswersByQuestion(int nIdQuestion, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Delete answers for a given question
 void insert(int nIdQuestion, Answer answer, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Insert a new record in the table.
 boolean isAnswersWithProfil(int nIdProfil, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the data of the answer from the table
 Answer load(int nId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the data of the answer from the table
 int newPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Generates a new primary key
 List<Answer> selectAnswersList(int nIdQuestion, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the data of all the answers and returns them as a List
 void store(Answer answer, 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

AnswerDAO

public AnswerDAO()
Method Detail

newPrimaryKey

public int newPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Generates a new primary key

Parameters:
plugin - The Plugin
Returns:
The new primary key

insert

public void insert(int nIdQuestion,
                   Answer answer,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Insert a new record in the table.

Specified by:
insert in interface IAnswerDAO
Parameters:
nIdQuestion - Question ID
answer - instance of the Answer object to insert
plugin - The plugin

load

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

Specified by:
load in interface IAnswerDAO
Parameters:
nId - The identifier of the answer
plugin - The plugin
Returns:
the instance of the Answer

delete

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

Specified by:
delete in interface IAnswerDAO
Parameters:
nAnswerId - The identifier of the answer
plugin - The plugin

store

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

Specified by:
store in interface IAnswerDAO
Parameters:
answer - The reference of the answer
plugin - The plugin

selectAnswersList

public List<Answer> selectAnswersList(int nIdQuestion,
                                      fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the data of all the answers and returns them as a List

Specified by:
selectAnswersList in interface IAnswerDAO
Parameters:
nIdQuestion - the id of the question
plugin - The plugin
Returns:
The List which contains the data of all the answers

deleteAnswersByQuestion

public void deleteAnswersByQuestion(int nIdQuestion,
                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
Delete answers for a given question

Specified by:
deleteAnswersByQuestion in interface IAnswerDAO
Parameters:
nIdQuestion - The question Id
plugin - The plugin

isAnswersWithProfil

public boolean isAnswersWithProfil(int nIdProfil,
                                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the data of the answer from the table

Specified by:
isAnswersWithProfil in interface IAnswerDAO
Parameters:
nIdProfil - The identifier of the profil
plugin - The plugin
Returns:
true if there is at least one answer with profil, false otherwise


Copyright © 2014 Mairie de Paris. All Rights Reserved.