@Override public void removeAttendantFromCourse(int courseId, int studentId) { Course course = courseDao.getCourse(courseId); Student student = studentDao.getStudent(studentId); student.getCourses().remove(course); studentDao.saveStudent(student); }
@Override public void setStudentLocation(int studentId, String latitude, String longitude) { Student student = studentDao.getStudent(studentId); student.setLatitude(latitude); student.setLongitude(longitude); studentDao.saveStudent(student); }
@Override public void addAttendantToCourse(int courseId, int studentId) { Course course = courseDao.getCourse(courseId); Student student = studentDao.getStudent(studentId); student.getCourses().add(course); studentDao.saveStudent(student); }
@Override public void addDegreeToStudent(int studentId, int degreeId) { Student student = studentDao.getStudent(studentId); Degree degree = degreeDao.getDegree(degreeId); student.getDegrees().add(degree); studentDao.saveStudent(student); }
@Override public void removeDegreeFromStudent(int studentId, int degreeId) { Student student = studentDao.getStudent(studentId); Degree degree = degreeDao.getDegree(degreeId); student.getDegrees().remove(degree); studentDao.saveStudent(student); }
@Override public void updateStudent(int studentId, String studentName) { Student student = studentDao.getStudent(studentId); student.setName(studentName); // updateStudent could be used studentDao.saveStudent(student); }
@Override public boolean studentFulfillsDegreeRequirements(int studentId, int degreeId) { Collection<Course> degreeCourses = degreeDao.getDegree(degreeId).getRequiredCourses(); Collection<Course> studentCourses = studentDao.getStudent(studentId).getCourses(); if (degreeCourses.size() >= 0) { if (checkDegreeCriteria(degreeCourses, studentCourses)) { return true; } else { return false; } } else { return false; } }
@Override public void delStudent(int studentId) { Student student = studentDao.getStudent(studentId); studentDao.delStudent(student); }
@Override public Collection<Student> getAllStudents() { Collection<Student> students = studentDao.getAllStudents(); return students; }
@Override public Student getStudentByName(String studentName) { return studentDao.getStudentByName(studentName); }
@Override public Student getStudent(int studentId) { return studentDao.getStudent(studentId); }
@Override public int addStudent(String studentName) { return studentDao.saveStudent(new Student(studentName)); }