com.stratelia.webactiv.util.answer.ejb
Class AnswerDAO

java.lang.Object
  extended by com.stratelia.webactiv.util.answer.ejb.AnswerDAO

public class AnswerDAO
extends Object

This class is made to access database only (table SB_Question_Answer)

Author:
neysseri

Field Summary
static String ANSWERCOLUMNNAMES
           
 
Constructor Summary
AnswerDAO()
           
 
Method Summary
static void addAnswersToAQuestion(Connection con, Collection<Answer> answers, ForeignPK questionPK)
          Add some answers to a question
static void addAnswerToAQuestion(Connection con, Answer answer, ForeignPK questionPK)
          Add an answer to a question
static void deleteAnswersToAQuestion(Connection con, ForeignPK questionPK)
          Delete all answers to a given question
static void deleteAnswerToAQuestion(Connection con, ForeignPK questionPK, String answerId)
          Delete an answer to a question
static Collection<Answer> getAnswersByQuestionPK(Connection con, ForeignPK questionPK)
          Get answers which composed the question
static void recordThisAnswerAsVote(Connection con, ForeignPK questionPK, AnswerPK answerPK)
          Record that the answer (answerPK) has been chosen to the question (questionPK)
static void updateAnswerToAQuestion(Connection con, ForeignPK questionPK, Answer answer)
          Update an answer to a question
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANSWERCOLUMNNAMES

public static final String ANSWERCOLUMNNAMES
See Also:
Constant Field Values
Constructor Detail

AnswerDAO

public AnswerDAO()
Method Detail

getAnswersByQuestionPK

public static Collection<Answer> getAnswersByQuestionPK(Connection con,
                                                        ForeignPK questionPK)
                                                 throws SQLException
Get answers which composed the question

Parameters:
con - the Connection
questionPK - the QuestionPK (question id)
Returns:
a Collection of Answer
Throws:
SQLException

recordThisAnswerAsVote

public static void recordThisAnswerAsVote(Connection con,
                                          ForeignPK questionPK,
                                          AnswerPK answerPK)
                                   throws SQLException
Record that the answer (answerPK) has been chosen to the question (questionPK)

Parameters:
con - the Connection
questionPK - the QuestionPK (question id)
answerPK - the AnswerPK (answer id)
Throws:
SQLException

addAnswersToAQuestion

public static void addAnswersToAQuestion(Connection con,
                                         Collection<Answer> answers,
                                         ForeignPK questionPK)
                                  throws SQLException
Add some answers to a question

Parameters:
con - the Connection
answers - a Collection of Answer
questionPK - the QuestionPK (question id)
Throws:
SQLException

addAnswerToAQuestion

public static void addAnswerToAQuestion(Connection con,
                                        Answer answer,
                                        ForeignPK questionPK)
                                 throws SQLException
Add an answer to a question

Parameters:
con - the Connection
answer - the Answer
questionPK - the QuestionPK (question id)
Throws:
SQLException

deleteAnswersToAQuestion

public static void deleteAnswersToAQuestion(Connection con,
                                            ForeignPK questionPK)
                                     throws SQLException
Delete all answers to a given question

Parameters:
con - the Connection
questionPK - the QuestionPK (question id)
Throws:
SQLException

deleteAnswerToAQuestion

public static void deleteAnswerToAQuestion(Connection con,
                                           ForeignPK questionPK,
                                           String answerId)
                                    throws SQLException
Delete an answer to a question

Parameters:
con - the Connection
questionPK - the QuestionPK (question id)
answerId - the answer id
Throws:
SQLException

updateAnswerToAQuestion

public static void updateAnswerToAQuestion(Connection con,
                                           ForeignPK questionPK,
                                           Answer answer)
                                    throws SQLException
Update an answer to a question

Parameters:
con - the Connection
questionPK - the QuestionPK (question id)
answer - the Answer
Throws:
SQLException


Copyright © 2016 Silverpeas. All Rights Reserved.