Index: lams_common/db/sql/insert_types_data.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/db/sql/insert_types_data.sql,v diff -u -r1.85.4.4.2.11 -r1.85.4.4.2.12 --- lams_common/db/sql/insert_types_data.sql 13 Apr 2010 07:11:07 -0000 1.85.4.4.2.11 +++ lams_common/db/sql/insert_types_data.sql 17 May 2010 12:35:25 -0000 1.85.4.4.2.12 @@ -132,13 +132,10 @@ INSERT INTO lams_log_event_type VALUES (1, 'TYPE_TEACHER_LEARNING_DESIGN_CREATE'); INSERT INTO lams_log_event_type VALUES (2, 'TYPE_TEACHER_LESSON_CREATE'); -INSERT INTO lams_log_event_type VALUES (3, 'TYPE_LEARNER_LESSON_START'); -INSERT INTO lams_log_event_type VALUES (4, 'TYPE_LEARNER_LESSON_FINISH'); -INSERT INTO lams_log_event_type VALUES (5, 'TYPE_LEARNER_LESSON_EXIT'); -INSERT INTO lams_log_event_type VALUES (6, 'TYPE_LEARNER_LESSON_RESUME'); -INSERT INTO lams_log_event_type VALUES (7, 'TYPE_LEARNER_ACTIVITY_START'); -INSERT INTO lams_log_event_type VALUES (8, 'TYPE_LEARNER_ACTIVITY_FINISH'); -INSERT INTO lams_log_event_type VALUES (9, 'TYPE_LEARNER_ADDED_TO_GROUP'); +INSERT INTO lams_log_event_type VALUES (3, 'TYPE_TEACHER_LESSON_START'); +INSERT INTO lams_log_event_type VALUES (4, 'TYPE_TEACHER_LESSON_CHANGE_STATE'); +INSERT INTO lams_log_event_type VALUES (5, 'TYPE_LEARNER_ACTIVITY_START'); +INSERT INTO lams_log_event_type VALUES (6, 'TYPE_LEARNER_ACTIVITY_FINISH'); INSERT INTO lams_wkspc_fld_content_type VALUES (1,'FILE'); INSERT INTO lams_wkspc_fld_content_type VALUES (2,'PACKAGE'); Index: lams_common/src/java/org/lamsfoundation/lams/logevent/LogEvent.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/logevent/LogEvent.java,v diff -u -r1.1.2.2 -r1.1.2.3 --- lams_common/src/java/org/lamsfoundation/lams/logevent/LogEvent.java 15 Apr 2010 21:15:03 -0000 1.1.2.2 +++ lams_common/src/java/org/lamsfoundation/lams/logevent/LogEvent.java 17 May 2010 12:35:25 -0000 1.1.2.3 @@ -43,13 +43,10 @@ **************************************************************************/ public static final int TYPE_TEACHER_LEARNING_DESIGN_CREATE = 1; public static final int TYPE_TEACHER_LESSON_CREATE = 2; - public static final int TYPE_LEARNER_LESSON_START = 3; - public static final int TYPE_LEARNER_LESSON_FINISH = 4; - public static final int TYPE_LEARNER_LESSON_EXIT = 5; - public static final int TYPE_LEARNER_LESSON_RESUME = 6; - public static final int TYPE_LEARNER_ACTIVITY_START = 7; - public static final int TYPE_LEARNER_ACTIVITY_FINISH = 8; - public static final int TYPE_LEARNER_ADDED_TO_GROUP = 9; + public static final int TYPE_TEACHER_LESSON_START = 3; + public static final int TYPE_TEACHER_LESSON_CHANGE_STATE = 4; + public static final int TYPE_LEARNER_ACTIVITY_START = 5; + public static final int TYPE_LEARNER_ACTIVITY_FINISH = 6; /** *************************************************************** */ /** identifier field */ @@ -59,6 +56,7 @@ private Integer logEventTypeId; /** persistent field */ + //TODO perhaps make this field possible to be null private User user; /** Date this activity was created */ Index: lams_common/src/java/org/lamsfoundation/lams/logevent/service/LogEventService.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/logevent/service/LogEventService.java,v diff -u -r1.1.2.3 -r1.1.2.4 --- lams_common/src/java/org/lamsfoundation/lams/logevent/service/LogEventService.java 15 Apr 2010 21:29:18 -0000 1.1.2.3 +++ lams_common/src/java/org/lamsfoundation/lams/logevent/service/LogEventService.java 17 May 2010 12:35:25 -0000 1.1.2.4 @@ -27,13 +27,20 @@ import java.util.List; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.events.IEventNotificationService; +import org.lamsfoundation.lams.events.ResendMessagesJob; import org.lamsfoundation.lams.logevent.LogEvent; import org.lamsfoundation.lams.logevent.dao.ILogEventDAO; import org.lamsfoundation.lams.logevent.dao.hibernate.LogEventDAO; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.exception.UserException; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.usermanagement.service.UserManagementService; +import org.quartz.JobDetail; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.quartz.SimpleTrigger; +import org.quartz.Trigger; /** * Class implements ILogEventService. @@ -45,9 +52,33 @@ private Logger log = Logger.getLogger(LogEventService.class); + /** + * The only instance of this class, since it is a singleton. + */ + private static LogEventService instance; + private ILogEventDAO logEventDAO; private IUserManagementService userManagementService; + /** + * Default constructor. Should be called only once, since this class in a singleton. + * + */ + public LogEventService() { + if (LogEventService.instance == null) { + LogEventService.instance = this; + } + } + + /** + * Gets the only existing instance of the class. + * + * @return instance of this class + */ + public static LogEventService getInstance() { + return LogEventService.instance; + } + public void logEvent(Integer logEventTypeId, Integer userId, Long learningDesignId, Long lessonId, Long activityId) { User user = (userId != null) ? (User) userManagementService.findById(User.class, userId) : null; if (user == null) { Index: lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml,v diff -u -r1.24.2.1.4.1 -r1.24.2.1.4.2 --- lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml 9 Apr 2010 18:02:17 -0000 1.24.2.1.4.1 +++ lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml 17 May 2010 12:35:20 -0000 1.24.2.1.4.2 @@ -89,6 +89,7 @@ + Index: lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java =================================================================== RCS file: /usr/local/cvsroot/lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java,v diff -u -r1.34.2.1 -r1.34.2.1.4.1 --- lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java 22 Apr 2009 04:20:36 -0000 1.34.2.1 +++ lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java 17 May 2010 12:35:20 -0000 1.34.2.1.4.1 @@ -39,6 +39,8 @@ import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.lesson.Lesson; import org.lamsfoundation.lams.lesson.ParallelWaitActivity; +import org.lamsfoundation.lams.logevent.LogEvent; +import org.lamsfoundation.lams.logevent.service.ILogEventService; import org.lamsfoundation.lams.usermanagement.User; /** @@ -53,6 +55,7 @@ protected Logger log = Logger.getLogger(ProgressEngine.class); private IActivityDAO activityDAO; + private ILogEventService logEventService; /** * Method determines next step for a learner based on the activity they have @@ -222,6 +225,10 @@ } } + logEventService.logEvent(LogEvent.TYPE_LEARNER_ACTIVITY_START, progress.getUser().getUserId(), activity + .getLearningDesign().getLearningDesignId(), progress.getLesson().getLessonId(), activity + .getActivityId()); + // update activity activityDAO.insertOrUpdate(activity); } @@ -409,5 +416,9 @@ public void setActivityDAO(IActivityDAO activityDAO) { this.activityDAO = activityDAO; } + + public void setLogEventService(ILogEventService logEventService) { + this.logEventService = logEventService; + } } \ No newline at end of file Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java,v diff -u -r1.149.2.7.2.8 -r1.149.2.7.2.9 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 16 Apr 2010 07:16:07 -0000 1.149.2.7.2.8 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 17 May 2010 12:35:06 -0000 1.149.2.7.2.9 @@ -433,7 +433,8 @@ Lesson initializedLesson = initializeLesson(lessonName, lessonDescription, learnerExportAvailable, originalLearningDesign, user, runSeqFolder, LearningDesign.COPY_TYPE_LESSON, customCSV, learnerPresenceAvailable, learnerImAvailable, liveEditEnabled); - logEventService.logEvent(LogEvent.TYPE_TEACHER_LESSON_CREATE, userID, learningDesignId, initializedLesson.getLessonId(), null); + Long initializedLearningDesignId = initializedLesson.getLearningDesign().getLearningDesignId(); + logEventService.logEvent(LogEvent.TYPE_TEACHER_LESSON_CREATE, userID, initializedLearningDesignId, initializedLesson.getLessonId(), null); return initializedLesson; } @@ -863,6 +864,7 @@ if (MonitoringService.log.isDebugEnabled()) { MonitoringService.log.debug("=============Lesson " + lessonId + " started==============="); } + logEventService.logEvent(LogEvent.TYPE_TEACHER_LESSON_START, userId, null, lessonId, null); } /** @@ -1063,6 +1065,8 @@ requestedLesson.setPreviousLessonStateId(requestedLesson.getLessonStateId()); requestedLesson.setLessonStateId(status); lessonDAO.updateLesson(requestedLesson); + logEventService.logEvent(LogEvent.TYPE_TEACHER_LESSON_CHANGE_STATE, requestedLesson.getUser().getUserId(), + null, requestedLesson.getLessonId(), null); } /** @@ -1101,6 +1105,9 @@ requestedLesson.setPreviousLessonStateId(currentStatus); } lessonDAO.updateLesson(requestedLesson); + + logEventService.logEvent(LogEvent.TYPE_TEACHER_LESSON_CHANGE_STATE, requestedLesson.getUser().getUserId(), + null, requestedLesson.getLessonId(), null); } /**