Index: lams_common/src/java/org/lamsfoundation/lams/lesson/dao/ILessonDAO.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r6087088582783c2ff827ed14cb58848595401f7d --- lams_common/src/java/org/lamsfoundation/lams/lesson/dao/ILessonDAO.java (.../ILessonDAO.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_common/src/java/org/lamsfoundation/lams/lesson/dao/ILessonDAO.java (.../ILessonDAO.java) (revision 6087088582783c2ff827ed14cb58848595401f7d) @@ -91,14 +91,6 @@ public List getLessonsCreatedByUser(Integer userID); /** - * Gets all lessons for which this user is in the staff group. Does not return - * disabled lessons or preview lessons. This is the list of lessons that a user may monitor/moderate/manage. - * @param user a User that identifies the teacher/staff member. - * @return a List with all appropriate lessons in it. - */ - public List getLessonsForMonitoring(final int userID); - - /** * Gets all lessons in the given organisation, for which this user is in the staff group. Does not return * disabled lessons or preview lessons. This is the list of lessons that a user may monitor/moderate/manage. * @param user a User that identifies the teacher/staff member. Index: lams_common/src/java/org/lamsfoundation/lams/lesson/dao/hibernate/LessonDAO.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r6087088582783c2ff827ed14cb58848595401f7d --- lams_common/src/java/org/lamsfoundation/lams/lesson/dao/hibernate/LessonDAO.java (.../LessonDAO.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_common/src/java/org/lamsfoundation/lams/lesson/dao/hibernate/LessonDAO.java (.../LessonDAO.java) (revision 6087088582783c2ff827ed14cb58848595401f7d) @@ -170,6 +170,7 @@ /** * @see org.lamsfoundation.lams.lesson.dao.ILessonDAO#getActiveLearnerByLesson(long) + * Note: Hibernate 3.1 query.uniqueResult() returns Integer, Hibernate 3.2 query.uniqueResult() returns Long */ public Integer getCountActiveLearnerByLesson(final long lessonId) { @@ -179,11 +180,12 @@ throws HibernateException { Query query = session.createQuery(COUNT_ACTIVE_LEARNERS); query.setLong("lessonId", lessonId); - return query.uniqueResult(); + Object value = query.uniqueResult(); + return new Integer (((Number)value).intValue()); } }); } -/** +/**f * Saves or Updates a Lesson. * @param lesson */ @@ -225,31 +227,6 @@ } /** - * Gets all lessons for which this user is in the staff group. Does not return - * disabled lessons or preview lessons. This is the list of lessons that a user may monitor/moderate/manage. - * TODO remove once the dummy interface is removed - it is replaced by getLessonsForMonitoring(userId, organisationId) - * TODO remove the matching query in the Hibernate file. - * @param user a User that identifies the teacher/staff member. - * @return a List with all appropriate lessons in it. - */ - public List getLessonsForMonitoring(final int userID) - { - List lessons = null; - - HibernateTemplate hibernateTemplate = new HibernateTemplate(this.getSessionFactory()); - lessons = (List)hibernateTemplate.execute( - new HibernateCallback() { - public Object doInHibernate(Session session) throws HibernateException { - Query query = session.getNamedQuery("lessonsForMonitoringByUser"); - query.setInteger("userId", userID); - List result = query.list(); - return result; - } - } - ); - return lessons; - } - /** * Gets all lessons in the given organisation, for which this user is in the staff group. Does not return * disabled lessons or preview lessons. This is the list of lessons that a user may monitor/moderate/manage. * @param user a User that identifies the teacher/staff member.