package ciai.service; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ciai.exception.AccountAlreadyExistException; import ciai.exception.EditionNotFoundException; import ciai.exception.EvaluationNotAddedToEditionException; import ciai.exception.EvaluationNotEditedException; import ciai.exception.EvaluationNotFoundException; import ciai.exception.EvaluationNotRemovedFromEdition; import ciai.exception.ProfessorNotAddedToEditionException; import ciai.exception.ProfessorNotEditedException; import ciai.exception.ProfessorNotFoundException; import ciai.exception.ProfessorNotRemovedFromEdition; import ciai.exception.StudentNotAddedToEditionException; import ciai.exception.StudentNotEditedException; import ciai.exception.StudentNotFoundException; import ciai.exception.StudentNotRemovedFromEditionException; import ciai.model.Account; import ciai.model.Degree; import ciai.model.Edition; import ciai.model.Evaluation; import ciai.model.Grade; import ciai.model.Professor; import ciai.model.Result; import ciai.model.ResultByEdition; import ciai.model.Student; @Component public class AppService { @Autowired StudentService studentService; @Autowired EditionService editionService; @Autowired ProfessorService professorService; @Autowired DegreeService degreeService; @Autowired EvaluationService evalService; @Autowired AccountService acService; public Student getStudentByNumber(int number) throws StudentNotFoundException { return studentService.getStudentByNumber(number); } public Collection getStudentResults(int number) { return studentService.getStudentResults(number); } public Map> getStudentsResultsByEdition(Edition edition) { return studentService.getStudentsResultsByEdition(edition); } public Set getStudentCurrentEditions(int number) { return editionService.getStudentCurrentEditions(number); } public void editStudent(int number, String name, String photo, String personalemail, String address, String birthday) throws StudentNotFoundException, StudentNotEditedException { studentService.editStudent(number, name, photo, personalemail, address, birthday); } public Evaluation getEvaluation(Long eval_id) throws EvaluationNotFoundException { return evalService.getEvaluation(eval_id); } public Iterable getDegrees() { return degreeService.getAllDegrees(); } public Professor getProfessor(Long id) throws ProfessorNotFoundException { return professorService.getProfessor(id); } public Set getProfessorCurrentEditions(Long id) { return editionService.getProfessorCurrentEditions(id); } public void editProfessor(Long id, String name, String photo, String email) throws ProfessorNotFoundException, ProfessorNotEditedException { professorService.editProfessor(id, name, photo, email); } public Edition getEdition(Long id) throws EditionNotFoundException { return editionService.getEdition(id); } public void addProfessorToEdition(Edition edition, Professor professor) throws ProfessorNotAddedToEditionException{ editionService.addProfessorToEdition(edition, professor); } public Set getEditionProfessors(Long id) throws EditionNotFoundException { return editionService.getEditionProfessors(id); } public void removeProfessorFromEdition(Edition edition, Professor professor) throws ProfessorNotRemovedFromEdition { editionService.removeProfessorFromEdition(edition, professor); } public Set getEditionStudents(Long id) throws EditionNotFoundException { return editionService.getEditionStudents(id); } public void addStudentToEdition(Edition edition, Student student) throws StudentNotAddedToEditionException { editionService.addStudentToEdition(edition,student); } public void removeStudentFromEdition(Edition edition, Student student) throws StudentNotRemovedFromEditionException { editionService.removeStudentFromEdition(edition,student); } public void addEvaluationToEdition(Edition edition, String name, int type, float weight, String date, String time) throws EvaluationNotAddedToEditionException { editionService.addEvaluationToEdition(edition,name, type, weight, date, time); } public void editEvaluation(Edition edition, Evaluation eval, String name, String date, String time, float weight, int type) throws EvaluationNotFoundException, EvaluationNotEditedException { evalService.editEvaluation(edition,eval, name, date, time, weight, type); } public void removeEvaluationFromEdition(Edition edition, Evaluation eval) throws EvaluationNotRemovedFromEdition { evalService.removeEvaluationFromEdition(edition,eval); } public Set getEditionEvaluations(Long id) { return evalService.getEditionEvaluations(id); } public Account getAccountByUsername(String username) { return acService.getAccountByUsername(username); } public Student getStudentByAccount(Account ac) { return studentService.getStudentByAccount(ac); } public Professor getProfessorByAccount(Account ac) { return professorService.getProfessorByAccount(ac); } public Account createAccount(String name, String username, String password, String type, String degree) throws AccountAlreadyExistException, Exception { return acService.createAccount(name,username,password,type,degree); } public Set getStudensFromDegree(Long did) { return studentService.getStudensFromDegree(did); } public Iterable getAllProfessors() { return professorService.getAll(); } public void saveGrade(Grade next) { studentService.saveGrade(next); } }