Class QuestionDAO
- java.lang.Object
-
- org.silverpeas.core.questioncontainer.question.dao.QuestionDAO
-
public class QuestionDAO extends Object
This class is made to access database only (table SB_Question_Question)- Author:
- neysseri
-
-
Field Summary
Fields Modifier and Type Field Description static String
QUESTIONCOLUMNNAMES
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static QuestionPK
createQuestion(Connection con, Question question)
Create a new questionstatic void
deleteAllQuestionsByInstanceId(Connection con, String instanceId)
Deletes all the questions relative to the specified component instance.static void
deleteQuestion(Connection con, QuestionPK questionPK)
Delete a questionstatic void
deleteQuestionsByFatherPK(Connection con, QuestionPK questionPK, String fatherId)
Delete all questions linked to a given fatherstatic Question
getQuestion(Connection con, QuestionPK questionPK)
Return a questionstatic Collection<Question>
getQuestionsByFatherPK(Connection con, QuestionPK questionPK, String fatherId)
Return the questions linked to a given fatherstatic void
updateQuestion(Connection con, Question question)
Update a question
-
-
-
Field Detail
-
QUESTIONCOLUMNNAMES
public static final String QUESTIONCOLUMNNAMES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getQuestion
public static Question getQuestion(Connection con, QuestionPK questionPK) throws SQLException
Return a question- Parameters:
con
- the Connection to dataBasequestionPK
- the question id- Returns:
- a Question
- Throws:
SQLException
-
getQuestionsByFatherPK
public static Collection<Question> getQuestionsByFatherPK(Connection con, QuestionPK questionPK, String fatherId) throws SQLException
Return the questions linked to a given father- Parameters:
con
- the Connection to dataBasequestionPK
- the question idfatherId
- the father id- Returns:
- a Collection of Question
- Throws:
SQLException
-
createQuestion
public static QuestionPK createQuestion(Connection con, Question question) throws SQLException
Create a new question- Parameters:
con
- the Connection to dataBasequestion
- the Question to create- Returns:
- the QuestionPK of the new question
- Throws:
SQLException
-
updateQuestion
public static void updateQuestion(Connection con, Question question) throws SQLException
Update a question- Parameters:
con
- the Connection to dataBasequestion
- the Question to update- Throws:
SQLException
-
deleteQuestion
public static void deleteQuestion(Connection con, QuestionPK questionPK) throws SQLException
Delete a question- Parameters:
con
- the Connection to dataBasequestionPK
- the question id- Throws:
SQLException
-
deleteQuestionsByFatherPK
public static void deleteQuestionsByFatherPK(Connection con, QuestionPK questionPK, String fatherId) throws SQLException
Delete all questions linked to a given father- Parameters:
con
- the Connection to dataBasequestionPK
- to know the contextfatherId
- the father id- Throws:
SQLException
-
deleteAllQuestionsByInstanceId
public static void deleteAllQuestionsByInstanceId(Connection con, String instanceId) throws SQLException
Deletes all the questions relative to the specified component instance.- Parameters:
con
- the connection to the database.instanceId
- the unique identifier of the component instance.- Throws:
SQLException
- if an error occurs while deleting the questions.
-
-