@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 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 setStudentLocation(int studentId, String latitude, String longitude) { Student student = studentDao.getStudent(studentId); student.setLatitude(latitude); student.setLongitude(longitude); 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 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 updateStudent(int studentId, String studentName) { Student student = studentDao.getStudent(studentId); student.setName(studentName); // updateStudent could be used studentDao.saveStudent(student); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null) { return false; } if (!(o instanceof Student)) { return false; } final Student other = (Student) o; return name.equals(other.getName()); }