Package be.gaudry.dao.edu.derby
Class DerbyPerson
java.lang.Object
be.gaudry.dao.edu.derby.DerbyPerson
- All Implemented Interfaces:
IPersonDao
- Since:
- 1.0 Apr 8, 2009
- Author:
- Steph GAUDRY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(int persontId)TODO : throw an exception if a person is into the students or teachers tablevoiddeleteStudent(int studentId)Removes a person from the database.(package private) voidexecuteLoadAsyncPersonsLos(AbstractBrolWorker<Integer> worker, String query)getPicture(int personId)TODO : load image from the DB.voidloadAsyncPersonsLos(AbstractBrolWorker worker)voidloadAsyncStudentsLos(AbstractBrolWorker<Integer> worker)Loads in a separated process the list of students.voidloadAsyncTeachersLos(AbstractBrolWorker<Integer> worker)loadPerson(int id)loadPerson(String firstName, String lastName)(package private) PersonloadPerson(ResultSet rs)loadPersons(List<Integer> ids)loadStudent(int id)loadStudents(List<Integer> studentsIds)Loads a list of students.
Be careful: for each student, the school will contains only school's id.loadStudentsForSchool(int schoolId)Loads a list of students.loadTeacher(int id)intsaveOrUpdate(Student student)intsaveOrUpdate(Teacher teacher)intsaveOrUpdate(Person person)voidsavePicture(int personId, File pictureFile)
-
Constructor Details
-
DerbyPerson
public DerbyPerson()
-
-
Method Details
-
executeLoadAsyncPersonsLos
-
loadPerson
- Specified by:
loadPersonin interfaceIPersonDao- Returns:
-
loadPerson
- Throws:
SQLException
-
loadPersons
-
saveOrUpdate
- Specified by:
saveOrUpdatein interfaceIPersonDao
-
delete
public void delete(int persontId)TODO : throw an exception if a person is into the students or teachers table- Specified by:
deletein interfaceIPersonDao- Parameters:
persontId- ID of the person to be deleted- See Also:
IPersonDao.deleteStudent(int)
-
deleteStudent
public void deleteStudent(int studentId)Description copied from interface:IPersonDaoRemoves a person from the database. If this person is a teacher or a student, deletes also in corresponding table.- Specified by:
deleteStudentin interfaceIPersonDao- Parameters:
studentId- student id Not same as the person id
-
loadAsyncTeachersLos
- Specified by:
loadAsyncTeachersLosin interfaceIPersonDao- Parameters:
worker- to allow loading the list asynchronous and sending each result in an Object[]
-
saveOrUpdate
- Specified by:
saveOrUpdatein interfaceIPersonDao
-
loadTeacher
- Specified by:
loadTeacherin interfaceIPersonDao- Returns:
-
loadAsyncPersonsLos
- Specified by:
loadAsyncPersonsLosin interfaceIPersonDao- Parameters:
worker- to allow loading the list asynchronous and sending each result in an Object[]
-
loadAsyncStudentsLos
Description copied from interface:IPersonDaoLoads in a separated process the list of students. OnlyLightObjects(an id and a display) are given to the view.
The ids are Student's ids and not person's ids, because the id is needed by theIPersonDao.loadStudent(int)method- Specified by:
loadAsyncStudentsLosin interfaceIPersonDao- Parameters:
worker- to allow loading the list asynchronous and sending each result in an Object[]
-
loadStudent
- Specified by:
loadStudentin interfaceIPersonDao- Returns:
-
loadStudents
Description copied from interface:IPersonDaoLoads a list of students.
Be careful: for each student, the school will contains only school's id.- Specified by:
loadStudentsin interfaceIPersonDao- Returns:
-
loadStudentsForSchool
Description copied from interface:IPersonDaoLoads a list of students. If schoolId > -1, loads only students for this school- Specified by:
loadStudentsForSchoolin interfaceIPersonDao- Returns:
-
saveOrUpdate
- Specified by:
saveOrUpdatein interfaceIPersonDao- Parameters:
student- Student to be saved or modified
-
getPicture
TODO : load image from the DB. Create a new table person_picture(id,picture) for performances (we don't always need pictures)- Specified by:
getPicturein interfaceIPersonDao- Returns:
- Picture of the person, or null if nothing found
-
savePicture
- Specified by:
savePicturein interfaceIPersonDao
-
loadPerson
- Specified by:
loadPersonin interfaceIPersonDao
-