Class DerbyPerson

java.lang.Object
be.gaudry.dao.edu.derby.DerbyPerson
All Implemented Interfaces:
IPersonDao

public class DerbyPerson extends Object implements IPersonDao
Since:
1.0 Apr 8, 2009
Author:
Steph GAUDRY
  • Constructor Details

    • DerbyPerson

      public DerbyPerson()
  • Method Details

    • executeLoadAsyncPersonsLos

      void executeLoadAsyncPersonsLos(AbstractBrolWorker<Integer> worker, String query)
    • loadPerson

      public Person loadPerson(int id)
      Specified by:
      loadPerson in interface IPersonDao
      Returns:
    • loadPerson

      Person loadPerson(ResultSet rs) throws SQLException
      Throws:
      SQLException
    • loadPersons

      public List<Person> loadPersons(List<Integer> ids)
    • saveOrUpdate

      public int saveOrUpdate(Person person)
      Specified by:
      saveOrUpdate in interface IPersonDao
    • delete

      public void delete(int persontId)
      TODO : throw an exception if a person is into the students or teachers table
      Specified by:
      delete in interface IPersonDao
      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 interface IPersonDao
      Parameters:
      studentId - student id Not same as the person id
    • loadAsyncTeachersLos

      public void loadAsyncTeachersLos(AbstractBrolWorker<Integer> worker)
      Specified by:
      loadAsyncTeachersLos in interface IPersonDao
      Parameters:
      worker - to allow loading the list asynchronous and sending each result in an Object[]
    • saveOrUpdate

      public int saveOrUpdate(Teacher teacher)
      Specified by:
      saveOrUpdate in interface IPersonDao
    • loadTeacher

      public Teacher loadTeacher(int id)
      Specified by:
      loadTeacher in interface IPersonDao
      Returns:
    • loadAsyncPersonsLos

      public void loadAsyncPersonsLos(AbstractBrolWorker worker)
      Specified by:
      loadAsyncPersonsLos in interface IPersonDao
      Parameters:
      worker - to allow loading the list asynchronous and sending each result in an Object[]
    • loadAsyncStudentsLos

      public void loadAsyncStudentsLos(AbstractBrolWorker<Integer> worker)
      Description copied from interface: IPersonDao
      Loads in a separated process the list of students. Only LightObjects (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 the IPersonDao.loadStudent(int) method
      Specified by:
      loadAsyncStudentsLos in interface IPersonDao
      Parameters:
      worker - to allow loading the list asynchronous and sending each result in an Object[]
    • loadStudent

      public Student loadStudent(int id)
      Specified by:
      loadStudent in interface IPersonDao
      Returns:
    • loadStudents

      public List<Student> loadStudents(List<Integer> studentsIds)
      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 interface IPersonDao
      Returns:
    • loadStudentsForSchool

      public List<Student> loadStudentsForSchool(int schoolId)
      Description copied from interface: IPersonDao
      Loads a list of students. If schoolId > -1, loads only students for this school
      Specified by:
      loadStudentsForSchool in interface IPersonDao
      Returns:
    • saveOrUpdate

      public int saveOrUpdate(Student student)
      Specified by:
      saveOrUpdate in interface IPersonDao
      Parameters:
      student - Student to be saved or modified
    • getPicture

      public Image getPicture(int personId)
      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 interface IPersonDao
      Returns:
      Picture of the person, or null if nothing found
    • savePicture

      public void savePicture(int personId, File pictureFile)
      Specified by:
      savePicture in interface IPersonDao
    • loadPerson

      public Person loadPerson(String firstName, String lastName)
      Specified by:
      loadPerson in interface IPersonDao