/**
  * Permet de vérifier si un identifiant existe.
  *
  * @param id Identifiant d'un groupe.
  * @return true si l'id existe, return flase si l'id n'existe pas.
  */
 public boolean groupIDExists(long id) {
   groupDao.init();
   return groupDao.groupIdExists(id);
 }
 /**
  * Retourne les personnes contenu dans une groupe.
  *
  * @return Les personnes appartenant au groupe.
  */
 public Collection<Person> getGroupContent(long id) {
   groupDao.init();
   return groupDao.getContentGroup(id);
 }
 /**
  * @param id Identifiant du groupe.
  * @return l'objet Group.
  */
 public Group getGroup(long id) {
   groupDao.init();
   return groupDao.getGroup(id);
 }
 /**
  * Retourne la liste de toutes les groupes.
  *
  * @return Liste de toutes les groupes present dans l'annuaire.
  */
 public Collection<Group> getAllGroups() {
   groupDao.init();
   List<Group> groups = groupDao.getAllGroups();
   return groups;
 }
 /** Initialise la connexion a la base de donnes. */
 @PostConstruct
 public void init() {
   groupDao.init();
 }
Example #6
0
  private static void fillDatabase() {

    Teacher teacher = new Teacher();
    teacher.setFirstName("Ivan");
    teacher.setLastName("Ivanov");
    teacherDao.save(teacher);

    Teacher teacher2 = new Teacher();
    teacher2.setFirstName("Petr");
    teacher2.setLastName("Petrov");
    teacherDao.save(teacher2);

    Group group = new Group();
    group.setCreated(new Date());
    group.setCurator(teacher);
    group.setName("1");
    groupDao.save(group);

    Student student = new Student();
    student.setBirthday(new Date());
    student.setFirstName("stud1");
    student.setLastName("stud1");
    Group group1 = (Group) groupDao.list("1").toArray()[0];
    student.setGroup(group1);
    studentDao.save(student);

    Student student2 = new Student();
    student2.setBirthday(new Date());
    student2.setFirstName("stud2");
    student2.setLastName("stud2");
    student2.setGroup(group1);
    studentDao.save(student2);

    Student student3 = new Student();
    student3.setBirthday(new Date());
    student3.setFirstName("stud3");
    student3.setLastName("stud3");
    student3.setGroup(group1);
    studentDao.save(student3);

    Lection lection = new Lection();
    lection.setName("Math");
    lectionDao.save(lection);

    Lection lection1 = new Lection();
    lection1.setName("Phisics");
    lectionDao.save(lection1);

    Lection lection2 = (Lection) lectionDao.list("Math").toArray()[0];
    Teacher teacher3 = (Teacher) teacherDao.list("Ivan").toArray()[0];
    GroupLection groupLection = new GroupLection();
    groupLection.setDate(new Date());
    groupLection.setGroup(group1);
    groupLection.setLection(lection2);
    groupLection.setTeacher(teacher3);
    groupLectionDao.save(groupLection);

    LossStudent lossStudent = new LossStudent();
    lossStudent.setDate(new Date());
    lossStudent.setGroup(group1);
    lossStudent.setLection(lection2);
    lossStudent.setStudent(student3);
    lossStudent.setReason("sleeping");
    lossStudentDao.save(lossStudent);
  }