use of fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO in project pyramus by otavanopisto.
the class CoursesService method setCourseStudentVariable.
public void setCourseStudentVariable(@WebParam(name = "courseStudentId") Long courseStudentId, @WebParam(name = "key") String key, @WebParam(name = "value") String value) {
CourseStudentDAO courseStudentDAO = DAOFactory.getInstance().getCourseStudentDAO();
CourseStudentVariableDAO courseStudentVariableDAO = DAOFactory.getInstance().getCourseStudentVariableDAO();
CourseStudent courseStudent = courseStudentDAO.findById(courseStudentId);
courseStudentVariableDAO.setCourseStudentVariable(courseStudent, key, value);
}
use of fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO in project pyramus by otavanopisto.
the class CoursesService method unarchiveCourseStudent.
public void unarchiveCourseStudent(@WebParam(name = "courseId") Long courseId, @WebParam(name = "studentId") Long studentId) {
StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
CourseDAO courseDAO = DAOFactory.getInstance().getCourseDAO();
CourseStudentDAO courseStudentDAO = DAOFactory.getInstance().getCourseStudentDAO();
Course course = courseDAO.findById(courseId);
Student student = studentDAO.findById(studentId);
CourseStudent courseStudent = courseStudentDAO.findByCourseAndStudent(course, student);
courseDAO.unarchive(courseStudent);
}
use of fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO in project pyramus by otavanopisto.
the class CoursesService method archiveCourseStudent.
public void archiveCourseStudent(@WebParam(name = "courseId") Long courseId, @WebParam(name = "studentId") Long studentId) {
StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
CourseDAO courseDAO = DAOFactory.getInstance().getCourseDAO();
CourseStudentDAO courseStudentDAO = DAOFactory.getInstance().getCourseStudentDAO();
Course course = courseDAO.findById(courseId);
Student student = studentDAO.findById(studentId);
CourseStudent courseStudent = courseStudentDAO.findByCourseAndStudent(course, student);
courseStudentDAO.archive(courseStudent);
}
use of fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO in project pyramus by otavanopisto.
the class CoursesService method updateCourseStudent.
public void updateCourseStudent(@WebParam(name = "courseStudentId") Long courseStudentId, @WebParam(name = "courseEnrolmentTypeId") Long courseEnrolmentTypeId, @WebParam(name = "participationTypeId") Long participationTypeId, @WebParam(name = "enrolmentDate") Date enrolmentDate, @WebParam(name = "lodging") Boolean lodging, @WebParam(name = "optionality") String optionality) throws DuplicateCourseStudentException {
CourseStudentDAO courseStudentDAO = DAOFactory.getInstance().getCourseStudentDAO();
CourseParticipationTypeDAO participationTypeDAO = DAOFactory.getInstance().getCourseParticipationTypeDAO();
CourseEnrolmentTypeDAO enrolmentTypeDAO = DAOFactory.getInstance().getCourseEnrolmentTypeDAO();
CourseStudent courseStudent = courseStudentDAO.findById(courseStudentId);
CourseEnrolmentType courseEnrolmentType = courseEnrolmentTypeId == null ? null : enrolmentTypeDAO.findById(courseEnrolmentTypeId);
CourseParticipationType participationType = participationTypeId == null ? null : participationTypeDAO.findById(participationTypeId);
CourseOptionality cOptionality = null;
if (!StringUtils.isBlank(optionality))
cOptionality = CourseOptionality.valueOf(optionality);
// TODO: student-parameter (?)
courseStudentDAO.update(courseStudent, courseStudent.getStudent(), courseEnrolmentType, participationType, enrolmentDate, lodging, cOptionality);
validateEntity(courseStudent);
}
use of fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO in project pyramus by otavanopisto.
the class CoursesService method getCourseStudentByCourseIdAndStudentId.
public CourseStudentEntity getCourseStudentByCourseIdAndStudentId(@WebParam(name = "courseId") Long courseId, @WebParam(name = "studentId") Long studentId) {
CourseDAO courseDAO = DAOFactory.getInstance().getCourseDAO();
StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
CourseStudentDAO courseStudentDAO = DAOFactory.getInstance().getCourseStudentDAO();
Course course = courseDAO.findById(courseId);
Student student = studentDAO.findById(studentId);
CourseStudent courseStudent = courseStudentDAO.findByCourseAndStudent(course, student);
return EntityFactoryVault.buildFromDomainObject(courseStudent);
}
Aggregations