Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/MonitoringConstants.java =================================================================== diff -u -r15045d0b9b0dbb930f42a9da7757207e7a325341 -rd927914e80c12ea4cf2612788663209520c008c1 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/MonitoringConstants.java (.../MonitoringConstants.java) (revision 15045d0b9b0dbb930f42a9da7757207e7a325341) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/MonitoringConstants.java (.../MonitoringConstants.java) (revision d927914e80c12ea4cf2612788663209520c008c1) @@ -26,6 +26,7 @@ public class MonitoringConstants { + public static final String MONITORING_MODULE_NAME = "Monitoring"; public static final String MONITORING_SERVICE_BEAN_NAME = "monitoringService"; public static final String CREATE_LESSON_MESSAGE_KEY = "createLessonClass"; public static final String INIT_LESSON_MESSAGE_KEY = "initializeLesson"; Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml =================================================================== diff -u -r21b90f9c153c9dff39ba830281c0a818820d691c -rd927914e80c12ea4cf2612788663209520c008c1 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml (.../monitoringApplicationContext.xml) (revision 21b90f9c153c9dff39ba830281c0a818820d691c) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml (.../monitoringApplicationContext.xml) (revision d927914e80c12ea4cf2612788663209520c008c1) @@ -35,8 +35,7 @@ - - + Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java =================================================================== diff -u -raead34144651a924f76d7bca8645327e6820d226 -rd927914e80c12ea4cf2612788663209520c008c1 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision aead34144651a924f76d7bca8645327e6820d226) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision d927914e80c12ea4cf2612788663209520c008c1) @@ -58,30 +58,42 @@ * Checks whether the user is a staff member for the lesson, the creator of the lesson or simply a group manager. If * not, throws a UserAccessDeniedException exception */ - public void checkOwnerOrStaffMember(Integer userId, Long lessonId, String actionDescription); + void checkOwnerOrStaffMember(Integer userId, Long lessonId, String actionDescription); /** * Checks whether the user is a staff member for the lesson, the creator of the lesson or simply a group manager. If * not, throws a UserAccessDeniedException exception */ - public void checkOwnerOrStaffMember(Integer userId, Lesson lesson, String actionDescription); + void checkOwnerOrStaffMember(Integer userId, Lesson lesson, String actionDescription); /** Get the message service, which gives access to the I18N text */ - public MessageService getMessageService(); + MessageService getMessageService(); /** * Intialise lesson without creating Learning Design copy, i.e. the original LD will be used. */ - public Lesson initializeLessonWithoutLDcopy(String lessonName, String lessonDescription, long learningDesignID, - User user, String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, - Boolean learnerExportAvailable, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, - Boolean liveEditEnabled, Boolean enableLessonNotifications, Boolean learnerRestart, - Integer scheduledNumberDaysToLessonFinish, Lesson precedingLesson); + Lesson initializeLessonWithoutLDcopy(String lessonName, String lessonDescription, long learningDesignID, User user, + String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, Boolean learnerExportAvailable, + Boolean learnerPresenceAvailable, Boolean learnerImAvailable, Boolean liveEditEnabled, + Boolean enableLessonNotifications, Boolean learnerRestart, Integer scheduledNumberDaysToLessonFinish, + Lesson precedingLesson); /** - * Initialize a new lesson so as to start the learning process. It needs to notify lams which learning design it - * belongs to. The initialize process doesn't involve the setup of lesson class and organization. + *

+ * Create new lesson according to the learning design specified by the user. This involves following major steps: + *

* + *
  • 1. Make a runtime copy of static learning design defined in authoring
  • 2. Go through all the tool + * activities defined in the learning design, create a runtime copy of all tool's content.
  • + * + *

    + * As a runtime design, it is not copied into any folder. + *

    + * + *

    + * The initialization process doesn't involve the setup of lesson class and organization. + *

    + * * @param lessonName * the name of the lesson * @param lessonDescription @@ -108,10 +120,10 @@ * feature) * @return the lesson initialized. */ - public Lesson initializeLesson(String lessonName, String lessonDescription, long learningDesignId, - Integer organisationId, Integer userID, String customCSV, Boolean enableLessonIntro, - Boolean displayDesignImage, Boolean learnerExportAvailable, Boolean learnerPresenceAvailable, - Boolean learnerImAvailable, Boolean liveEditEnabled, Boolean enableNotifications, Boolean learnerRestart, + Lesson initializeLesson(String lessonName, String lessonDescription, long learningDesignId, Integer organisationId, + Integer userID, String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, + Boolean learnerExportAvailable, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, + Boolean liveEditEnabled, Boolean enableNotifications, Boolean learnerRestart, Integer numberDaysToLessonFinish, Long precedingLessonId); /** @@ -126,34 +138,42 @@ * @return WDDX message packet containing the Lesson ID * @throws Exception */ - public String initializeLesson(Integer creatorUserId, String lessonPacket) throws Exception; + String initializeLesson(Integer creatorUserId, String lessonPacket) throws Exception; /** * Create new lesson according to the learning design specified by the user, but for a preview session rather than a * normal learning session. The design is not assigned to any workspace folder. */ - public Lesson initializeLessonForPreview(String lessonName, String lessonDescription, long learningDesignId, + Lesson initializeLessonForPreview(String lessonName, String lessonDescription, long learningDesignId, Integer userID, String customCSV, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, Boolean liveEditEnabled); /** * Setup the lesson class and organization for a lesson according to the input from monitoring GUI interface. * + *

    + * Pre-condition: This method must be called under the condition of the the new lesson exists (without lesson + * class). + *

    + *

    + * A lesson class record should be inserted and organization should be setup after execution of this service. + *

    + * * @param lessonId * the lesson without lesson class and organization * @param organisation * the organization this lesson belongs to. - * @param name - * of learner group + * @param learnerGroupName + * name of learner group * @param organizationUsers * a list of learner will be in this new lessons. - * @param name - * of staff group + * @param staffGroupName + * name of staff group * @param staffs * a list of staffs who will be in charge of this lesson. * @return the lesson with lesson class and organization */ - public Lesson createLessonClassForLesson(long lessonId, Organisation organisation, String learnerGroupName, + Lesson createLessonClassForLesson(long lessonId, Organisation organisation, String learnerGroupName, List organizationUsers, String staffGroupName, List staffs, Integer userID) throws UserAccessDeniedException; @@ -167,14 +187,14 @@ * @throws LamsToolServiceException * the exception occurred during the lams and tool interaction to start a lesson. */ - public void startLesson(long lessonId, Integer userId) throws UserAccessDeniedException; + void startLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** * Do any normal initialisation needed for gates and branching. Done both when a lesson is started, or for new * activities added during a Live Edit. Returns a new MaxID for the design if needed. If MaxID is returned, update * the design with this new value and save the whole design (as initialiseSystemActivities has changed the design). */ - public Integer startSystemActivity(Activity activity, Integer currentMaxId, Date lessonStartTime, String lessonName); + Integer startSystemActivity(Activity activity, Integer currentMaxId, Date lessonStartTime, String lessonName); /** *

    @@ -193,11 +213,10 @@ * the name lesson incorporating this gate - used for the description of the Quartz job. Optional. * @returns An updated gate, that should be saved by the calling code. */ - public ScheduleGateActivity runGateScheduler(ScheduleGateActivity scheduleGate, Date schedulingStartTime, - String lessonName); + ScheduleGateActivity runGateScheduler(ScheduleGateActivity scheduleGate, Date schedulingStartTime, String lessonName); /** - * Start a lesson on schedule datetime. + * Start a lesson on scheduled datetime. * * @param lessonId * @param startDate @@ -206,18 +225,18 @@ * checks that the user is a staff member for this lesson * @see org.lamsfoundation.lams.monitoring.service#startLesson(long) */ - public void startLessonOnSchedule(long lessonId, Date startDate, Integer userId) throws UserAccessDeniedException; + void startLessonOnSchedule(long lessonId, Date startDate, Integer userId) throws UserAccessDeniedException; /** - * Finish a lesson on schedule datetime. + * Finish a lesson on scheduled datetime. * * @param lessonId * @param endDate * number of days since lesson start when the lesson should be closed. * @param userId * checks that the user is a staff member for this lesson */ - public void finishLessonOnSchedule(long lessonId, int scheduledNumberDaysToLessonFinish, Integer userId) + void finishLessonOnSchedule(long lessonId, int scheduledNumberDaysToLessonFinish, Integer userId) throws UserAccessDeniedException; /** @@ -231,7 +250,7 @@ * @param endDate * teh lesson end date and time. */ - public void finishLesson(long lessonId, Integer userId) throws UserAccessDeniedException; + void finishLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** * Set whether or not the export portfolio button is available in learner. Sets it to FALSE if @@ -243,7 +262,7 @@ * @return new value for learnerExportAvailable. Normally will be same as input parameter, will only be different if * the value cannot be updated for some reason. */ - public Boolean setLearnerPortfolioAvailable(long lessonId, Integer userId, Boolean learnerExportAvailable); + Boolean setLearnerPortfolioAvailable(long lessonId, Integer userId, Boolean learnerExportAvailable); /** * Set whether or not the learner presence button is available in monitor. Sets it to FALSE if @@ -255,7 +274,7 @@ * @return new value for learnerPresenceAvailable. Normally will be same as input parameter, will only be different * if the value cannot be updated for some reason. */ - public Boolean setPresenceAvailable(long lessonId, Integer userId, Boolean learnerPresenceAvailable); + Boolean setPresenceAvailable(long lessonId, Integer userId, Boolean learnerPresenceAvailable); /** * Set whether or not the learner IM button is available in monitor. Sets it to FALSE if learnerExportAvailable is @@ -267,7 +286,7 @@ * @return new value for learnerPresenceImAvailable. Normally will be same as input parameter, will only be * different if the value cannot be updated for some reason. */ - public Boolean setPresenceImAvailable(long lessonId, Integer userId, Boolean learnerPresenceImAvailable); + Boolean setPresenceImAvailable(long lessonId, Integer userId, Boolean learnerPresenceImAvailable); /** * Set whether or not the live edit is available in monitor. Sets it to FALSE if learnerExportAvailable is null. @@ -279,9 +298,9 @@ * @return new value for liveEditEnabled. Normally will be same as input parameter, will only be different if the * value cannot be updated for some reason. */ - public Boolean setLiveEditEnabled(long lessonId, Integer userId, Boolean liveEditEnabled); + Boolean setLiveEditEnabled(long lessonId, Integer userId, Boolean liveEditEnabled); - public String forceCompleteActivitiesByUser(Integer learnerId, Integer requesterId, long lessonId, Long activityId, + String forceCompleteActivitiesByUser(Integer learnerId, Integer requesterId, long lessonId, Long activityId, boolean removeLearnerContent); /** @@ -292,15 +311,15 @@ * @param userId * checks that the user is a staff member for this lesson */ - public void archiveLesson(long lessonId, Integer userId) throws UserAccessDeniedException; + void archiveLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** * Unarchive the specified the lesson. Reverts back to its previous state. * * @param lessonId * the specified the lesson id. */ - public void unarchiveLesson(long lessonId, Integer userId); + void unarchiveLesson(long lessonId, Integer userId); /** * A lesson can only be suspended if it is started. The purpose of suspending is to hide the lesson from learners @@ -311,7 +330,7 @@ * @param userId * checks that the user is a staff member for this lesson */ - public void suspendLesson(long lessonId, Integer userId) throws UserAccessDeniedException; + void suspendLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** * Unsuspend a lesson, which state must be Lesson.SUSPEND_STATE. Returns the lesson back to its previous state. @@ -321,7 +340,7 @@ * @param userId * checks that the user is a staff member for this lesson */ - public void unsuspendLesson(long lessonId, Integer userId) throws UserAccessDeniedException; + void unsuspendLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** *

    @@ -334,7 +353,7 @@ * @param userId * checks that the user is a staff member for this lesson */ - public void removeLesson(long lessonId, Integer userId) throws UserAccessDeniedException; + void removeLesson(long lessonId, Integer userId) throws UserAccessDeniedException; /** * Set the gate to open to let all the learners through. This learning service is triggerred by the system @@ -344,7 +363,7 @@ * @param gate * the id of the gate we need to open. */ - public GateActivity openGate(Long gateId); + GateActivity openGate(Long gateId); /** * Allows a single learner to pass the gate. @@ -353,15 +372,15 @@ * @param userId * @return */ - public GateActivity openGateForSingleUser(Long gateId, Integer userId); + GateActivity openGateForSingleUser(Long gateId, Integer userId); /** * Set the gate to closed. * * @param gate * the id of the gate we need to close. */ - public GateActivity closeGate(Long gateId); + GateActivity closeGate(Long gateId); /** * This method returns the details for the given Lesson in WDDX format. Object inside the packet is a @@ -374,7 +393,7 @@ * @return String The requested details in wddx format * @throws IOException */ - public String getLessonDetails(Long lessonID, Integer userID) throws IOException; + String getLessonDetails(Long lessonID, Integer userID) throws IOException; /** * Returns a list of learners participating in the given Lesson @@ -387,7 +406,7 @@ * * @throws IOException */ - public String getLessonLearners(Long lessonID, Integer userID) throws IOException; + String getLessonLearners(Long lessonID, Integer userID) throws IOException; /** * Returns a list of staff participating in the given Lesson @@ -400,7 +419,7 @@ * * @throws IOException */ - public String getLessonStaff(Long lessonID, Integer userID) throws IOException; + String getLessonStaff(Long lessonID, Integer userID) throws IOException; /** * Returns users by search type criteria. It's sorted by first and last user names. @@ -425,9 +444,9 @@ * @return String The requested details in wddx format * @throws IOException */ - public String getLearningDesignDetails(Long lessonID) throws IOException; + String getLearningDesignDetails(Long lessonID) throws IOException; - public List getAllContributeActivityDTO(Long lessonID); + List getAllContributeActivityDTO(Long lessonID); /** * This method returns the url associated with the activity in the monitoring enviornment. This is the URL that @@ -448,7 +467,7 @@ * @throws IOException * @throws LamsToolServiceException */ - public String getLearnerActivityURL(Long lessonID, Long activityID, Integer learnerUserID, Integer requestingUserId) + String getLearnerActivityURL(Long lessonID, Long activityID, Integer learnerUserID, Integer requestingUserId) throws IOException, LamsToolServiceException; /** @@ -463,7 +482,7 @@ * @return String The required information in WDDX format * @throws IOException */ - public String getActivityMonitorURL(Long lessonID, Long activityID, String contentFolderID, Integer userID) + String getActivityMonitorURL(Long lessonID, Long activityID, String contentFolderID, Integer userID) throws IOException, LamsToolServiceException; /** @@ -480,7 +499,7 @@ * @return String The acknowledgement message/error in WDDX format * @throws IOException */ - public String moveLesson(Long lessonID, Integer targetWorkspaceFolderID, Integer userID) throws IOException; + String moveLesson(Long lessonID, Integer targetWorkspaceFolderID, Integer userID) throws IOException; /** * This method changes the name of an existing Lesson to the one specified. @@ -494,7 +513,7 @@ * @return String The acknowledgement message/error in WDDX format * @throws IOException */ - public String renameLesson(Long lessonID, String newName, Integer userID) throws IOException; + String renameLesson(Long lessonID, String newName, Integer userID) throws IOException; /** * Return an activity object based on the requested id. @@ -503,7 +522,7 @@ * id of the activity. * @return the requested activity object. */ - public Activity getActivityById(Long activityId); + Activity getActivityById(Long activityId); /** * Return an activity object based on the requested id. Where possible, give it the type we want so that it can be @@ -513,7 +532,7 @@ * id of the activity. * @return the requested activity object. */ - public Activity getActivityById(Long activityId, Class clasz); + Activity getActivityById(Long activityId, Class clasz); /** * Return an activity object based on the requested id. @@ -522,7 +541,7 @@ * id of the activity. * @return the requested activity object. */ - public GroupingActivity getGroupingActivityById(Long activityID); + GroupingActivity getGroupingActivityById(Long activityID); /** * Returns an acknowledgement that the gate has been released. Returns true if the gate has been released and false @@ -534,7 +553,7 @@ * The lesson_id of the Lesson * @return */ - public String releaseGate(Long activityID) throws IOException; + String releaseGate(Long activityID) throws IOException; /** * Perform chosen grouping. The groups contains a list of Hashtable which contain following information for each @@ -549,7 +568,7 @@ * @param groups * list of group information. */ - public void performChosenGrouping(GroupingActivity groupingActivity, List groups) throws LessonServiceException; + void performChosenGrouping(GroupingActivity groupingActivity, List groups) throws LessonServiceException; // --------------------------------------------------------------------- // Preview Methods @@ -563,7 +582,7 @@ * ID of the lesson * @return Lesson */ - public abstract Lesson createPreviewClassForLesson(int userID, long lessonID) throws UserAccessDeniedException; + abstract Lesson createPreviewClassForLesson(int userID, long lessonID) throws UserAccessDeniedException; /** * Remove all the details for a particular preview lessons. The transaction handling for this method should be @@ -572,7 +591,7 @@ * @param lessonID * ID of the lesson which is the preview session. Mandatory. */ - public abstract void deletePreviewLesson(long lessonID); + abstract void deletePreviewLesson(long lessonID); /** * Remove all the "old" preview lessons. Removes all preview lessons older than the number of days specified in the @@ -583,9 +602,9 @@ * * @return number of lessons deleted. */ - public abstract int deleteAllOldPreviewLessons(); + abstract int deleteAllOldPreviewLessons(); - /* Supports the Chosen Groupings and Branching */ + /* Supports the Chosen Groupings and Branching */ /** * Get all the active learners in the lesson who are not in a group or in a branch. * @@ -599,44 +618,55 @@ * true/false for GroupingActivities, always false for non-GroupingActivities * @return Sorted set of Users, sorted by surname */ - public SortedSet getClassMembersNotGrouped(Long lessonID, Long activityID, boolean useCreateGrouping); + SortedSet getClassMembersNotGrouped(Long lessonID, Long activityID, boolean useCreateGrouping); /** - * Add a new group to a grouping activity. If name already exists or the name is blank, does not add a new group. + * Add a new group to a grouping activity. If name already exists or the name is blank, does not add a new group. If + * the activity is a grouping activity, then set useCreatingGrouping = true to base the list on the create grouping. + * Otherwise leave it false and it will use the grouping applied to the activity - this is used for branching + * activities. * + * If it is a teacher chosen branching activity and the grouping doesn't exist, it creates one. + * * @param activityID - * id of the activity + * id of the grouping activity * @param name * group name * @throws LessonServiceException + * , MonitoringServiceException */ - public abstract Group addGroup(Long activityID, String name, boolean overrideMaxNumberOfGroups) + abstract Group addGroup(Long activityID, String name, boolean overrideMaxNumberOfGroups) throws LessonServiceException, MonitoringServiceException; /** * Remove a group to from a grouping activity. If the group does not exists then nothing happens. If the group is * already used (e.g. a tool session exists) then it throws a LessonServiceException. * + * If the activity is a grouping activity, then set useCreatingGrouping = true to base the list on the create + * grouping. Otherwise leave it false and it will use the grouping applied to the activity - this is used for + * branching activities. + * + * If it is a teacher chosen branching activity and the grouping doesn't exist, it creates one. + * * @param activityID - * id of the activity + * id of the grouping activity * @param name * group name * @throws LessonServiceException **/ - public abstract void removeGroup(Long activityID, Long groupID) throws LessonServiceException; + abstract void removeGroup(Long activityID, Long groupID) throws LessonServiceException; /** * Add learners to a group. Doesn't necessarily check if the user is already in another group. */ - public abstract void addUsersToGroup(Long activityID, Long groupID, String learnerIDs[]) - throws LessonServiceException; + abstract void addUsersToGroup(Long activityID, Long groupID, String learnerIDs[]) throws LessonServiceException; /** * Remove a user to a group. If the user is not in the group, then nothing is changed. * * @throws LessonServiceException */ - public abstract void removeUsersFromGroup(Long activityID, Long groupID, String learnerIDs[]) + abstract void removeUsersFromGroup(Long activityID, Long groupID, String learnerIDs[]) throws LessonServiceException; /** @@ -649,7 +679,7 @@ * @param learnerIDs * the IDS of the learners to be added. */ - public void addUsersToBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException; + void addUsersToBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException; /** * Remove learners from a branch. Assumes there should only be one group for this branch. Use for Teacher Chosen @@ -660,13 +690,13 @@ * @param learnerIDs * the IDS of the learners to be added. */ - public void removeUsersFromBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException; + void removeUsersFromBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException; /** * Has anyone started this branch / branching activity ? Irrespective of the groups. Used to determine if a branch * mapping can be removed. */ - public boolean isActivityAttempted(Activity activity) throws LessonServiceException; + boolean isActivityAttempted(Activity activity) throws LessonServiceException; /** * Match group(s) to a branch. Doesn't necessarily check if the group is already assigned to another branch. Use for @@ -677,7 +707,7 @@ * @param learnerIDs * the IDS of the learners to be added. */ - public void addGroupToBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException; + void addGroupToBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException; /** * Remove group / branch mapping. Cannot be done if any users in the group have started the branch. Used for group @@ -688,38 +718,52 @@ * @param learnerIDs * the IDS of the learners to be added. */ - public void removeGroupFromBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException; + void removeGroupFromBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException; /** * Get all the groups that exist for the related grouping activity that have not been allocated to a branch. * * @param branchingActivityID * Activity id of the branchingActivity */ - public SortedSet getGroupsNotAssignedToBranch(Long branchingActivityID) throws LessonServiceException; + SortedSet getGroupsNotAssignedToBranch(Long branchingActivityID) throws LessonServiceException; /** * Get the list of users who have attempted an activity. This is based on the progress engine records. This will * give the users in all tool sessions for an activity (if it is a tool activity) or it will give all the users who * have attempted an activity that doesn't have any tool sessions, i.e. system activities such as branching. */ - public List getLearnersHaveAttemptedActivity(Activity activity) throws LessonServiceException; + List getLearnersHaveAttemptedActivity(Activity activity) throws LessonServiceException; /** Get the record of the learner's progress for a particular lesson */ - public LearnerProgress getLearnerProgress(Integer learnerId, Long lessonId); + LearnerProgress getLearnerProgress(Integer learnerId, Long lessonId); /** * Set a groups name */ - public void setGroupName(Long groupID, String name); + void setGroupName(Long groupID, String name); /** Open Time Chart */ - public Boolean openTimeChart(long lessonId, Integer userId) throws UserAccessDeniedException; + Boolean openTimeChart(long lessonId, Integer userId) throws UserAccessDeniedException; /** Get Organisation by organisationId */ - public Organisation getOrganisation(Integer organisationId); + Organisation getOrganisation(Integer organisationId); - public void initToolSessionIfSuitable(ToolActivity activity, Lesson lesson); + /** + * If the activity is not grouped and not in a branch, then it create lams tool session for all the learners in the + * lesson. After the creation of lams tool session, it delegates to the tool instances to create tool's own tool + * session. Can't create it for a grouped activity or an activity in a branch as it may not be applicable to all + * users. + *

    + * + * @param activity + * the tool activity that all tool session reference to. + * @param lesson + * the target lesson that these tool sessions belongs to. + * @throws LamsToolServiceException + * the exception when lams is talking to tool. + */ + void initToolSessionIfSuitable(ToolActivity activity, Lesson lesson); /** * Used in admin to clone lessons using the given lesson Ids (from another group) into the given group. Given staff @@ -731,9 +775,9 @@ * @param staffIds * @param learnerIds * @param group - * @return + * @return number of lessons created. * @throws MonitoringServiceException */ - public int cloneLessons(String[] lessonIds, Boolean addAllStaff, Boolean addAllLearners, String[] staffIds, + int cloneLessons(String[] lessonIds, Boolean addAllStaff, Boolean addAllLearners, String[] staffIds, String[] learnerIds, Organisation group) throws MonitoringServiceException; -} \ No newline at end of file +} Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== diff -u -raead34144651a924f76d7bca8645327e6820d226 -rd927914e80c12ea4cf2612788663209520c008c1 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision aead34144651a924f76d7bca8645327e6820d226) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision d927914e80c12ea4cf2612788663209520c008c1) @@ -153,14 +153,10 @@ private static final String AUDIT_LESSON_CREATED_KEY = "audit.lesson.created"; - private static final int DEFAULT_LEARNER_PROGRESS_BATCH_SIZE = 15; - private ILessonDAO lessonDAO; private ILessonClassDAO lessonClassDAO; - private ITransitionDAO transitionDAO; - private IActivityDAO activityDAO; private IBaseDAO baseDAO; @@ -196,7 +192,6 @@ private ILogEventService logEventService; /** Message keys */ - private static final String FORCE_COMPLETE_STOP_MESSAGE_ACTIVITY_DONE = "force.complete.stop.message.activity.done"; private static final String FORCE_COMPLETE_STOP_MESSAGE_GROUPING_ERROR = "force.complete.stop.message.grouping.error"; @@ -243,14 +238,6 @@ } /** - * @param transitionDAO - * The transitionDAO to set. - */ - public void setTransitionDAO(ITransitionDAO transitionDAO) { - this.transitionDAO = transitionDAO; - } - - /** * * @param learnerService */ @@ -342,9 +329,6 @@ this.activityDAO = activityDAO; } - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; @@ -370,20 +354,11 @@ // Service Methods // --------------------------------------------------------------------- - private void auditAction(String messageKey, Object[] args) { - String message = messageService.getMessage(messageKey, args); - auditService.log("Monitoring", message); - } - @Override public void checkOwnerOrStaffMember(Integer userId, Long lessonId, String actionDescription) { checkOwnerOrStaffMember(userId, lessonDAO.getLesson(lessonId), actionDescription); } - /** - * Checks whether the user is a staff member for the lesson, the creator of the lesson or simply a group manager. If - * not, throws a UserAccessDeniedException exception - */ @Override public void checkOwnerOrStaffMember(Integer userId, Lesson lesson, String actionDescription) { User user = (User) baseDAO.find(User.class, userId); @@ -406,21 +381,6 @@ } } - /** - *

    - * Create new lesson according to the learning design specified by the user. This involves following major steps: - *

    - * - *
  • 1. Make a runtime copy of static learning design defined in authoring
  • 2. Go through all the tool - * activities defined in the learning design, create a runtime copy of all tool's content.
  • - * - *

    - * As a runtime design, it is not copied into any folder. - *

    - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#initializeLesson(String, String, long, - * Integer) - */ @Override public Lesson initializeLesson(String lessonName, String lessonDescription, long learningDesignId, Integer organisationId, Integer userID, String customCSV, Boolean enableLessonIntro, @@ -471,10 +431,6 @@ return initializedLesson; } - /** - * Create new lesson according to the learning design specified by the user, but for a preview session rather than a - * normal learning session. The design is not assigned to any workspace folder. - */ @Override public Lesson initializeLessonForPreview(String lessonName, String lessonDescription, long learningDesignId, Integer userID, String customCSV, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, @@ -491,9 +447,6 @@ learnerImAvailable, liveEditEnabled, true, false, null, null); } - /** - * Intialise lesson without creating Learning Design copy, i.e. the original LD will be used. - */ @Override public Lesson initializeLessonWithoutLDcopy(String lessonName, String lessonDescription, long learningDesignID, User user, String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, @@ -509,12 +462,12 @@ displayDesignImage, learnerExportAvailable, learnerPresenceAvailable, learnerImAvailable, liveEditEnabled, enableLessonNotifications, learnerRestart, scheduledNumberDaysToLessonFinish, precedingLesson); - auditAction(MonitoringService.AUDIT_LESSON_CREATED_KEY, new Object[] { lessonName, learningDesign.getTitle(), + writeAuditLog(MonitoringService.AUDIT_LESSON_CREATED_KEY, new Object[] { lessonName, learningDesign.getTitle(), learnerExportAvailable }); return lesson; } - public Lesson initializeLesson(String lessonName, String lessonDescription, LearningDesign originalLearningDesign, + private Lesson initializeLesson(String lessonName, String lessonDescription, LearningDesign originalLearningDesign, User user, WorkspaceFolder workspaceFolder, int copyType, String customCSV, Boolean enableLessonIntro, Boolean displayDesignImage, Boolean learnerExportAvailable, Boolean learnerPresenceAvailable, Boolean learnerImAvailable, Boolean liveEditEnabled, Boolean enableLessonNotifications, @@ -537,15 +490,11 @@ displayDesignImage, learnerExportAvailable, learnerPresenceAvailable, learnerImAvailable, liveEditEnabled, enableLessonNotifications, learnerRestart, scheduledNumberDaysToLessonFinish, precedingLesson); - auditAction(MonitoringService.AUDIT_LESSON_CREATED_KEY, + writeAuditLog(MonitoringService.AUDIT_LESSON_CREATED_KEY, new Object[] { lessonName, copiedLearningDesign.getTitle(), learnerExportAvailable }); return lesson; } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#initializeLesson(java.util.Integer, - * java.lang.String) - */ @Override public String initializeLesson(Integer creatorUserId, String lessonPacket) throws Exception { FlashMessage flashMessage = null; @@ -604,21 +553,6 @@ } } - /** - *

    - * Pre-condition: This method must be called under the condition of the the new lesson exists (without lesson - * class). - *

    - *

    - * A lesson class record should be inserted and organization should be setup after execution of this service. - *

    - * - * @param staffGroupName - * @param learnerGroupName - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#createLessonClassForLesson(long, - * org.lamsfoundation.lams.usermanagement.Organisation, java.util.List, java.util.List, java.util.Integer) - */ @Override @SuppressWarnings("unchecked") public Lesson createLessonClassForLesson(long lessonId, Organisation organisation, String learnerGroupName, @@ -654,15 +588,6 @@ return newLesson; } - /** - * Start lesson on schedule. - * - * @param lessonId - * @param startDate - * @param userID - * : checks that this user is a staff member for this lesson - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#startLessonOnSchedule(long , Date, User) - */ @Override public void startLessonOnSchedule(long lessonId, Date startDate, Integer userId) { @@ -720,13 +645,6 @@ } } - /** - * Finish lesson on schedule. - * - * @param lessonId - * @param endDate - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#finishLessonOnSchedule(long , Date , User) - */ @Override public void finishLessonOnSchedule(long lessonId, int scheduledNumberDaysToLessonFinish, Integer userId) { // we get the lesson want to finish @@ -812,9 +730,6 @@ } } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#startlesson(long) - */ @Override public void startLesson(long lessonId, Integer userId) { // System.out.println(messageService.getMessage("NO.SUCH.LESSON",new @@ -875,11 +790,6 @@ logEventService.logEvent(LogEvent.TYPE_TEACHER_LESSON_START, userId, null, lessonId, null); } - /** - * Do any normal initialisation needed for gates and branching. Done both when a lesson is started, or for new - * activities added during a Live Edit. Returns a new MaxID for the design if needed. If MaxID is returned, update - * the design with this new value and save the whole design (as initialiseSystemActivities has changed the design). - */ @Override public Integer startSystemActivity(Activity activity, Integer currentMaxId, Date lessonStartTime, String lessonName) { Integer newMaxId = null; @@ -916,23 +826,6 @@ return newMaxId; } - /** - *

    - * Runs the system scheduler to start the scheduling for opening gate and closing gate. It involves a couple of - * steps to start the scheduler: - *

    - *
  • 1. Initialize the resource needed by scheduling job by setting them into the job data map.
  • 2. Create - * customized triggers for the scheduling.
  • 3. start the scheduling job
  • - * - * @param scheduleGate - * the gate that needs to be scheduled. - * @param schedulingStartTime - * the time on which the gate open should be based if an offset is used. For starting a lesson, this is - * the lessonStartTime. For live edit, it is now. - * @param lessonName - * the name lesson incorporating this gate - used for the description of the Quartz job. Optional. - * @returns An updated gate, that should be saved by the calling code. - */ @Override public ScheduleGateActivity runGateScheduler(ScheduleGateActivity scheduleGate, Date schedulingStartTime, String lessonName) { @@ -979,9 +872,6 @@ return scheduleGate; } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#finishLesson(long) - */ @Override public void finishLesson(long lessonId, Integer userId) { Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -993,12 +883,6 @@ setLessonState(requestedLesson, Lesson.FINISHED_STATE); } - /** - * Archive the specified the lesson. When archived, the data is retained but the learners cannot access the details. - * - * @param lessonId - * the specified the lesson id. - */ @Override public void archiveLesson(long lessonId, Integer userId) { Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1013,12 +897,6 @@ } } - /** - * Unarchive the specified the lesson. Reverts back to its previous state. - * - * @param lessonId - * the specified the lesson id. - */ @Override public void unarchiveLesson(long lessonId, Integer userId) { Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1031,10 +909,6 @@ } - /** - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#suspendLesson(long) - */ @Override public void suspendLesson(long lessonId, Integer userId) { Lesson lesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1048,10 +922,6 @@ } } - /** - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#unsuspendLesson(long) - */ @Override public void unsuspendLesson(long lessonId, Integer userId) { Lesson lesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1122,9 +992,6 @@ null, requestedLesson.getLessonId(), null); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#removeLesson(long) - */ @Override public void removeLesson(long lessonId, Integer userId) { Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1138,30 +1005,27 @@ setLessonState(requestedLesson, Lesson.REMOVED_STATE); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#setLearnerPortfolioAvailable(long, - * java.lang.Integer, boolean) - */ @Override - public Boolean setLearnerPortfolioAvailable(long lessonId, Integer userId, Boolean learnerExportAvailable) { - Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); - if (requestedLesson == null) { + public Boolean setLearnerPortfolioAvailable(long lessonId, Integer userId, Boolean isLearnerExportAvailable) { + isLearnerExportAvailable = (isLearnerExportAvailable != null) ? isLearnerExportAvailable : Boolean.FALSE; + + Lesson lesson = lessonDAO.getLesson(new Long(lessonId)); + if (lesson == null) { throw new MonitoringServiceException("Lesson for id=" + lessonId - + " is missing. Unable to set learner portfolio available to " + learnerExportAvailable); + + " is missing. Unable to set learner portfolio available to " + isLearnerExportAvailable); } - checkOwnerOrStaffMember(userId, requestedLesson, "set learner portfolio available"); - requestedLesson.setLearnerExportAvailable(learnerExportAvailable != null ? learnerExportAvailable - : Boolean.FALSE); - auditAction(MonitoringService.AUDIT_LEARNER_PORTFOLIO_SET, new Object[] { requestedLesson.getLessonName(), - requestedLesson.getLearnerExportAvailable() }); - lessonDAO.updateLesson(requestedLesson); - return requestedLesson.getLearnerExportAvailable(); + checkOwnerOrStaffMember(userId, lesson, "set learner portfolio available"); + + lesson.setLearnerExportAvailable(isLearnerExportAvailable); + lessonDAO.updateLesson(lesson); + + //audit log enabling/disabling export portfolio + writeAuditLog(MonitoringService.AUDIT_LEARNER_PORTFOLIO_SET, new Object[] { lesson.getLessonName(), + lesson.getLearnerExportAvailable() }); + + return lesson.getLearnerExportAvailable(); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#setPresenceAvailable(long, java.lang.Integer, - * boolean) - */ @Override public Boolean setPresenceAvailable(long lessonId, Integer userId, Boolean presenceAvailable) { Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1175,10 +1039,6 @@ return requestedLesson.getLearnerPresenceAvailable(); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#setPresenceImAvailable(long, - * java.lang.Integer, boolean) - */ @Override public Boolean setPresenceImAvailable(long lessonId, Integer userId, Boolean presenceImAvailable) { Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1192,10 +1052,6 @@ return requestedLesson.getLearnerImAvailable(); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#setLiveEditEnabled(long, java.lang.Integer, - * boolean) - */ @Override public Boolean setLiveEditEnabled(long lessonId, Integer userId, Boolean liveEditEnabled) { Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -1209,9 +1065,6 @@ return requestedLesson.getLiveEditEnabled(); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#openGate(org.lamsfoundation.lams.learningdesign.GateActivity) - */ @Override public GateActivity openGate(Long gateId) { GateActivity gate = (GateActivity) activityDAO.getActivityByActivityId(gateId); @@ -1262,9 +1115,6 @@ return gate; } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#closeGate(org.lamsfoundation.lams.learningdesign.GateActivity) - */ @Override public GateActivity closeGate(Long gateId) { GateActivity gate = (GateActivity) activityDAO.getActivityByActivityId(gateId); @@ -1273,10 +1123,6 @@ return gate; } - /** - * @throws LamsToolServiceException - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#forceCompleteLessonByUser(Integer,long,long) - */ @Override public String forceCompleteActivitiesByUser(Integer learnerId, Integer requesterId, long lessonId, Long activityId, boolean removeLearnerContent) { @@ -1313,6 +1159,7 @@ .getCompletedActivities().containsKey(parentActivity) || ((parentActivity .getParentActivity() != null) && learnerProgress.getCompletedActivities().containsKey( parentActivity.getParentActivity())))))) { + return forceUncompleteActivity(learnerProgress, stopActivity, removeLearnerContent); } } @@ -1710,11 +1557,6 @@ new Object[] { targetActivity.getTitle() }); } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getLessonDetails(java.lang.Long) - */ @Override public String getLessonDetails(Long lessonID, Integer userID) throws IOException { Lesson lesson = lessonDAO.getLesson(new Long(lessonID)); @@ -1757,11 +1599,6 @@ return flashMessage.serializeMessage(); } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getLessonLearners(java.lang.Long) - */ @Override public String getLessonLearners(Long lessonID, Integer userID) throws IOException { Lesson lesson = lessonDAO.getLesson(lessonID); @@ -1783,11 +1620,6 @@ return flashMessage.serializeMessage(); } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getLessonStaff(java.lang.Long) - */ @Override public String getLessonStaff(Long lessonID, Integer userID) throws IOException { Lesson lesson = lessonDAO.getLesson(lessonID); @@ -1950,36 +1782,22 @@ return usersCompletedLesson; } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getLearningDesignDetails(java.lang.Long) - */ @Override public String getLearningDesignDetails(Long lessonID) throws IOException { Lesson lesson = lessonDAO.getLesson(lessonID); return authoringService.getLearningDesignDetails(lesson.getLearningDesign().getLearningDesignId(), ""); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getActivityById(Long) - */ @Override public Activity getActivityById(Long activityId) { return activityDAO.getActivityByActivityId(activityId); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getActivityById(Long, Class) - */ @Override public Activity getActivityById(Long activityId, Class clasz) { return activityDAO.getActivityByActivityId(activityId, clasz); } - /** - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getGroupingActivityById(Long) - */ @Override public GroupingActivity getGroupingActivityById(Long activityID) { Activity activity = getActivityById(activityID); @@ -2010,12 +1828,6 @@ return result; } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getLearnerActivityURL(java.lang.Long, - * java.lang.Integer) - */ @Override public String getLearnerActivityURL(Long lessonID, Long activityID, Integer learnerUserID, Integer requestingUserId) throws IOException, LamsToolServiceException { @@ -2042,11 +1854,6 @@ return url; } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#getActivityMonitorURL(java.lang.Long) - */ @Override public String getActivityMonitorURL(Long lessonID, Long activityID, String contentFolderID, Integer userID) throws IOException, LamsToolServiceException { @@ -2065,12 +1872,6 @@ return null; } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#moveLesson(java.lang.Long, java.lang.Integer, - * java.lang.Integer) - */ @Override public String moveLesson(Long lessonID, Integer targetWorkspaceFolderID, Integer userID) throws IOException { Lesson lesson = lessonDAO.getLesson(lessonID); @@ -2099,12 +1900,6 @@ } - /** - * (non-Javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#renameLesson(java.lang.Long, java.lang.String, - * java.lang.Integer) - */ @Override public String renameLesson(Long lessonID, String newName, Integer userID) throws IOException { Lesson lesson = lessonDAO.getLesson(lessonID); @@ -2124,11 +1919,6 @@ return flashMessage.serializeMessage(); } - /** - * (non-javadoc) - * - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#releaseGate(java.lang.Long) - */ @Override public String releaseGate(Long activityID) throws IOException { GateActivity gate = (GateActivity) activityDAO.getActivityByActivityId(activityID); @@ -2147,10 +1937,6 @@ } - /** - * @throws LessonServiceException - * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#performChosenGrouping(GroupingActivity,java.util.List) - */ @Override public void performChosenGrouping(GroupingActivity groupingActivity, List groups) throws LessonServiceException { Grouping grouping = groupingActivity.getCreateGrouping(); @@ -2295,20 +2081,6 @@ // Helper Methods - start lesson // --------------------------------------------------------------------- - /** - * If the activity is not grouped and not in a branch, then it create lams tool session for all the learners in the - * lesson. After the creation of lams tool session, it delegates to the tool instances to create tool's own tool - * session. Can't create it for a grouped activity or an activity in a branch as it may not be applicable to all - * users. - *

    - * - * @param activity - * the tool activity that all tool session reference to. - * @param lesson - * the target lesson that these tool sessions belongs to. - * @throws LamsToolServiceException - * the exception when lams is talking to tool. - */ @Override public void initToolSessionIfSuitable(ToolActivity activity, Lesson lesson) { if (activity.getApplyGrouping().equals(Boolean.FALSE) && (activity.getParentBranch() == null)) { @@ -2377,12 +2149,7 @@ // --------------------------------------------------------------------- // Preview related methods // --------------------------------------------------------------------- - /* - * (non-Javadoc) - * - * @seeorg.lamsfoundation.lams.preview.service.IMonitoringService# - * createPreviewClassForLesson(long, long) - */ + @Override public Lesson createPreviewClassForLesson(int userID, long lessonID) throws UserAccessDeniedException { @@ -2403,6 +2170,8 @@ } /** + * {@inheritDoc}

    + * * Delete a preview lesson and all its contents. Warning: can only delete preview lessons. Can't guarentee data * integrity if it is done to any other type of lesson. See removeLesson() for hiding lessons from a teacher's view * without removing them from the database. TODO remove the related tool data. @@ -2444,12 +2213,6 @@ } } - /* - * (non-Javadoc) - * - * @seeorg.lamsfoundation.lams.preview.service.IMonitoringService# - * deleteAllOldPreviewLessons(int) - */ @Override public int deleteAllOldPreviewLessons() { @@ -2490,22 +2253,9 @@ } /* Grouping and branching related calls */ - /** - * Get all the active learners in the lesson who are not in a group/branch - * - * If the activity is a grouping activity, then set useCreatingGrouping = true to base the list on the create - * grouping. Otherwise leave it false and it will use the grouping applied to the activity - this is used for - * branching activities. - * - * TODO Optimise the database query. Do a single query rather then large collection access - * - * @param activityID - * @param lessonID - * @param useCreateGrouping - * true/false for GroupingActivities, always false for non-GroupingActivities - * @return Sorted set of Users, sorted by surname - */ + @Override + //TODO Optimise the database query. Do a single query rather then large collection access public SortedSet getClassMembersNotGrouped(Long lessonID, Long activityID, boolean useCreateGrouping) { Activity activity = getActivityById(activityID); Grouping grouping = getGroupingForActivity(activity, useCreateGrouping, "getClassMembersNotGrouped"); @@ -2582,21 +2332,6 @@ return grouping; } - /** - * Add a new group to a grouping activity. If name already exists or the name is blank, does not add a new group. If - * the activity is a grouping activity, then set useCreatingGrouping = true to base the list on the create grouping. - * Otherwise leave it false and it will use the grouping applied to the activity - this is used for branching - * activities. - * - * If it is a teacher chosen branching activity and the grouping doesn't exist, it creates one. - * - * @param activityID - * id of the grouping activity - * @param name - * group name - * @throws LessonServiceException - * , MonitoringServiceException - */ @Override public Group addGroup(Long activityID, String name, boolean overrideMaxNumberOfGroups) throws LessonServiceException, MonitoringServiceException { @@ -2632,32 +2367,13 @@ return lessonService.createGroup(grouping, name); } - /** - * Remove a group to from a grouping activity. If the group does not exists then nothing happens. If the group is - * already used (e.g. a tool session exists) then it throws a LessonServiceException. - * - * If the activity is a grouping activity, then set useCreatingGrouping = true to base the list on the create - * grouping. Otherwise leave it false and it will use the grouping applied to the activity - this is used for - * branching activities. - * - * If it is a teacher chosen branching activity and the grouping doesn't exist, it creates one. - * - * @param activityID - * id of the grouping activity - * @param name - * group name - * @throws LessonServiceException - **/ @Override public void removeGroup(Long activityID, Long groupId) throws LessonServiceException { Activity activity = getActivityById(activityID); Grouping grouping = getGroupingForActivity(activity, true, "removeGroup"); lessonService.removeGroup(grouping, groupId); } - /** - * Add learners to a group. Doesn't necessarily check if the user is already in another group. - */ @Override public void addUsersToGroup(Long activityID, Long groupId, String learnerIDs[]) throws LessonServiceException { Activity activity = getActivityById(activityID); @@ -2689,16 +2405,6 @@ return learners; } - /** - * Add learners to a branch. Doesn't necessarily check if the user is already in another branch. Assumes there - * should only be one group for this branch. Use for Teacher Chosen Branching. Don't use for Group Based Branching - * as there could be more than one group for the branch. - * - * @param sequenceActivityID - * Activity id of the sequenceActivity representing this branch - * @param learnerIDs - * the IDS of the learners to be added. - */ @Override public void addUsersToBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException { @@ -2748,11 +2454,6 @@ lessonService.performGrouping(grouping, group.getGroupId(), learners); } - /** - * Remove a user to a group. If the user is not in the group, then nothing is changed. - * - * @throws LessonServiceException - */ @Override public void removeUsersFromGroup(Long activityID, Long groupId, String learnerIDs[]) throws LessonServiceException { Activity activity = getActivityById(activityID); @@ -2761,15 +2462,6 @@ lessonService.removeLearnersFromGroup(grouping, groupId, learners); } - /** - * Remove learners from a branch. Assumes there should only be one group for this branch. Use for Teacher Chosen - * Branching. Don't use for Group Based Branching as there could be more than one group for the branch. - * - * @param sequenceActivityID - * Activity id of the sequenceActivity representing this branch - * @param learnerIDs - * the IDS of the learners to be added. - */ @Override public void removeUsersFromBranch(Long sequenceActivityID, String learnerIDs[]) throws LessonServiceException { @@ -2793,15 +2485,6 @@ } - /** - * Match group(s) to a branch. Doesn't necessarily check if the group is already assigned to another branch. Use for - * Group Based Branching. - * - * @param sequenceActivityID - * Activity id of the sequenceActivity representing this branch - * @param learnerIDs - * the IDS of the learners to be added. - */ @Override public void addGroupToBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException { @@ -2851,15 +2534,6 @@ } - /** - * Remove group / branch mapping. Cannot be done if any users in the group have started the branch. Used for group - * based branching in define later. - * - * @param sequenceActivityID - * Activity id of the sequenceActivity representing this branch - * @param learnerIDs - * the IDS of the learners to be added. - */ @Override public void removeGroupFromBranch(Long sequenceActivityID, String groupIDs[]) throws LessonServiceException { @@ -2911,10 +2585,6 @@ } - /** - * Has anyone started this branch / branching activity ? Irrespective of the groups. Used to determine if a branch - * mapping can be removed. - */ @Override public boolean isActivityAttempted(Activity activity) { Integer numAttempted = lessonService.getCountLearnersHaveAttemptedActivity(activity); @@ -2925,12 +2595,6 @@ return (numAttempted != null) && (numAttempted.intValue() > 0); } - /** - * Get all the groups that exist for the related grouping activity that have not been allocated to a branch. - * - * @param branchingActivityID - * Activity id of the branchingActivity - */ @Override public SortedSet getGroupsNotAssignedToBranch(Long branchingActivityID) throws LessonServiceException { @@ -2957,11 +2621,6 @@ } - /** - * Get the list of users who have attempted an activity. This is based on the progress engine records. This will - * give the users in all tool sessions for an activity (if it is a tool activity) or it will give all the users who - * have attempted an activity that doesn't have any tool sessions, i.e. system activities such as branching. - */ @Override public List getLearnersHaveAttemptedActivity(Activity activity) throws LessonServiceException { return lessonService.getLearnersHaveAttemptedActivity(activity); @@ -2972,9 +2631,6 @@ return learnerService.getProgress(learnerId, lessonId); } - /** - * Set a group's name - */ @Override public void setGroupName(Long groupID, String name) { Group group = groupDAO.getGroupById(groupID); @@ -2987,19 +2643,6 @@ return (Organisation) baseDAO.find(Organisation.class, organisationId); } - /** - * Used in admin to clone lessons using the given lesson Ids (from another group) into the given group. Given staff - * and learner ids should already be members of the group. - * - * @param lessonIds - * @param addAllStaff - * @param addAllLearners - * @param staffIds - * @param learnerIds - * @param group - * @return number of lessons created. - * @throws MonitoringServiceException - */ @Override public int cloneLessons(String[] lessonIds, Boolean addAllStaff, Boolean addAllLearners, String[] staffIds, String[] learnerIds, Organisation group) throws MonitoringServiceException { @@ -3104,4 +2747,15 @@ } return staffUsers; } + + /** + * Write out audit log entry + * + * @param messageKey + * @param args + */ + private void writeAuditLog(String messageKey, Object[] args) { + String message = messageService.getMessage(messageKey, args); + auditService.log(MonitoringConstants.MONITORING_MODULE_NAME, message); + } } \ No newline at end of file Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== diff -u -r2db97244ea386881da21d4e902946d1d5390c76a -rd927914e80c12ea4cf2612788663209520c008c1 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 2db97244ea386881da21d4e902946d1d5390c76a) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision d927914e80c12ea4cf2612788663209520c008c1) @@ -560,8 +560,10 @@ */ public ActionForward forceComplete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + getAuditService(); IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet() .getServletContext()); + // get parameters Long activityId = null; String actId = request.getParameter(AttributeNames.PARAM_ACTIVITY_ID); @@ -586,6 +588,12 @@ LamsDispatchAction.log.debug("Force complete for learner " + learnerId + " lesson " + lessonId + ". " + message); } + + //audit log force completion attempt + String messageKey = (activityId == null) ? "audit.force.complete.end.lesson" : "audit.force.complete"; + Object[] args = new Object[] {learnerId, activityId, lessonId}; + String auditMessage = monitoringService.getMessageService().getMessage(messageKey, args); + auditService.log(MonitoringConstants.MONITORING_MODULE_NAME, auditMessage + " " + message); PrintWriter writer = response.getWriter(); writer.println(message);