Search in sources :

Example 11 with CourseStudentDAO

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);
}
Also used : CourseStudentVariableDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentVariableDAO) CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent)

Example 12 with CourseStudentDAO

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);
}
Also used : CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) StudentDAO(fi.otavanopisto.pyramus.dao.students.StudentDAO) CourseDAO(fi.otavanopisto.pyramus.dao.courses.CourseDAO) CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent) Course(fi.otavanopisto.pyramus.domainmodel.courses.Course) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent) Student(fi.otavanopisto.pyramus.domainmodel.students.Student)

Example 13 with CourseStudentDAO

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);
}
Also used : CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) StudentDAO(fi.otavanopisto.pyramus.dao.students.StudentDAO) CourseDAO(fi.otavanopisto.pyramus.dao.courses.CourseDAO) CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent) Course(fi.otavanopisto.pyramus.domainmodel.courses.Course) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent) Student(fi.otavanopisto.pyramus.domainmodel.students.Student)

Example 14 with CourseStudentDAO

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);
}
Also used : CourseParticipationTypeDAO(fi.otavanopisto.pyramus.dao.courses.CourseParticipationTypeDAO) CourseEnrolmentTypeDAO(fi.otavanopisto.pyramus.dao.courses.CourseEnrolmentTypeDAO) CourseOptionality(fi.otavanopisto.pyramus.domainmodel.base.CourseOptionality) CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent) CourseEnrolmentType(fi.otavanopisto.pyramus.domainmodel.courses.CourseEnrolmentType) CourseParticipationType(fi.otavanopisto.pyramus.domainmodel.courses.CourseParticipationType)

Example 15 with CourseStudentDAO

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);
}
Also used : CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) StudentDAO(fi.otavanopisto.pyramus.dao.students.StudentDAO) CourseDAO(fi.otavanopisto.pyramus.dao.courses.CourseDAO) CourseStudentDAO(fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent) Course(fi.otavanopisto.pyramus.domainmodel.courses.Course) CourseStudent(fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent) Student(fi.otavanopisto.pyramus.domainmodel.students.Student)

Aggregations

CourseStudentDAO (fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO)34 CourseStudent (fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent)30 CourseDAO (fi.otavanopisto.pyramus.dao.courses.CourseDAO)16 Course (fi.otavanopisto.pyramus.domainmodel.courses.Course)16 StudentDAO (fi.otavanopisto.pyramus.dao.students.StudentDAO)14 Student (fi.otavanopisto.pyramus.domainmodel.students.Student)14 CourseAssessmentDAO (fi.otavanopisto.pyramus.dao.grading.CourseAssessmentDAO)9 StaffMemberDAO (fi.otavanopisto.pyramus.dao.users.StaffMemberDAO)9 CourseParticipationType (fi.otavanopisto.pyramus.domainmodel.courses.CourseParticipationType)9 CourseAssessment (fi.otavanopisto.pyramus.domainmodel.grading.CourseAssessment)8 Currency (java.util.Currency)8 HashMap (java.util.HashMap)8 CourseParticipationTypeDAO (fi.otavanopisto.pyramus.dao.courses.CourseParticipationTypeDAO)7 Room (fi.otavanopisto.pyramus.domainmodel.accommodation.Room)7 StaffMember (fi.otavanopisto.pyramus.domainmodel.users.StaffMember)7 Date (java.util.Date)7 SmvcRuntimeException (fi.internetix.smvc.SmvcRuntimeException)6 CourseOptionality (fi.otavanopisto.pyramus.domainmodel.base.CourseOptionality)6 BigDecimal (java.math.BigDecimal)6 Locale (java.util.Locale)6