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

java.lang.Object
  extended by fr.paris.lutece.plugins.quiz.business.AnswerHome

public final class AnswerHome
extends java.lang.Object

This class provides instances management methods (create, find, ...) for Answer objects


Method Summary
static Answer create(int nIdQuestion, Answer answer, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Create an instance of the answer class
static Answer findByPrimaryKey(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns an instance of a answer whose identifier is specified in parameter
static java.util.List<Answer> getAnswersList(int nIdQuestion, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Load the data of all the answer objects and returns them in form of a list
static int getValidAnswerCount(int nIdQuestion, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Return valid answer count for a given question
static void remove(int nAnswerId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove the answer whose identifier is specified in parameter
static void removeAnswersByQuestion(int nIdQuestion, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove answer for a given question
static void removeAnswersByQuiz(java.util.Collection<QuizQuestion> questionList, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove answers for a Quiz
static Answer update(Answer answer, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update of the answer which is specified in parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getValidAnswerCount

public static int getValidAnswerCount(int nIdQuestion,
                                      fr.paris.lutece.portal.service.plugin.Plugin plugin)
Return valid answer count for a given question

Parameters:
nIdQuestion - the question id
plugin - The plugin
Returns:
The count of valid answer

create

public static Answer create(int nIdQuestion,
                            Answer answer,
                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
Create an instance of the answer class

Parameters:
nIdQuestion - The question Id
answer - The instance of the Answer which contains the informations to store
plugin - the Plugin
Returns:
The instance of answer which has been created with its primary key.

update

public static Answer update(Answer answer,
                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update of the answer which is specified in parameter

Parameters:
answer - The instance of the Answer which contains the data to store
plugin - the Plugin
Returns:
The instance of the answer which has been updated

remove

public static void remove(int nAnswerId,
                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove the answer whose identifier is specified in parameter

Parameters:
nAnswerId - The answer Id
plugin - the Plugin

findByPrimaryKey

public static Answer findByPrimaryKey(int nKey,
                                      fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns an instance of a answer whose identifier is specified in parameter

Parameters:
nKey - The answer primary key
plugin - the Plugin
Returns:
an instance of Answer

getAnswersList

public static java.util.List<Answer> getAnswersList(int nIdQuestion,
                                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
Load the data of all the answer objects and returns them in form of a list

Parameters:
nIdQuestion - the id of the question
plugin - the Plugin
Returns:
the list which contains the data of all the answer objects

removeAnswersByQuiz

public static void removeAnswersByQuiz(java.util.Collection<QuizQuestion> questionList,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove answers for a Quiz

Parameters:
questionList - The question list
plugin - The plugin

removeAnswersByQuestion

public static void removeAnswersByQuestion(int nIdQuestion,
                                           fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove answer for a given question

Parameters:
nIdQuestion - The question ID
plugin - The plugin


Copyright © 2011 Mairie de Paris. All Rights Reserved.