View Javadoc

1   package at.ac.tuwien.ifs.bpse.basic.dao;
2   
3   import java.util.List;
4   
5   import at.ac.tuwien.ifs.bpse.basic.domain.Student;
6   
7   /**
8    * The DAO abstracts and encapsulates all access to the data source
9    * corresponding to the Student business object
10   * 
11   * @author The SE-Team
12   * @version 1.1
13   */
14  public interface IStudentDAO {
15  	/**
16  	 * Enumeration for different sort orders of students that can be used.
17  	 * Possible sort ordes are:
18  	 * <ul>
19  	 * <li><code>StudentId</code> for an ascending order by studentId.</li>
20  	 * <li><code>LastName</code> for an ascending order by lastname.</li>
21  	 * </ul>
22  	 * 
23  	 * @author The SE-Team
24  	 * @since 1.1
25  	 * 
26  	 */
27  	public enum SortOrder {
28  		/**
29  		 * Use this sort order to order ascending by studentId.
30  		 */
31  		StudentId,
32  
33  		/**
34  		 * Use this sort order to order ascending by lastname.
35  		 */
36  		LastName,
37  	}
38  
39  	/**
40  	 * Retrieves one single Student from the DB.
41  	 * 
42  	 * @param id
43  	 *            unique database ID of Student
44  	 * @return Student object holding the data of one student or null if no
45  	 *         student with the matching id is found
46  	 */
47  	public Student getStudent(int id);
48  
49  	/**
50  	 * Retrieves one single Student by a given matrikel number
51  	 * 
52  	 * @param matnr
53  	 * @return Student object if someone existed, otherwise null if no student
54  	 *         with the given matnr exist
55  	 */
56  	public Student getStudentByMatrNr(String matnr);
57  
58  	/**
59  	 * Saves one single Student to the Database.
60  	 * 
61  	 * @param student
62  	 *            object holding the data of one student
63  	 * @return Student object with the generated ID, or null if an error occurs
64  	 */
65  	public Student saveStudent(Student student);
66  
67  	/**
68  	 * Updates an existing student in the database.
69  	 * 
70  	 * @param student
71  	 *            object holding the data of one student
72  	 * @return Student object
73  	 */
74  	public Student updateStudent(Student student);
75  
76  	/**
77  	 * Deletes an existing student from the database.
78  	 * 
79  	 * @param id
80  	 *            of the student to be deleted
81  	 * @return true if procedure was successfully, otherwise false
82  	 */
83  	public boolean deleteStudent(int id);
84  
85  	/**
86  	 * Retrieves all students from the database.
87  	 * 
88  	 * @param order
89  	 *            that the result set should be ordered by
90  	 * @return List of type Student holding all students available
91  	 * 
92  	 * @since 1.1
93  	 */
94  	public List<Student> getStudents(SortOrder order);
95  
96  }