View Javadoc

1   package sk.stuba.fiit.foo07.genex.dao;
2   
3   import java.sql.SQLException;
4   import java.util.ArrayList;
5   
6   import sk.stuba.fiit.foo07.genex.beans.Category;
7   import sk.stuba.fiit.foo07.genex.beans.Question;
8   import sk.stuba.fiit.foo07.genex.exceptions.QuestionInTestException;
9   
10  /**
11   * 
12   * @author _mizu_
13   * 
14   */
15  public interface QuestionDao {
16  
17      public Question getQuestionByID(Integer questionID) throws SQLException;
18  
19      public ArrayList<Question> getQuestionsByIDs(ArrayList<Integer> questionIDs)
20              throws SQLException;
21  
22      public ArrayList<Question> getQuestionsByCategoryID(Integer categoryID)
23              throws SQLException;
24  
25      public ArrayList<Question> getQuestionsByTestID(Integer testID)
26              throws SQLException;
27  
28      public void addQuestion(Integer categoryID, Question toAdd)
29              throws SQLException;
30  
31      public void createQuestion(Question toCreate) throws SQLException;
32  
33      public void addQuestions(Integer categoryID, ArrayList<Question> toAdd)
34              throws SQLException;
35  
36      public void updateQuestion(Integer questionID, Question toUpdate)
37              throws SQLException;
38  
39      public void deleteQuestion(Question toDelete)
40              throws QuestionInTestException, SQLException;
41  
42      public void deleteQuestions(ArrayList<Question> toDelete)
43              throws QuestionInTestException, SQLException;
44  
45      public void deleteQuestionFromCategory(Question toDelete, Category from)
46              throws SQLException;
47  
48      /**
49       * Moves question between two categories
50       * 
51       * @param fromCategoryID
52       * @param toCategoryID
53       */
54      public void moveQuestion(Question q, Integer fromCategoryID,
55              Integer toCategoryID) throws SQLException;
56  
57      public void copyQuestion(int questionID, Integer toCategoryID)
58              throws SQLException;
59  
60      /**
61       * This method returns set of questions that meets the constraints defined
62       * by input parameters
63       * 
64       * @param questionCategoryIDs
65       *                List of question category IDs for the test
66       * @param keywordIDs
67       *                List of question keyword IDs for the test
68       * @param questionTypeIDs
69       *                List of question type IDs for the test
70       * @param containsPictures
71       *                If false the test must not contain questions with pictures
72       * @param difficulty
73       * @return
74       * @throws SQLException
75       */
76      public ArrayList<Integer> getQuestionsForTestGenerator(
77              ArrayList<Integer> questionCategoryIDs,
78              ArrayList<Integer> keywordIDs, ArrayList<Integer> questionTypeIDs,
79              boolean containsPictures, Integer difficulty) throws SQLException;
80  
81      /**
82       * Returns number of questions in given category.
83       * 
84       * @param categoryID
85       * @return
86       */
87      public int getQuestionCount(Integer categoryID) throws SQLException;
88  }