Package entity

Examples of entity.Courses


       
        // Second generate an ArrayList consist of course objects
        ArrayList coursesMapList = new ArrayList();
        for (Iterator<Integer> it = recommendedCourseIDList.iterator(); it.hasNext();) {
            Integer courseID = it.next();           
            Courses course = coursesJpaController.findCourses(courseID);           
           
            Map courseMap = new HashMap();
            courseMap.put("courseID", new Integer(course.getCourseId()));
            courseMap.put("courseName", new String(course.getName()));
            coursesMapList.add(courseMap);
        }
       
        //********************************
       
View Full Code Here


       
        // Second generate an ArrayList consist of course objects
        ArrayList coursesMapList = new ArrayList();
        for (Iterator<Integer> it = searchedCourseIDList.iterator(); it.hasNext();) {
            Integer courseID = it.next();           
            Courses course = coursesJpaController.findCourses(courseID);           
           
            Map courseMap = new HashMap();
            courseMap.put("courseID", new Integer(course.getCourseId()));
            courseMap.put("courseName", new String(course.getName()));
            coursesMapList.add(courseMap);
        }
       
        //********************************
       
View Full Code Here

        // Third generate a array list with maps containing courseIDs and their descriptions
        CoursesJpaController coursesJpaController = new CoursesJpaController();
        ArrayList coursesMapList = new ArrayList();
        for (Iterator<Integer> it = courseIDList.iterator(); it.hasNext();) {
            Integer courseID = it.next();
            Courses course = coursesJpaController.findCourses(courseID);
           
            Map courseMap = new HashMap();
            courseMap.put("courseID", new Integer(courseID));
            courseMap.put("courseName", new String(course.getName()));
            coursesMapList.add(courseMap);
        }
       
        //********************************
       
View Full Code Here

       
        //********************************
       
        // 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());
            }
        }
       
        Float totalRating = 0.f;
        for (Iterator<Courserates> it = courseRatesList.iterator(); it.hasNext();) {
            Courserates tempCourseRate = it.next();
            totalRating += tempCourseRate.getPoints().floatValue();
        }
        if (!courseRatesList.isEmpty()) {
            totalRating /= courseRatesList.size();
        }
       
        courseDetailMap.put("courseRating", new Float(totalRating.floatValue()));
       
        //********************************
       
        // Fifth get course tags
        List<Coursetag> courseTagList = course.getCoursetagList();
        ArrayList tagMapList = new ArrayList();
        for (Iterator<Coursetag> it = courseTagList.iterator(); it.hasNext();) {
            Coursetag coursetag = it.next();
           
            Map courseTagMap = new HashMap();
            courseTagMap.put("tagID", new Integer(coursetag.getTagId().getId()));
            courseTagMap.put("tagName", new String(coursetag.getTagId().getTagName()));
            tagMapList.add(courseTagMap);
        }
       
        courseDetailMap.put("courseTags", tagMapList);
       
        //********************************
       
        //Sixth get lecture list
        List<Lecture> lectureList = course.getLectureList();
        ArrayList lectureMapList = new ArrayList();
        for (Iterator<Lecture> it = lectureList.iterator(); it.hasNext();) {
            Lecture lecture = it.next();
           
            Map lectureMap = new HashMap();
View Full Code Here

        userID = Integer.valueOf(request.getParameter("userID"));
        User user = new User(userID);
       
        Integer courseID;
        courseID = Integer.valueOf(request.getParameter("courseID"));
        Courses course = new Courses(courseID);
       
        Enrollment enrollment = new Enrollment();
        enrollment.setUserId(user);
        enrollment.setCourseId(course);
        enrollment.setSysdate(new Date());
View Full Code Here

    public Courses getCourse() {
        if(course == null) {
            course = (Courses)JsfUtil.getObjectFromRequestParameter("jsfcrud.currentCourses", converter, null);
        }
        if(course == null) {
            course = new Courses();
        }
        return course;
    }
View Full Code Here

            this.course = action;
    }
   
     public String create() {
        try {          
            Courses c = course;
            //course = new Courses(courseid);
            lecture.setCourseId(c);
            jpaController.create(lecture);
           
            JsfUtil.addSuccessMessage("Lecture was successfully created.");
View Full Code Here

    public String getAsString(FacesContext context, UIComponent component, Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof Courses) {
            Courses o = (Courses) value;
            return o.getCourseId() == null ? "" : o.getCourseId().toString();
        } else {
            throw new IllegalArgumentException("object " + value + " is of type " + value.getClass().getName() + "; expected type: entity.Courses");
        }
    }
View Full Code Here

    public void testUserEnrollment() throws ParseException {
         tempUser = new User("anakin", "anakin@skywalker.net", "24ewRTtr", 'S', 500, new SimpleDateFormat("MM/dd/yy").parse("05/18/05"));
         List<Enrollment> enrollList = new ArrayList<Enrollment>();
        
         // create courses and add to enroll list of temp user;                      
         Courses tempCourse = new Courses("testClass with john lennon", 'A', "How to play guitar without pick", new SimpleDateFormat("MM/dd/yy").parse("05/18/05"));      
         tempCourse.setCreaterUserId(tempUser);
         Enrollment tempEnroll = new Enrollment();
         tempEnroll.setCourseId(tempCourse);
         tempEnroll.setSysdate(new SimpleDateFormat("MM/dd/yy").parse("01/10/02"));
         tempEnroll.setUserId(tempUser);
         // add to list of user's enrollment list
View Full Code Here

    public void create(Lecture lecture) {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Courses courseId = lecture.getCourseId();
            if (courseId != null) {
                courseId = em.getReference(courseId.getClass(), courseId.getCourseId());
                lecture.setCourseId(courseId);
            }
            em.persist(lecture);
            if (courseId != null) {
                courseId.getLectureList().add(lecture);
                courseId = em.merge(courseId);
            }
            em.getTransaction().commit();
        } finally {
            if (em != null) {
View Full Code Here

TOP

Related Classes of entity.Courses

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.