sk.stuba.fiit.foo07.genex.dao
Class QuestionDaoDerby
java.lang.Object
sk.stuba.fiit.foo07.genex.dao.BasicDao
sk.stuba.fiit.foo07.genex.dao.QuestionDaoDerby
- All Implemented Interfaces:
- QuestionDao
public class QuestionDaoDerby
- extends BasicDao
- implements QuestionDao
- Author:
- palo
Zname chyby: Delete vyhodi exception pri odstranovani otazky ked existuje
zaznam medzi otazkou a testom (neviem ci to mam riesit). Podobnu chybu medzi
kategoriou a otazkou riesim, cize aby to bolo "konzistnetne" mali by sme sa
dohodnut
|
Field Summary |
protected java.util.ArrayList<java.lang.Integer> |
idList
|
protected Question |
q
|
protected java.util.ArrayList<Question> |
q_list
|
protected java.sql.ResultSet |
rs
|
protected java.sql.PreparedStatement |
st
|
| Fields inherited from class sk.stuba.fiit.foo07.genex.dao.BasicDao |
con |
|
Method Summary |
void |
addQuestion(java.lang.Integer categoryID,
Question toAdd)
|
void |
addQuestions(java.lang.Integer categoryID,
java.util.ArrayList<Question> toAdd)
|
void |
copyQuestion(int questionID,
java.lang.Integer toCategoryID)
|
void |
createQuestion(Question toCreate)
|
void |
deleteQuestion(Question toDelete)
|
void |
deleteQuestionFromCategory(Question toDelete,
Category from)
|
void |
deleteQuestions(java.util.ArrayList<Question> toDelete)
|
Question |
getQuestionByID(java.lang.Integer questionID)
|
int |
getQuestionCount(java.lang.Integer categoryID)
Returns number of questions in given category. |
java.util.ArrayList<Question> |
getQuestionsByCategoryID(java.lang.Integer categoryID)
|
java.util.ArrayList<Question> |
getQuestionsByIDs(java.util.ArrayList<java.lang.Integer> questionIDs)
|
java.util.ArrayList<Question> |
getQuestionsByTestID(java.lang.Integer testID)
|
java.util.ArrayList<java.lang.Integer> |
getQuestionsForTestGenerator(java.util.ArrayList<java.lang.Integer> questionCategoryIDs,
java.util.ArrayList<java.lang.Integer> keywordIDs,
java.util.ArrayList<java.lang.Integer> questionTypeIDs,
boolean containsPictures,
java.lang.Integer difficulty)
This method returns set of questions that meets the constraints defined
by input parameters |
void |
moveQuestion(Question q,
java.lang.Integer fromCategoryID,
java.lang.Integer toCategoryID)
Moves question between two categories |
void |
updateQuestion(java.lang.Integer questionID,
Question toUpdate)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
rs
protected java.sql.ResultSet rs
st
protected java.sql.PreparedStatement st
q
protected Question q
q_list
protected java.util.ArrayList<Question> q_list
idList
protected java.util.ArrayList<java.lang.Integer> idList
QuestionDaoDerby
public QuestionDaoDerby(java.sql.Connection con)
QuestionDaoDerby
public QuestionDaoDerby()
throws java.lang.Exception
- Throws:
java.lang.Exception
createQuestion
public void createQuestion(Question toCreate)
throws java.sql.SQLException
- Specified by:
createQuestion in interface QuestionDao
- Throws:
java.sql.SQLException
addQuestion
public void addQuestion(java.lang.Integer categoryID,
Question toAdd)
throws java.sql.SQLException
- Specified by:
addQuestion in interface QuestionDao
- Throws:
java.sql.SQLException
addQuestions
public void addQuestions(java.lang.Integer categoryID,
java.util.ArrayList<Question> toAdd)
throws java.sql.SQLException
- Specified by:
addQuestions in interface QuestionDao
- Throws:
java.sql.SQLException
deleteQuestion
public void deleteQuestion(Question toDelete)
throws QuestionInTestException,
java.sql.SQLException
- Specified by:
deleteQuestion in interface QuestionDao
- Throws:
QuestionInTestException
java.sql.SQLException
deleteQuestions
public void deleteQuestions(java.util.ArrayList<Question> toDelete)
throws QuestionInTestException,
java.sql.SQLException
- Specified by:
deleteQuestions in interface QuestionDao
- Throws:
QuestionInTestException
java.sql.SQLException
getQuestionByID
public Question getQuestionByID(java.lang.Integer questionID)
throws java.sql.SQLException
- Specified by:
getQuestionByID in interface QuestionDao
- Throws:
java.sql.SQLException
getQuestionsByIDs
public java.util.ArrayList<Question> getQuestionsByIDs(java.util.ArrayList<java.lang.Integer> questionIDs)
throws java.sql.SQLException
- Specified by:
getQuestionsByIDs in interface QuestionDao
- Throws:
java.sql.SQLException
getQuestionsByCategoryID
public java.util.ArrayList<Question> getQuestionsByCategoryID(java.lang.Integer categoryID)
throws java.sql.SQLException
- Specified by:
getQuestionsByCategoryID in interface QuestionDao
- Throws:
java.sql.SQLException
getQuestionsByTestID
public java.util.ArrayList<Question> getQuestionsByTestID(java.lang.Integer testID)
throws java.sql.SQLException
- Specified by:
getQuestionsByTestID in interface QuestionDao
- Throws:
java.sql.SQLException
updateQuestion
public void updateQuestion(java.lang.Integer questionID,
Question toUpdate)
throws java.sql.SQLException
- Specified by:
updateQuestion in interface QuestionDao
- Throws:
java.sql.SQLException
getQuestionsForTestGenerator
public java.util.ArrayList<java.lang.Integer> getQuestionsForTestGenerator(java.util.ArrayList<java.lang.Integer> questionCategoryIDs,
java.util.ArrayList<java.lang.Integer> keywordIDs,
java.util.ArrayList<java.lang.Integer> questionTypeIDs,
boolean containsPictures,
java.lang.Integer difficulty)
throws java.sql.SQLException
- Description copied from interface:
QuestionDao
- This method returns set of questions that meets the constraints defined
by input parameters
- Specified by:
getQuestionsForTestGenerator in interface QuestionDao
- Parameters:
questionCategoryIDs - List of question category IDs for the testkeywordIDs - List of question keyword IDs for the testquestionTypeIDs - List of question type IDs for the testcontainsPictures - If false the test must not contain questions with pictures
- Returns:
-
- Throws:
java.sql.SQLException
moveQuestion
public void moveQuestion(Question q,
java.lang.Integer fromCategoryID,
java.lang.Integer toCategoryID)
throws java.sql.SQLException
- Description copied from interface:
QuestionDao
- Moves question between two categories
- Specified by:
moveQuestion in interface QuestionDao
- Throws:
java.sql.SQLException
copyQuestion
public void copyQuestion(int questionID,
java.lang.Integer toCategoryID)
throws java.sql.SQLException
- Specified by:
copyQuestion in interface QuestionDao
- Throws:
java.sql.SQLException
getQuestionCount
public int getQuestionCount(java.lang.Integer categoryID)
throws java.sql.SQLException
- Description copied from interface:
QuestionDao
- Returns number of questions in given category.
- Specified by:
getQuestionCount in interface QuestionDao
- Returns:
-
- Throws:
java.sql.SQLException
deleteQuestionFromCategory
public void deleteQuestionFromCategory(Question toDelete,
Category from)
throws java.sql.SQLException
- Specified by:
deleteQuestionFromCategory in interface QuestionDao
- Throws:
java.sql.SQLException
Copyright © 2008 Faculty of Informatics and Information Technologies, STU Bratislava. All Rights Reserved.