/** * Approve Exam. * * @param examId * @return */ public boolean approveExam(String examId) { // Upon Approved, Generate Time Slots Exam examToApproved = examDao.findByExamId(examId); List<TestingCenterTimeSlots> timeSlots = generateTimeSlots(examToApproved); tctsDao.insertTimeSlots(timeSlots); examToApproved.setStatusType(ExamStatusType.APROVED); if (examDao.updateExam(examToApproved)) { return true; } else { return false; } }
// Schedule an Exam public boolean addExam(Exam newExam, String userId) { ExamType examType = newExam.getExamType(); boolean result = true; if (examType.equals(ExamType.REGULAR)) { // If Regular Exam result = examDao.addExam(newExam); // If } else { result = adhocExamDao.addAdhocExam((AdhocExam) newExam); } if (result) { User user = userDao.getUserById(userId); String emailAddress = user.getEmail(); try { emailService.sendEmail( StringResources.EMAIL_HOST, StringResources.EMAIL_PORT, StringResources.EMAIL_LOGIN, StringResources.EMAIL_PASSWORD, emailAddress, "Exam Request Notification", "You successfully send a exam request"); } catch (MessagingException e) { // Do nothing } } return result; }