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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete(int persontId)
TODO : throw an exception if a person is into the students or teachers tablevoid
deleteStudent(int studentId)
Removes a person from the database.(package private) void
executeLoadAsyncPersonsLos(AbstractBrolWorker<Integer> worker, String query)
getPicture(int personId)
TODO : load image from the DB.void
loadAsyncPersonsLos(AbstractBrolWorker worker)
void
loadAsyncStudentsLos(AbstractBrolWorker<Integer> worker)
Loads in a separated process the list of students.void
loadAsyncTeachersLos(AbstractBrolWorker<Integer> worker)
loadPerson(int id)
loadPerson(String firstName, String lastName)
(package private) Person
loadPerson(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)
int
saveOrUpdate(Student student)
int
saveOrUpdate(Teacher teacher)
int
saveOrUpdate(Person person)
void
savePicture(int personId, File pictureFile)
-
Constructor Details
-
DerbyPerson
public DerbyPerson()
-
-
Method Details
-
executeLoadAsyncPersonsLos
-
loadPerson
- Specified by:
loadPerson
in interfaceIPersonDao
- Returns:
-
loadPerson
- Throws:
SQLException
-
loadPersons
-
saveOrUpdate
- Specified by:
saveOrUpdate
in interfaceIPersonDao
-
delete
public void delete(int persontId)TODO : throw an exception if a person is into the students or teachers table- Specified by:
delete
in 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:IPersonDao
Removes a person from the database. If this person is a teacher or a student, deletes also in corresponding table.- Specified by:
deleteStudent
in interfaceIPersonDao
- Parameters:
studentId
- student id Not same as the person id
-
loadAsyncTeachersLos
- Specified by:
loadAsyncTeachersLos
in interfaceIPersonDao
- Parameters:
worker
- to allow loading the list asynchronous and sending each result in an Object[]
-
saveOrUpdate
- Specified by:
saveOrUpdate
in interfaceIPersonDao
-
loadTeacher
- Specified by:
loadTeacher
in interfaceIPersonDao
- Returns:
-
loadAsyncPersonsLos
- Specified by:
loadAsyncPersonsLos
in interfaceIPersonDao
- Parameters:
worker
- to allow loading the list asynchronous and sending each result in an Object[]
-
loadAsyncStudentsLos
Description copied from interface:IPersonDao
Loads 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:
loadAsyncStudentsLos
in interfaceIPersonDao
- Parameters:
worker
- to allow loading the list asynchronous and sending each result in an Object[]
-
loadStudent
- Specified by:
loadStudent
in interfaceIPersonDao
- Returns:
-
loadStudents
Description copied from interface:IPersonDao
Loads a list of students.
Be careful: for each student, the school will contains only school's id.- Specified by:
loadStudents
in interfaceIPersonDao
- Returns:
-
loadStudentsForSchool
Description copied from interface:IPersonDao
Loads a list of students. If schoolId > -1, loads only students for this school- Specified by:
loadStudentsForSchool
in interfaceIPersonDao
- Returns:
-
saveOrUpdate
- Specified by:
saveOrUpdate
in 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:
getPicture
in interfaceIPersonDao
- Returns:
- Picture of the person, or null if nothing found
-
savePicture
- Specified by:
savePicture
in interfaceIPersonDao
-
loadPerson
- Specified by:
loadPerson
in interfaceIPersonDao
-