Package jpa.controllers

Examples of jpa.controllers.EnrollmentJpaController


        courseID = Integer.valueOf(request.getParameter("courseID"));
       
        String comment;
        comment = String.valueOf(request.getParameter("comment"));
       
        EnrollmentJpaController enrollentJPAController = new EnrollmentJpaController();
        Enrollment enrollment = enrollentJPAController.findEnrollment(userID, courseID);

        boolean success = false;
       
        if (enrollment != null) {
            Comments comments = new Comments();
View Full Code Here


        courseID = Integer.valueOf(request.getParameter("courseID"));
       
        Integer rating;
        rating = Integer.valueOf(request.getParameter("rating"));
       
        EnrollmentJpaController enrollentJPAController = new EnrollmentJpaController();
        Enrollment enrollment = enrollentJPAController.findEnrollment(userID, courseID);
       
        boolean success = false;
       
        if (enrollment != null) {
            Courserates courseRates = new Courserates();
View Full Code Here

       
        Integer userID;
        userID = Integer.valueOf(request.getParameter("userID"));

        // First get enrollment entities which matches with userID
        EnrollmentJpaController enrollmentJpaController = new EnrollmentJpaController();
        List<Enrollment> enrollmentList = enrollmentJpaController.findEnrollmentEntitiesWithUserID(userID);
       
        //********************************
       
        // Second generate a list of courseIDs
        List<Integer> courseIDList = new ArrayList<Integer>();
View Full Code Here

        Map courseDetailMap = new HashMap();
       
        //********************************
       
        // Second get user related details
        EnrollmentJpaController enrollmentJpaController = new EnrollmentJpaController();
        Enrollment enrollment = enrollmentJpaController.findEnrollment(userID, courseID);
       
        if (enrollment != null) {
            courseDetailMap.put("userEnrolled", Boolean.TRUE);
            Courserates courseRate = enrollment.getCourserates();
           
            if (courseRate != null) {
                courseDetailMap.put("userRated", Boolean.TRUE);
                courseDetailMap.put("userRatePoint", new Integer(courseRate.getPoints()));
            } else {
                courseDetailMap.put("userRated", Boolean.FALSE);
                courseDetailMap.put("userRatePoint", new Integer(-1));
            }
           
        } else {
            courseDetailMap.put("userEnrolled", Boolean.FALSE);
            courseDetailMap.put("userRated", Boolean.FALSE);
            courseDetailMap.put("userRatePoint", new Integer(-1));
        }
       
        //********************************
       
        // Third get basic course details
        CoursesJpaController coursesJpaController = new CoursesJpaController();
        Courses course = coursesJpaController.findCourses(courseID);
       
        courseDetailMap.put("courseID", new Integer(courseID));
        courseDetailMap.put("courseName", new String(course.getName()));
        courseDetailMap.put("courseDescription", new String(course.getDescription()));
        courseDetailMap.put("courseCreatorName", new String(course.getCreaterUserId().getName()));
       
        //********************************
       
        // Forth get rating
        List<Enrollment> enrollmentList = enrollmentJpaController.findEnrollmentEntitiesWithCourseID(courseID);
        List<Courserates> courseRatesList = new ArrayList<Courserates>();
        for (Iterator<Enrollment> it = enrollmentList.iterator(); it.hasNext();) {
            Enrollment tempEnrollment = it.next();
            if (tempEnrollment.getCourserates() != null) {
                courseRatesList.add(tempEnrollment.getCourserates());
View Full Code Here

        Enrollment enrollment = new Enrollment();
        enrollment.setUserId(user);
        enrollment.setCourseId(course);
        enrollment.setSysdate(new Date());
       
        EnrollmentJpaController jpaController = new EnrollmentJpaController();
        jpaController.create(enrollment);
               
        try {
//            /* TODO output your page here. You may use following sample code. */
//            out.println("<!DOCTYPE html>");
//            out.println("<html>");
View Full Code Here

        courseID = Integer.valueOf(request.getParameter("courseID"));
       
        //********************************
       
        // First get all comments of the course
        EnrollmentJpaController enrollmentJpaController = new EnrollmentJpaController();
        List<Enrollment> enrollmentList = enrollmentJpaController.findEnrollmentEntitiesWithCourseID(courseID);
        List<Comments> commentsList = new ArrayList<Comments>();
        for (Iterator<Enrollment> it = enrollmentList.iterator(); it.hasNext();) {
            Enrollment tempEnrollment = it.next();
            if (tempEnrollment.getCommentsList() != null) {
                commentsList.addAll(tempEnrollment.getCommentsList());
View Full Code Here

        enrollment.setCourseId(course);
        enrollment.setSysdate(new Date());
       
        try {    
       
        EnrollmentJpaController jpaController = new EnrollmentJpaController();
        jpaController.create(enrollment);
        JsfUtil.addSuccessMessage("User successfully enrolled course.");
        }
        catch (Exception e) {
            JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred.");
        }
View Full Code Here

TOP

Related Classes of jpa.controllers.EnrollmentJpaController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.