Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_admin/src/java/org/lamsfoundation/lams/admin/service/AdminServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java =================================================================== diff -u -rcbe532f585efe39250986f20d58cbef855115cf3 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision cbe532f585efe39250986f20d58cbef855115cf3) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -1298,7 +1298,6 @@ /** * Finds activity position within Learning Design. */ - @SuppressWarnings("unchecked") @Override public ActivityPositionDTO getActivityPosition(Long activityId) { if (activityId == null) { Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/BranchingActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/BranchingActivityController.java (.../BranchingActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/BranchingActivityController.java (.../BranchingActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -46,7 +46,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * Action class to display an OptionsActivity. @@ -64,18 +63,14 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; - + private ActivityMapping activityMapping; + /** * Gets an options activity from the request (attribute) and forwards to the display JSP. */ @RequestMapping("/performBranching") public String performBranching(@ModelAttribute BranchingForm branchingForm, HttpServletRequest request, HttpServletResponse response) { - - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); - LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); Integer learnerId = LearningWebUtil.getUserId(); @@ -85,7 +80,7 @@ if (activity == null) { learnerProgress = learnerService.joinLesson(learnerId, learnerProgress.getLesson().getLessonId()); - forward = actionMappings.getActivityForward(activity, learnerProgress, true); + forward = activityMapping.getActivityForward(activity, learnerProgress, true); } else if (!(activity instanceof BranchingActivity)) { log.error("activity not BranchingActivity " + activity.getActivityId()); @@ -111,11 +106,11 @@ forward = "branching/preview"; List activityURLs = new ArrayList<>(); - Iterator i = branchingActivity.getActivities().iterator(); + Iterator i = branchingActivity.getActivities().iterator(); int completedCount = 0; while (i.hasNext()) { - Activity nextBranch = (Activity) i.next(); - ActivityURL activityURL = LearningWebUtil.getActivityURL(actionMappings, learnerProgress, + Activity nextBranch = i.next(); + ActivityURL activityURL = LearningWebUtil.getActivityURL(activityMapping, learnerProgress, nextBranch, (branch != null) && branch.equals(nextBranch), false); if (activityURL.isComplete()) { completedCount++; @@ -149,7 +144,7 @@ // Set the branch as the current part of the sequence and display it learnerProgress = learnerService.chooseActivity(learnerId, learnerProgress.getLesson().getLessonId(), branch, true); - forward = actionMappings.getActivityForward(branch, learnerProgress, true); + forward = activityMapping.getActivityForward(branch, learnerProgress, true); } } @@ -162,18 +157,14 @@ @RequestMapping("/forceBranching") public String forceBranching(@ModelAttribute BranchingForm branchingForm, HttpServletRequest request) { - - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); - LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); Integer learnerId = LearningWebUtil.getUserId(); String forward = null; if (activity == null) { learnerProgress = learnerService.joinLesson(learnerId, learnerProgress.getLesson().getLessonId()); - forward = actionMappings.getActivityForward(activity, learnerProgress, true); + forward = activityMapping.getActivityForward(activity, learnerProgress, true); } else if (!(activity instanceof BranchingActivity)) { log.error("activity not BranchingActivity " + activity.getActivityId()); @@ -201,7 +192,7 @@ // Set the branch as the current part of the sequence and display it learnerProgress = learnerService.chooseActivity(learnerId, learnerProgress.getLesson().getLessonId(), branch, true); - forward = actionMappings.getActivityForward(branch, learnerProgress, true); + forward = activityMapping.getActivityForward(branch, learnerProgress, true); } return forward; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/ChooseActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/ChooseActivityController.java (.../ChooseActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/ChooseActivityController.java (.../ChooseActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -26,7 +26,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; import org.lamsfoundation.lams.learning.service.ILearnerFullService; import org.lamsfoundation.lams.learning.web.form.ActivityForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; @@ -38,21 +37,18 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * @author daveg */ @Controller public class ChooseActivityController { - private static Logger log = Logger.getLogger(ChooseActivityController.class); - protected static String className = "ChooseActivity"; @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; /** * Gets an activity from the request (attribute) and forwards onto the required jsp (SingleActivity or @@ -61,9 +57,6 @@ @RequestMapping("/ChooseActivity") public String execute(@ModelAttribute("activityForm") ActivityForm activityForm, HttpServletRequest request, HttpServletResponse response) { - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); - // Get learner and lesson details. Integer learnerId = LearningWebUtil.getUserId(); LearnerProgress progress = LearningWebUtil.getLearnerProgress(request, learnerService); @@ -78,7 +71,7 @@ progress = learnerService.joinLesson(learnerId, lesson.getLessonId()); } - String forward = actionMappings.getActivityForward(activity, progress, true); + String forward = activityMapping.getActivityForward(activity, progress, true); return forward; } } \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java (.../CompleteActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java (.../CompleteActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -44,7 +44,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * @author daveg @@ -59,9 +58,8 @@ private IIntegrationService integrationService; @Autowired private ILearnerFullService learnerService; - @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; /** * Sets the current activity as complete and uses the progress engine to find the next activity (may be null). @@ -75,9 +73,6 @@ @RequestMapping("/CompleteActivity") public String execute(@ModelAttribute("messageForm") ActivityForm messageForm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); - Integer learnerId = LearningWebUtil.getUserId(); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); @@ -109,7 +104,7 @@ String forward = null; // Set activity as complete try { - forward = LearningWebUtil.completeActivity(request, response, actionMappings, progress, activity, learnerId, + forward = LearningWebUtil.completeActivity(request, response, activityMapping, progress, activity, learnerId, learnerService, false); } catch (LearnerServiceException e) { return "error"; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayActivityController.java (.../DisplayActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayActivityController.java (.../DisplayActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -29,7 +29,6 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.learning.service.ILearnerFullService; -import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.lesson.LearnerProgress; @@ -38,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * Action class to display an activity. This is used when UI calls starts of the learning process. It is needed to put @@ -47,7 +45,6 @@ * * Request values: lessonID (mandatory), InitialDisplay (optional - Set to "true" for normal display, set to "false" * when you want it to assume it is inside parallel frameset. Defaults to true). - * */ @Controller public class DisplayActivityController { @@ -58,7 +55,7 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; /** * Gets an activity from the request (attribute) and forwards onto a display action using the ActionMappings class. @@ -83,12 +80,10 @@ boolean displayParallelFrames = WebUtil.readBooleanParam(request, DisplayActivityController.PARAM_INITIAL_DISPLAY, true); - ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(applicationContext.getServletContext()); - String forward = actionMappings.getProgressForward(learnerProgress, false, displayParallelFrames, request, + String forward = activityMapping.getProgressForward(learnerProgress, false, displayParallelFrames, request, learnerService); - - if (DisplayActivityController.log.isDebugEnabled()) { - DisplayActivityController.log.debug(forward); + if (log.isDebugEnabled()) { + log.debug(forward); } return forward; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayOptionsActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayOptionsActivityController.java (.../DisplayOptionsActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayOptionsActivityController.java (.../DisplayOptionsActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -38,14 +38,14 @@ import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.OptionsActivity; +import org.lamsfoundation.lams.learningdesign.dto.ActivityPositionDTO; import org.lamsfoundation.lams.learningdesign.dto.ActivityURL; import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * Action class to display an OptionsActivity. @@ -61,19 +61,15 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; /** * Gets an options activity from the request (attribute) and forwards to the display JSP. */ - @SuppressWarnings("unchecked") @RequestMapping("/DisplayOptionsActivity") public String execute(@ModelAttribute OptionsActivityForm form, HttpServletRequest request, HttpServletResponse response) { - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); - LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); if (!(activity instanceof OptionsActivity)) { @@ -90,7 +86,7 @@ Iterator i = subActivities.iterator(); int completedCount = 0; while (i.hasNext()) { - ActivityURL activityURL = LearningWebUtil.getActivityURL(actionMappings, learnerProgress, i.next(), false, + ActivityURL activityURL = LearningWebUtil.getActivityURL(activityMapping, learnerProgress, i.next(), false, false); if (activityURL.isComplete()) { completedCount++; @@ -114,8 +110,11 @@ form.setLessonID(learnerProgress.getLesson().getLessonId()); form.setProgressID(learnerProgress.getLearnerProgressId()); - LearningWebUtil.putActivityPositionInRequest(form.getActivityID(), request, - applicationContext.getServletContext()); + //find activity position within Learning Design and stores it as request attribute. + ActivityPositionDTO positionDTO = learnerService.getActivityPosition(form.getActivityID()); + if (positionDTO != null) { + request.setAttribute(AttributeNames.ATTR_ACTIVITY_POSITION, positionDTO); + } // lessonId needed for the progress bar request.setAttribute(AttributeNames.PARAM_LESSON_ID, learnerProgress.getLesson().getLessonId()); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayParallelActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayParallelActivityController.java (.../DisplayParallelActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayParallelActivityController.java (.../DisplayParallelActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -32,7 +32,6 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.learning.service.ILearnerFullService; -import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.form.ActivityForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; @@ -44,7 +43,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * Action class to display a ParallelActivity. @@ -58,19 +56,15 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; /** * Gets a parallel activity from the request (attribute) and forwards to the display JSP. */ @RequestMapping("/DisplayParallelActivity") public String execute(@ModelAttribute ActivityForm form, HttpServletRequest request, HttpServletResponse response) { + activityMapping.setActivityMappingStrategy(new ParallelActivityMappingStrategy()); - ActivityMapping actionMappings = LearnerServiceProxy - .getActivityMapping(this.applicationContext.getServletContext()); - - actionMappings.setActivityMappingStrategy(new ParallelActivityMappingStrategy()); - Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); if (!(activity instanceof ParallelActivity)) { log.error("activity not ParallelActivity " + activity.getActivityId()); @@ -81,12 +75,11 @@ form.setActivityID(activity.getActivityId()); - List activityURLs = new ArrayList(); - - for (Iterator i = parallelActivity.getActivities().iterator(); i.hasNext();) { - Activity subActivity = (Activity) i.next(); + List activityURLs = new ArrayList<>(); + for (Iterator i = parallelActivity.getActivities().iterator(); i.hasNext();) { + Activity subActivity = i.next(); ActivityURL activityURL = new ActivityURL(); - String url = actionMappings.getActivityURL(subActivity); + String url = activityMapping.getActivityURL(subActivity); activityURL.setUrl(url); activityURLs.add(activityURL); } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayToolActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayToolActivityController.java (.../DisplayToolActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayToolActivityController.java (.../DisplayToolActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -36,7 +36,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * Action class to forward the user to a Tool. @@ -50,17 +49,13 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; /** * Gets a tool activity from the request (attribute) and uses a redirect to forward the user to the tool. */ @RequestMapping("/DisplayToolActivity") public String execute(HttpServletRequest request, HttpServletResponse response) { - //ActivityForm form = (ActivityForm)actionForm; - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); - LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); @@ -71,7 +66,7 @@ ToolActivity toolActivity = (ToolActivity) activity; - String url = actionMappings.getLearnerToolURL(learnerProgress.getLesson(), toolActivity, + String url = activityMapping.getLearnerToolURL(learnerProgress.getLesson(), toolActivity, learnerProgress.getUser()); try { response.sendRedirect(url); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java (.../GateController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java (.../GateController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -52,7 +52,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** *

@@ -80,7 +79,8 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; + // --------------------------------------------------------------------- // Instance variables // --------------------------------------------------------------------- @@ -119,9 +119,6 @@ // initialize service object Activity activity = learnerService.getActivity(activityId); - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); - User learner = LearningWebUtil.getUser(learnerService); Lesson lesson = learnerService.getLesson(lessonId); @@ -143,7 +140,7 @@ } // gate is open, so let the learner go to the next activity ( updating the cached learner progress on the way ) - return LearningWebUtil.completeActivity(request, response, actionMappings, learnerProgress, activity, + return LearningWebUtil.completeActivity(request, response, activityMapping, learnerProgress, activity, learner.getUserId(), learnerService, true); } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -34,12 +34,14 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.learning.service.ILearnerFullService; import org.lamsfoundation.lams.learning.web.form.GroupingForm; +import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.Group; import org.lamsfoundation.lams.learningdesign.Grouping; import org.lamsfoundation.lams.learningdesign.GroupingActivity; import org.lamsfoundation.lams.learningdesign.LearnerChoiceGrouping; +import org.lamsfoundation.lams.learningdesign.dto.ActivityPositionDTO; import org.lamsfoundation.lams.learningdesign.dto.GroupDTO; import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.tool.ToolAccessMode; @@ -51,7 +53,6 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.context.WebApplicationContext; /** * @@ -76,7 +77,7 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; // --------------------------------------------------------------------- // Class level constants - Session Attributes @@ -170,7 +171,11 @@ request.setAttribute(GroupingController.FINISHED_BUTTON, new Boolean((mode == null) || !mode.isTeacher())); long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); - LearningWebUtil.putActivityPositionInRequest(activityId, request, applicationContext.getServletContext()); + //find activity position within Learning Design and store it as request attribute + ActivityPositionDTO positionDTO = learnerService.getActivityPosition(activityId); + if (positionDTO != null) { + request.setAttribute(AttributeNames.ATTR_ACTIVITY_POSITION, positionDTO); + } // make sure the lesson id is always in the request for the progress bar. if (request.getAttribute(AttributeNames.PARAM_LESSON_ID) == null) { @@ -202,9 +207,8 @@ Integer learnerId = LearningWebUtil.getUserId(); // so manually resume the progress. The completeActivity code can cope with a missing activity. - return LearningWebUtil.completeActivity(request, response, - LearningWebUtil.getActivityMapping(this.applicationContext.getServletContext()), progress, - groupingActivity, learnerId, learnerService, true); + return LearningWebUtil.completeActivity(request, response, activityMapping, progress, groupingActivity, + learnerId, learnerService, true); } /** Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LearnerController.java =================================================================== diff -u -rcbe532f585efe39250986f20d58cbef855115cf3 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LearnerController.java (.../LearnerController.java) (revision cbe532f585efe39250986f20d58cbef855115cf3) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LearnerController.java (.../LearnerController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -39,7 +39,6 @@ import org.lamsfoundation.lams.gradebook.service.IGradebookService; import org.lamsfoundation.lams.learning.presence.PresenceWebsocketServer; import org.lamsfoundation.lams.learning.service.ILearnerFullService; -import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; @@ -67,7 +66,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.context.WebApplicationContext; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -109,7 +107,7 @@ @Qualifier("learningMessageService") private MessageService messageService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; private static final String[] MONITOR_MESSAGE_KEYS = new String[] { "label.learner.progress.activity.current.tooltip", "label.learner.progress.activity.completed.tooltip", @@ -179,26 +177,23 @@ return "msgContent"; } - if (LearnerController.log.isDebugEnabled()) { - LearnerController.log.debug("The learner [" + learner + "] is joining the lesson [" + lessonID + "]"); + if (log.isDebugEnabled()) { + log.debug("The learner [" + learner + "] is joining the lesson [" + lessonID + "]"); } // join user to the lesson on the server LearnerProgress learnerProgress = learnerService.joinLesson(learner, lessonID); - if (LearnerController.log.isDebugEnabled()) { - LearnerController.log.debug("The learner [" + learner + "] joined lesson. The" + "progress data is:" + if (log.isDebugEnabled()) { + log.debug("The learner [" + learner + "] joined lesson. The" + "progress data is:" + learnerProgress.toString()); } - ActivityMapping activityMapping = LearnerServiceProxy - .getActivityMapping(this.applicationContext.getServletContext()); String url = "learning/" + activityMapping.getDisplayActivityAction(lessonID); - redirectToURL(response, url); } catch (Exception e) { - LearnerController.log + log .error("An error occurred while learner " + learner + " attempting to join the lesson.", e); return "error"; } @@ -344,13 +339,11 @@ Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); learnerService.moveToActivity(learnerId, lessonId, fromActivity, toActivity); - if (LearnerController.log.isDebugEnabled()) { - LearnerController.log.debug("Force move for learner " + learnerId + " lesson " + lessonId + ". "); + if (log.isDebugEnabled()) { + log.debug("Force move for learner " + learnerId + " lesson " + lessonId + ". "); } String url = null; - ActivityMapping activityMapping = LearnerServiceProxy - .getActivityMapping(this.applicationContext.getServletContext()); if (!toActivity.isFloating()) { url = "/learning" + activityMapping.getDisplayActivityAction(lessonId); } else { Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LoadToolActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LoadToolActivityController.java (.../LoadToolActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LoadToolActivityController.java (.../LoadToolActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -31,7 +31,6 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.learning.service.ILearnerFullService; -import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.form.ActivityForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; @@ -43,7 +42,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * Action class to forward the user to a Tool using an intermediate loading page. Can handle regular tools + grouping @@ -54,9 +52,9 @@ public class LoadToolActivityController { private static Logger log = Logger.getLogger(LoadToolActivityController.class); @Autowired - private ILearnerFullService learnerService; + private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; public static final String PARAM_ACTIVITY_URL = "activityURL"; public static final String PARAM_IS_BRANCHING = "isBranching"; @@ -69,9 +67,6 @@ @RequestMapping("/LoadToolActivity") public String execute(@ModelAttribute ActivityForm form, HttpServletRequest request, HttpServletResponse response) { - ActivityMapping actionMappings = LearnerServiceProxy - .getActivityMapping(this.applicationContext.getServletContext()); - LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); @@ -106,7 +101,6 @@ * LamsAction.log.warn("Got exception while trying to create a tool session, but carrying on.", e); */ } catch (RequiredGroupMissingException e) { - //got here when activity requires existing grouping but no group for user exists yet log.warn(e.getMessage()); request.setAttribute("messageKey", e.getMessage()); @@ -116,8 +110,7 @@ form.setActivityID(activity.getActivityId()); if (activity.isToolActivity() || activity.isSystemToolActivity()) { - - String url = actionMappings.getLearnerToolURL(learnerProgress.getLesson(), activity, + String url = activityMapping.getLearnerToolURL(learnerProgress.getLesson(), activity, learnerProgress.getUser()); form.addActivityURL(new ActivityURL(activity.getActivityId(), url)); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java (.../SequenceActivityController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java (.../SequenceActivityController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -40,7 +40,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.WebApplicationContext; /** * Action class to display a sequence activity. @@ -54,7 +53,7 @@ @Autowired private ILearnerFullService learnerService; @Autowired - private WebApplicationContext applicationContext; + private ActivityMapping activityMapping; /** * Gets an sequence activity from the request (attribute) and forwards to either the first activity in the sequence @@ -66,9 +65,6 @@ @RequestMapping("/SequenceActivity") public String execute(HttpServletRequest request, HttpServletResponse response) throws LearnerServiceException, UnsupportedEncodingException { - - ActivityMapping actionMappings = LearningWebUtil - .getActivityMapping(this.applicationContext.getServletContext()); Integer learnerId = LearningWebUtil.getUserId(); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); @@ -86,11 +82,11 @@ // Set the first activity as the current activity and display it learnerProgress = learnerService.chooseActivity(learnerId, learnerProgress.getLesson().getLessonId(), firstActivityInSequence, true); - forward = actionMappings.getActivityForward(firstActivityInSequence, learnerProgress, true); + forward = activityMapping.getActivityForward(firstActivityInSequence, learnerProgress, true); return forward; } else { // No activities exist in the sequence, so go to the next activity. - return LearningWebUtil.completeActivity(request, response, actionMappings, learnerProgress, activity, + return LearningWebUtil.completeActivity(request, response, activityMapping, learnerProgress, activity, learnerId, learnerService, true); } } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java =================================================================== diff -u -r07608a1a9f29a1542901ef84341f9ad9305d9ae9 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java (.../ActivityMapping.java) (revision 07608a1a9f29a1542901ef84341f9ad9305d9ae9) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java (.../ActivityMapping.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -50,10 +50,8 @@ * In order to return a URL this class needs to know the baseURL. This can be set using in the application context. * * @author daveg - * */ public class ActivityMapping implements Serializable { - private static final long serialVersionUID = 5887602834473598770L; /* These are global struts forwards. */ @@ -76,8 +74,6 @@ * the LearnerProgress associated with the Activity and learner */ public String getActivityForward(Activity activity, LearnerProgress progress, boolean redirect) { - String forward = null; - String action = this.activityMappingStrategy.getActivityAction(activity); action = WebUtil.appendParameterToURL(action, AttributeNames.PARAM_LEARNER_PROGRESS_ID, progress.getLearnerProgressId().toString()); @@ -86,8 +82,7 @@ activity.getActivityId().toString()); } - forward = actionToForward(action, activity, redirect); - return forward; + return ActivityMapping.actionToForward(action, activity, redirect); } /** @@ -118,20 +113,21 @@ action = WebUtil.appendParameterToURL(action, AttributeNames.PARAM_LEARNER_PROGRESS_ID, progress.getLearnerProgressId().toString()); action = ActivityMapping.actionToURL(action, null, true); - forward = this.getClearFramesForward(action, progress.getLearnerProgressId().toString()); + forward = ActivityMapping.getClearFramesForward(action, progress.getLearnerProgressId().toString()); } else { if (!displayParallelFrames && (progress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING)) { // processing the screen WITHIN parallel activity frames. // progress is waiting, goto waiting page String action = this.getActivityMappingStrategy().getWaitingAction(); - forward = this.actionToForward(action, null, redirect); + forward = ActivityMapping.actionToForward(action, null, redirect); } else { // display next activity if (progress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING_COMPLETE) { // if previous activity was a parallel activity then we need to // clear frames. String activityURL = this.getActivityURL(progress.getNextActivity()); - forward = this.getClearFramesForward(activityURL, progress.getLearnerProgressId().toString()); + forward = ActivityMapping.getClearFramesForward(activityURL, + progress.getLearnerProgressId().toString()); } else { forward = getActivityForward(progress.getNextActivity(), progress, redirect); } @@ -150,18 +146,14 @@ * @return actionForward to which to forward * @throws UnsupportedEncodingException */ - private String getClearFramesForward(String activityURL, String progressId) throws UnsupportedEncodingException { - + private static String getClearFramesForward(String activityURL, String progressId) + throws UnsupportedEncodingException { String encodedURL = URLEncoder.encode(activityURL, "UTF-8"); - - String forward = null; - String action = "/requestURL.jsp?url=" + encodedURL; action = WebUtil.appendParameterToURL(action, AttributeNames.PARAM_LEARNER_PROGRESS_ID, progressId); - forward = actionToForward(action, null, false); + String forward = ActivityMapping.actionToForward(action, null, false); return forward; - } /** @@ -239,7 +231,7 @@ // return redirect ? "redirect:" + ActivityMapping.actionToURL(action, activity, false) : "forward:" + action; // } - protected String actionToForward(String action, Activity activity, boolean addParams) { + protected static String actionToForward(String action, Activity activity, boolean addParams) { return "redirect:" + (addParams ? ActivityMapping.actionToURL(action, activity, false) : action); } @@ -315,7 +307,7 @@ closeWindowURLAction = WebUtil.appendParameterToURL(closeWindowURLAction, "waitURL", action); } - return actionToForward(closeWindowURLAction, null, false); + return ActivityMapping.actionToForward(closeWindowURLAction, null, false); } public String getProgressBrokenURL() { Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java =================================================================== diff -u -ra8a83ef915717f418399b46f4c1df68be0ba8d18 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java (.../ActivityMappingStrategy.java) (revision a8a83ef915717f418399b46f4c1df68be0ba8d18) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java (.../ActivityMappingStrategy.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -30,10 +30,9 @@ /** * @author daveg - * */ public class ActivityMappingStrategy implements Serializable { - + private static final long serialVersionUID = -6418428916496098347L; private static Logger log = Logger.getLogger(ActivityMappingStrategy.class); private static final String PROGRESS_BROKEN_ACTION = "/progressBroken.jsp"; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -25,16 +25,13 @@ import java.io.UnsupportedEncodingException; -import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.log4j.Logger; import org.lamsfoundation.lams.learning.service.ILearnerFullService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; import org.lamsfoundation.lams.learningdesign.Activity; -import org.lamsfoundation.lams.learningdesign.dto.ActivityPositionDTO; import org.lamsfoundation.lams.learningdesign.dto.ActivityURL; import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.lesson.Lesson; @@ -43,17 +40,11 @@ import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; /** - * * @author Jacky Fang - * @since 2005-3-10 */ public class LearningWebUtil { - - private static Logger log = Logger.getLogger(LearningWebUtil.class); // --------------------------------------------------------------------- // Class level constants - session attributes // --------------------------------------------------------------------- @@ -100,7 +91,7 @@ } if (learnerProgressId != null) { - learnerProgress = learnerService.getProgressById(new Long(learnerProgressId)); + learnerProgress = learnerService.getProgressById(learnerProgressId); } if (learnerProgress == null) { @@ -122,7 +113,7 @@ */ public static Activity getActivityFromRequest(HttpServletRequest request, ILearnerFullService learnerService) { long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); - Activity activity = learnerService.getActivity(new Long(activityId)); + Activity activity = learnerService.getActivity(activityId); return activity; } @@ -166,14 +157,6 @@ return actionMappings.getProgressForward(progress, redirect, false, request, learnerService); } - /** - * Get the ActionMappings. - */ - public static ActivityMapping getActivityMapping(ServletContext context) { - WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(context); - return (ActivityMapping) wac.getBean("activityMapping"); - } - public static ActivityURL getActivityURL(ActivityMapping activityMapping, LearnerProgress learnerProgress, Activity activity, boolean defaultURL, boolean isFloating) { ActivityURL activityURL = new ActivityURL(); @@ -199,22 +182,4 @@ activityURL.setDefaultURL(defaultURL); return activityURL; } - - /** - * Finds activity position within Learning Design and stores it as request attribute. - */ - public static ActivityPositionDTO putActivityPositionInRequest(Long activityId, HttpServletRequest request, - ServletContext context) { - WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(context); - ILearnerFullService learnerService = (ILearnerFullService) wac.getBean("learnerService"); - if (learnerService == null) { - LearningWebUtil.log.warn("Can not set activity position, no Learner service in servlet context."); - return null; - } - ActivityPositionDTO positionDTO = learnerService.getActivityPosition(activityId); - if (positionDTO != null) { - request.setAttribute(AttributeNames.ATTR_ACTIVITY_POSITION, positionDTO); - } - return positionDTO; - } } \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ParallelActivityMappingStrategy.java =================================================================== diff -u -r6660bc5678e365bb5a25988c18c491c850550edb -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ParallelActivityMappingStrategy.java (.../ParallelActivityMappingStrategy.java) (revision 6660bc5678e365bb5a25988c18c491c850550edb) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ParallelActivityMappingStrategy.java (.../ParallelActivityMappingStrategy.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -28,9 +28,9 @@ /** * @author daveg - * */ public class ParallelActivityMappingStrategy extends ActivityMappingStrategy { + private static final long serialVersionUID = 2433891791486019818L; /** * Returns the struts action used to display the specified activity. Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml (.../chatApplicationContext.xml) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml (.../chatApplicationContext.xml) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -53,6 +53,7 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED + PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java (.../ChatService.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatService.java (.../ChatService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -162,7 +162,20 @@ // } return toolService.completeToolSession(toolSessionId, learnerId); } + + @Override + public String finishToolSession(Long userUid) { + // set the finished flag + ChatUser chatUser = getUserByUID(userUid); + if (chatUser != null) { + chatUser.setFinishedActivity(true); + saveOrUpdateChatUser(chatUser); + } + + return leaveToolSession(chatUser.getChatSession().getSessionId(), chatUser.getUserId()); + } + @Override public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException { Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/ChatServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java (.../IChatService.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/service/IChatService.java (.../IChatService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -4,7 +4,7 @@ * License Information: http://lamsfoundation.org/licensing/lams/2.0/ * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU General License as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, @@ -47,75 +47,77 @@ * @params newContentID * @return */ - public Chat copyDefaultContent(Long newContentID); + Chat copyDefaultContent(Long newContentID); /** * Returns an instance of the Chat tools default content. * * @return */ - public Chat getDefaultContent(); + Chat getDefaultContent(); /** * @param toolSignature * @return */ - public Long getDefaultContentIdBySignature(String toolSignature); + Long getDefaultContentIdBySignature(String toolSignature); /** * @param toolContentID * @return */ - public Chat getChatByContentId(Long toolContentID); + Chat getChatByContentId(Long toolContentID); /** * @param chat */ - public void saveOrUpdateChat(Chat chat); + void saveOrUpdateChat(Chat chat); + + String finishToolSession(Long userUid); /** * @param toolSessionId * @return */ - public ChatSession getSessionBySessionId(Long toolSessionId); + ChatSession getSessionBySessionId(Long toolSessionId); /** * @param chatSession */ - public void saveOrUpdateChatSession(ChatSession chatSession); + void saveOrUpdateChatSession(ChatSession chatSession); - public List getUsersActiveBySessionId(Long toolSessionId); + List getUsersActiveBySessionId(Long toolSessionId); /** * * @param userId * @param toolSessionId * @return */ - public ChatUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId); + ChatUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId); /** * * @param loginName * @param sessionID * @return */ - public ChatUser getUserByLoginNameAndSessionId(String loginName, Long sessionId); + ChatUser getUserByLoginNameAndSessionId(String loginName, Long sessionId); /** * * @param uid * @return */ - public ChatUser getUserByUID(Long uid); + ChatUser getUserByUID(Long uid); /** * * @param nickname * @param sessionID * @return */ - public ChatUser getUserByNicknameAndSessionID(String nickname, Long sessionID); + ChatUser getUserByNicknameAndSessionID(String nickname, Long sessionID); /** * Get how many post of this user post in a special session. DOES NOT include posts from author. @@ -126,70 +128,70 @@ */ int getTopicsNum(Long userID, Long sessionId); - public void updateUserPresence(Long toolSessionId, Set activeUsers); + void updateUserPresence(Long toolSessionId, Set activeUsers); /** * * @param chatUser */ - public void saveOrUpdateChatUser(ChatUser chatUser); + void saveOrUpdateChatUser(ChatUser chatUser); /** * * @param chatUser * @return */ - public List getMessagesForUser(ChatUser chatUser); + List getMessagesForUser(ChatUser chatUser); /** * * @param chatMessage */ - public void saveOrUpdateChatMessage(ChatMessage chatMessage); + void saveOrUpdateChatMessage(ChatMessage chatMessage); /** * * @param user * @param chatSession * @return */ - public ChatUser createChatUser(UserDTO user, ChatSession chatSession); + ChatUser createChatUser(UserDTO user, ChatSession chatSession); /** * * @param toolContentID * @param pattern */ - public ChatMessageFilter updateMessageFilters(Chat chat); + ChatMessageFilter updateMessageFilters(Chat chat); - public String filterMessage(String message, Chat chat); + String filterMessage(String message, Chat chat); /** * * @param messageUID * @return */ - public ChatMessage getMessageByUID(Long messageUID); + ChatMessage getMessageByUID(Long messageUID); - public List getLastestMessages(ChatSession chatSession, Integer max, boolean orderAsc); + List getLastestMessages(ChatSession chatSession, Integer max, boolean orderAsc); - public void auditEditMessage(ChatMessage chatMessage, String messageBody); + void auditEditMessage(ChatMessage chatMessage, String messageBody); - public void auditHideShowMessage(ChatMessage chatMessage, boolean messageHidden); + void auditHideShowMessage(ChatMessage chatMessage, boolean messageHidden); - public Map getMessageCountBySession(Long chatUID); + Map getMessageCountBySession(Long chatUID); - public Map getMessageCountByFromUser(Long sessionUID); + Map getMessageCountByFromUser(Long sessionUID); - public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); + Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); - public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); + NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); - public void updateEntry(NotebookEntry notebookEntry); + void updateEntry(NotebookEntry notebookEntry); - public String createConditionName(Collection existingConditions); + String createConditionName(Collection existingConditions); - public void deleteCondition(ChatCondition condition); + void deleteCondition(ChatCondition condition); /** * Gets all messages sent by the given user. @@ -198,7 +200,7 @@ * UID of the user * @return list of his/hers messages */ - public List getMessagesSentByUser(Long userUid); + List getMessagesSentByUser(Long userUid); void releaseConditionsFromCache(Chat chat); Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/controller/LearningController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/controller/LearningController.java (.../LearningController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/controller/LearningController.java (.../LearningController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -35,13 +35,11 @@ import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.ToolAccessMode; -import org.lamsfoundation.lams.tool.ToolSessionManager; import org.lamsfoundation.lams.tool.chat.dto.ChatDTO; import org.lamsfoundation.lams.tool.chat.dto.ChatUserDTO; import org.lamsfoundation.lams.tool.chat.model.Chat; import org.lamsfoundation.lams.tool.chat.model.ChatSession; import org.lamsfoundation.lams.tool.chat.model.ChatUser; -import org.lamsfoundation.lams.tool.chat.service.ChatServiceProxy; import org.lamsfoundation.lams.tool.chat.service.IChatService; import org.lamsfoundation.lams.tool.chat.util.ChatConstants; import org.lamsfoundation.lams.tool.chat.util.ChatException; @@ -64,7 +62,6 @@ @Controller @RequestMapping("/learning") public class LearningController { - private static Logger log = Logger.getLogger(LearningController.class); @Autowired @@ -119,7 +116,7 @@ // Ensure that the content is use flag is set. if (!chat.isContentInUse()) { - chat.setContentInUse(new Boolean(true)); + chat.setContentInUse(true); chatService.saveOrUpdateChat(chat); } @@ -153,28 +150,11 @@ @RequestMapping("/finishActivity") public String finishActivity(@ModelAttribute LearningForm learningForm, HttpServletRequest request, HttpServletResponse response) { + Long userUid = learningForm.getChatUserUID(); - // set the finished flag - ChatUser chatUser = chatService.getUserByUID(learningForm.getChatUserUID()); - if (chatUser != null) { - chatUser.setFinishedActivity(true); - chatService.saveOrUpdateChatUser(chatUser); - } else { - LearningController.log - .error("finishActivity(): couldn't find ChatUser with uid: " + learningForm.getChatUserUID()); - } - - ToolSessionManager sessionMgrService = ChatServiceProxy - .getChatSessionManager(applicationContext.getServletContext()); - - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - Long userID = new Long(user.getUserID().longValue()); - Long toolSessionID = chatUser.getChatSession().getSessionId(); - String nextActivityUrl; try { - nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, userID); + nextActivityUrl = chatService.finishToolSession(userUid); response.sendRedirect(nextActivityUrl); } catch (DataMissingException e) { throw new ChatException(e); Index: lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/service/DokumaranService.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/service/DokumaranService.java (.../DokumaranService.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/service/DokumaranService.java (.../DokumaranService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -528,8 +528,7 @@ } private Long getToolDefaultContentIdBySignature(String toolSignature) throws DokumaranApplicationException { - Long contentId = null; - contentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature)); + Long contentId = toolService.getToolDefaultContentIdBySignature(toolSignature); if (contentId == null) { String error = messageService.getMessage("error.msg.default.content.not.find"); DokumaranService.log.error(error); Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_doku/src/java/org/lamsfoundation/lams/tool/dokumaran/service/DokumaranServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_imscc/src/java/org/lamsfoundation/lams/tool/commonCartridge/service/CommonCartridgeServiceImpl.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_imscc/src/java/org/lamsfoundation/lams/tool/commonCartridge/service/CommonCartridgeServiceImpl.java (.../CommonCartridgeServiceImpl.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_tool_imscc/src/java/org/lamsfoundation/lams/tool/commonCartridge/service/CommonCartridgeServiceImpl.java (.../CommonCartridgeServiceImpl.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -142,7 +142,7 @@ public CommonCartridge getDefaultContent(Long contentId) throws CommonCartridgeApplicationException { if (contentId == null) { String error = messageService.getMessage("error.msg.default.content.not.find"); - CommonCartridgeServiceImpl.log.error(error); + log.error(error); throw new CommonCartridgeApplicationException(error); } @@ -292,7 +292,7 @@ int miniView = commonCartridgeItemVisitDao.getUserViewLogCount(toolSessionId, userUid); CommonCartridgeSession session = commonCartridgeSessionDao.getSessionBySessionId(toolSessionId); if (session == null) { - CommonCartridgeServiceImpl.log.error("Failed get session by ID [" + toolSessionId + "]"); + log.error("Failed get session by ID [" + toolSessionId + "]"); return 0; } int reqView = session.getCommonCartridge().getMiniViewCommonCartridgeNumber(); @@ -443,7 +443,7 @@ CommonCartridge defaultCommonCartridge = getCommonCartridgeByContentId(defaultCommonCartridgeId); if (defaultCommonCartridge == null) { String error = messageService.getMessage("error.msg.default.content.not.find"); - CommonCartridgeServiceImpl.log.error(error); + log.error(error); throw new CommonCartridgeApplicationException(error); } @@ -455,7 +455,7 @@ contentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature)); if (contentId == null) { String error = messageService.getMessage("error.msg.default.content.not.find"); - CommonCartridgeServiceImpl.log.error(error); + log.error(error); throw new CommonCartridgeApplicationException(error); } return contentId; @@ -486,16 +486,13 @@ return items; } catch (ZipFileUtilException e) { - CommonCartridgeServiceImpl.log - .error(messageService.getMessage("error.msg.zip.file.exception") + " : " + e.toString()); + log.error(messageService.getMessage("error.msg.zip.file.exception") + " : " + e.toString()); throw new UploadCommonCartridgeFileException(messageService.getMessage("error.msg.zip.file.exception")); } catch (FileNotFoundException e) { - CommonCartridgeServiceImpl.log - .error(messageService.getMessage("error.msg.file.not.found") + ":" + e.toString()); + log.error(messageService.getMessage("error.msg.file.not.found") + ":" + e.toString()); throw new UploadCommonCartridgeFileException(messageService.getMessage("error.msg.file.not.found")); } catch (IOException e) { - CommonCartridgeServiceImpl.log - .error(messageService.getMessage("error.msg.io.exception") + ":" + e.toString()); + log.error(messageService.getMessage("error.msg.io.exception") + ":" + e.toString()); throw new UploadCommonCartridgeFileException(messageService.getMessage("error.msg.io.exception")); } } @@ -725,8 +722,7 @@ public void removeToolContent(Long toolContentId) throws ToolException { CommonCartridge commonCartridge = commonCartridgeDao.getByContentId(toolContentId); if (commonCartridge == null) { - CommonCartridgeServiceImpl.log - .warn("Can not remove the tool content as it does not exist, ID: " + toolContentId); + log.warn("Can not remove the tool content as it does not exist, ID: " + toolContentId); return; } @@ -741,17 +737,15 @@ } @Override - @SuppressWarnings("unchecked") public void removeLearnerContent(Long toolContentId, Integer userId) throws ToolException { - if (CommonCartridgeServiceImpl.log.isDebugEnabled()) { - CommonCartridgeServiceImpl.log.debug( + if (log.isDebugEnabled()) { + log.debug( "Removing Common Cartridge content for user ID " + userId + " and toolContentId " + toolContentId); } CommonCartridge cartridge = commonCartridgeDao.getByContentId(toolContentId); if (cartridge == null) { - CommonCartridgeServiceImpl.log - .warn("Did not find activity with toolContentId: " + toolContentId + " to remove learner content"); + log.warn("Did not find activity with toolContentId: " + toolContentId + " to remove learner content"); return; } @@ -808,11 +802,11 @@ @Override public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException { if (toolSessionId == null) { - CommonCartridgeServiceImpl.log.error("Fail to leave tool Session based on null tool session id."); + log.error("Fail to leave tool Session based on null tool session id."); throw new ToolException("Fail to remove tool Session based on null tool session id."); } if (learnerId == null) { - CommonCartridgeServiceImpl.log.error("Fail to leave tool Session based on null learner."); + log.error("Fail to leave tool Session based on null learner."); throw new ToolException("Fail to remove tool Session based on null learner."); } @@ -821,7 +815,7 @@ session.setStatus(CommonCartridgeConstants.COMPLETED); commonCartridgeSessionDao.saveObject(session); } else { - CommonCartridgeServiceImpl.log.error("Fail to leave tool Session.Could not find shared commonCartridge " + log.error("Fail to leave tool Session.Could not find shared commonCartridge " + "session by given session id: " + toolSessionId); throw new DataMissingException("Fail to leave tool Session." + "Could not find shared commonCartridge session by given session id: " + toolSessionId); @@ -871,28 +865,46 @@ //no actions required } - /* =================================================================================== */ + @Override + public List getMonitorsByToolSessionId(Long sessionId) { + return lessonService.getMonitorsByToolSessionId(sessionId); + } - public IExportToolContentService getExportContentService() { - return exportContentService; + @Override + public void auditLogStartEditingActivityInMonitor(long toolContentID) { + toolService.auditLogStartEditingActivityInMonitor(toolContentID); } - public void setExportContentService(IExportToolContentService exportContentService) { - this.exportContentService = exportContentService; + @Override + public ToolCompletionStatus getCompletionStatus(Long learnerId, Long toolSessionId) { + CommonCartridgeUser learner = getUserByIDAndSession(learnerId, toolSessionId); + if (learner == null) { + return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_NOT_ATTEMPTED, null, null); + } + + Object[] dates = commonCartridgeItemVisitDao.getDateRangeOfAccesses(learner.getUid()); + if (learner.isSessionFinished()) { + return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_COMPLETED, (Date) dates[0], (Date) dates[1]); + } else { + return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_ATTEMPTED, (Date) dates[0], null); + } } - public IUserManagementService getUserManagementService() { - return userManagementService; + @Override + public String getLocalisedMessage(String key, Object[] args) { + return messageService.getMessage(key, args); } + /* =================================================================================== */ + + public void setExportContentService(IExportToolContentService exportContentService) { + this.exportContentService = exportContentService; + } + public void setUserManagementService(IUserManagementService userManagementService) { this.userManagementService = userManagementService; } - public ICoreNotebookService getCoreNotebookService() { - return coreNotebookService; - } - public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { this.coreNotebookService = coreNotebookService; } @@ -906,42 +918,8 @@ this.eventNotificationService = eventNotificationService; } - @Override - public String getLocalisedMessage(String key, Object[] args) { - return messageService.getMessage(key, args); - } - - public ILessonService getLessonService() { - return lessonService; - } - public void setLessonService(ILessonService lessonService) { this.lessonService = lessonService; } - @Override - public List getMonitorsByToolSessionId(Long sessionId) { - return getLessonService().getMonitorsByToolSessionId(sessionId); - } - - @Override - public void auditLogStartEditingActivityInMonitor(long toolContentID) { - toolService.auditLogStartEditingActivityInMonitor(toolContentID); - } - - @Override - public ToolCompletionStatus getCompletionStatus(Long learnerId, Long toolSessionId) { - CommonCartridgeUser learner = getUserByIDAndSession(learnerId, toolSessionId); - if (learner == null) { - return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_NOT_ATTEMPTED, null, null); - } - - Object[] dates = commonCartridgeItemVisitDao.getDateRangeOfAccesses(learner.getUid()); - if (learner.isSessionFinished()) { - return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_COMPLETED, (Date) dates[0], (Date) dates[1]); - } else { - return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_ATTEMPTED, (Date) dates[0], null); - } - } - } Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_imscc/src/java/org/lamsfoundation/lams/tool/commonCartridge/service/CommonCartridgeServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/service/ResourceServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/leaderselectionApplicationContext.xml =================================================================== diff -u -r6f9041abdcbc64a47af95ec0932c03c9c04e0838 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/leaderselectionApplicationContext.xml (.../leaderselectionApplicationContext.xml) (revision 6f9041abdcbc64a47af95ec0932c03c9c04e0838) +++ lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/leaderselectionApplicationContext.xml (.../leaderselectionApplicationContext.xml) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -51,8 +51,9 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED + PROPAGATION_REQUIRED PROPAGATION_REQUIRED - + PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED Index: lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/ILeaderselectionService.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/ILeaderselectionService.java (.../ILeaderselectionService.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/ILeaderselectionService.java (.../ILeaderselectionService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -29,9 +29,12 @@ import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.tool.exception.DataMissingException; +import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.leaderselection.model.Leaderselection; import org.lamsfoundation.lams.tool.leaderselection.model.LeaderselectionSession; import org.lamsfoundation.lams.tool.leaderselection.model.LeaderselectionUser; +import org.lamsfoundation.lams.tool.leaderselection.util.LeaderselectionException; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; /** @@ -133,6 +136,8 @@ * @return */ LeaderselectionUser createLeaderselectionUser(UserDTO user, LeaderselectionSession leaderselectionSession); + + String finishToolSession(Long toolSessionId, Long userId); /** * Index: lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/LeaderselectionService.java =================================================================== diff -u -r6f9041abdcbc64a47af95ec0932c03c9c04e0838 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/LeaderselectionService.java (.../LeaderselectionService.java) (revision 6f9041abdcbc64a47af95ec0932c03c9c04e0838) +++ lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/LeaderselectionService.java (.../LeaderselectionService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -466,7 +466,24 @@ saveOrUpdateUser(leaderselectionUser); return leaderselectionUser; } + + @Override + public String finishToolSession(Long toolSessionId, Long userId) { + LeaderselectionUser user = leaderselectionUserDAO.getByUserIdAndSessionId(userId, toolSessionId); + user.setFinishedActivity(true); + leaderselectionUserDAO.saveOrUpdate(user); + String nextUrl = null; + try { + nextUrl = leaveToolSession(toolSessionId, userId); + } catch (DataMissingException e) { + throw new LeaderselectionException(e); + } catch (ToolException e) { + throw new LeaderselectionException(e); + } + return nextUrl; + } + // ========================================================================================= /* ********** Used by Spring to "inject" the linked objects ************* */ Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/LeaderselectionServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/web/controller/LearningController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/web/controller/LearningController.java (.../LearningController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/web/controller/LearningController.java (.../LearningController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -31,14 +31,12 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.tool.ToolAccessMode; -import org.lamsfoundation.lams.tool.ToolSessionManager; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.leaderselection.model.Leaderselection; import org.lamsfoundation.lams.tool.leaderselection.model.LeaderselectionSession; import org.lamsfoundation.lams.tool.leaderselection.model.LeaderselectionUser; import org.lamsfoundation.lams.tool.leaderselection.service.ILeaderselectionService; -import org.lamsfoundation.lams.tool.leaderselection.service.LeaderselectionServiceProxy; import org.lamsfoundation.lams.tool.leaderselection.util.LeaderselectionConstants; import org.lamsfoundation.lams.tool.leaderselection.util.LeaderselectionException; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -90,7 +88,7 @@ // Set the content in use flag. if (!content.isContentInUse()) { - content.setContentInUse(new Boolean(true)); + content.setContentInUse(true); leaderselectionService.saveOrUpdateLeaderselection(content); } @@ -124,8 +122,8 @@ * @throws JSONException */ @RequestMapping(value = "/becomeLeader") - public String becomeLeader(HttpServletRequest request) throws IOException { - Long toolSessionId = new Long(request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID)); + public void becomeLeader(HttpServletRequest request) throws IOException { + Long toolSessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); LeaderselectionSession session = leaderselectionService.getSessionBySessionId(toolSessionId); LeaderselectionUser groupLeader = session.getGroupLeader(); @@ -134,31 +132,16 @@ LeaderselectionUser user = getCurrentUser(toolSessionId); leaderselectionService.setGroupLeader(user.getUid(), toolSessionId); } - - return null; } @RequestMapping(value = "/finishActivity") - public String finishActivity(HttpServletRequest request, HttpServletResponse response) { - + public void finishActivity(HttpServletRequest request, HttpServletResponse response) { Long toolSessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); - LeaderselectionUser user = getCurrentUser(toolSessionID); - - if (user != null) { - user.setFinishedActivity(true); - leaderselectionService.saveOrUpdateUser(user); - } else { - log.error("finishActivity(): couldn't find LeaderselectionUser with id: " + user.getUserId() - + "and toolSessionID: " + toolSessionID); - } - - ToolSessionManager sessionMgrService = LeaderselectionServiceProxy - .getLeaderselectionSessionManager(applicationContext.getServletContext()); - String nextActivityUrl; try { - nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, user.getUserId()); + nextActivityUrl = leaderselectionService.finishToolSession(toolSessionID, user.getUserID().longValue()); response.sendRedirect(nextActivityUrl); } catch (DataMissingException e) { throw new LeaderselectionException(e); @@ -167,16 +150,14 @@ } catch (IOException e) { throw new LeaderselectionException(e); } - - return null; } private LeaderselectionUser getCurrentUser(Long toolSessionId) { UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); // attempt to retrieve user using userId and toolSessionId LeaderselectionUser leaderselectionUser = leaderselectionService - .getUserByUserIdAndSessionId(new Long(user.getUserID().intValue()), toolSessionId); + .getUserByUserIdAndSessionId(user.getUserID().longValue(), toolSessionId); if (leaderselectionUser == null) { LeaderselectionSession leaderselectionSession = leaderselectionService.getSessionBySessionId(toolSessionId); Index: lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/web/controller/LearningWebsocketServer.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/web/controller/LearningWebsocketServer.java (.../LearningWebsocketServer.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/web/controller/LearningWebsocketServer.java (.../LearningWebsocketServer.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -16,10 +16,11 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.tool.leaderselection.service.ILeaderselectionService; -import org.lamsfoundation.lams.tool.leaderselection.service.LeaderselectionServiceProxy; import org.lamsfoundation.lams.util.hibernate.HibernateSessionManager; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -67,13 +68,13 @@ } } catch (Exception e) { // error caught, but carry on - LearningWebsocketServer.log.error("Error in Leader worker thread", e); + log.error("Error in Leader worker thread", e); } finally { HibernateSessionManager.closeSession(); try { Thread.sleep(SendWorker.CHECK_INTERVAL); } catch (InterruptedException e) { - LearningWebsocketServer.log.warn("Stopping Leader worker thread"); + log.warn("Stopping Leader worker thread"); stopFlag = true; } } @@ -155,10 +156,11 @@ } private static ILeaderselectionService getLeaderService() { - if (LearningWebsocketServer.leaderService == null) { - LearningWebsocketServer.leaderService = LeaderselectionServiceProxy - .getLeaderselectionService(SessionManager.getServletContext()); + if (leaderService == null) { + WebApplicationContext wac = WebApplicationContextUtils + .getRequiredWebApplicationContext(SessionManager.getServletContext()); + leaderService = (ILeaderselectionService) wac.getBean("leaderselectionService"); } - return LearningWebsocketServer.leaderService; + return leaderService; } } \ No newline at end of file Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/notebookApplicationContext.xml =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/notebookApplicationContext.xml (.../notebookApplicationContext.xml) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/notebookApplicationContext.xml (.../notebookApplicationContext.xml) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -52,6 +52,7 @@ PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED + PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED PROPAGATION_REQUIRED Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/INotebookService.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/INotebookService.java (.../INotebookService.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/INotebookService.java (.../INotebookService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -112,35 +112,17 @@ NotebookUser createNotebookUser(UserDTO user, NotebookSession notebookSession); boolean notifyUser(Integer userId, String comment); + + String finishToolSession(NotebookUser notebookUser, Boolean isContentEditable, String entryText); /** * - * @param id - * @param idType - * @param signature - * @param userID - * @param title - * @param entry - * @return - */ - Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); - - /** - * * @param uid * @return */ NotebookEntry getEntry(Long uid); /** - * - * @param uid - * @param title - * @param entry - */ - void updateEntry(Long uid, String entry); - - /** * Creates an unique name for a ChatCondition. It consists of the tool output definition name and a unique positive * integer number. * Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookService.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookService.java (.../NotebookService.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookService.java (.../NotebookService.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -362,10 +362,31 @@ } /* ********** INotebookService Methods ********************************* */ - + @Override - public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry) { - return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry); + public String finishToolSession(NotebookUser notebookUser, Boolean isContentEditable, String entryText) { + Long userId = notebookUser.getUserId(); + Long toolSessionId = notebookUser.getNotebookSession().getSessionId(); + + // learningForm.getContentEditable() will be null if the deadline has passed + if (isContentEditable != null && isContentEditable) { + // TODO fix idType to use real value not 999 + if (notebookUser.getEntryUID() == null) { + Long entryUID = coreNotebookService.createNotebookEntry(toolSessionId, + CoreNotebookConstants.NOTEBOOK_TOOL, NotebookConstants.TOOL_SIGNATURE, + notebookUser.getUserId().intValue(), "", entryText); + notebookUser.setEntryUID(entryUID); + + } else { + // update existing entry. + coreNotebookService.updateEntry(notebookUser.getEntryUID(), "", entryText); + } + + notebookUser.setFinishedActivity(true); + saveOrUpdateNotebookUser(notebookUser); + } + + return leaveToolSession(toolSessionId, userId); } @Override @@ -374,14 +395,8 @@ } @Override - public void updateEntry(Long uid, String entry) { - coreNotebookService.updateEntry(uid, "", entry); - } - - @Override public Long getDefaultContentIdBySignature(String toolSignature) { - Long toolContentId = null; - toolContentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature)); + Long toolContentId = toolService.getToolDefaultContentIdBySignature(toolSignature); if (toolContentId == null) { String error = "Could not retrieve default content id for this tool"; NotebookService.logger.error(error); Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/service/NotebookServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/controller/LearningController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/controller/LearningController.java (.../LearningController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/controller/LearningController.java (.../LearningController.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -33,18 +33,14 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.notebook.model.NotebookEntry; -import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.ToolAccessMode; -import org.lamsfoundation.lams.tool.ToolSessionManager; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.notebook.dto.NotebookDTO; import org.lamsfoundation.lams.tool.notebook.model.Notebook; import org.lamsfoundation.lams.tool.notebook.model.NotebookSession; import org.lamsfoundation.lams.tool.notebook.model.NotebookUser; import org.lamsfoundation.lams.tool.notebook.service.INotebookService; -import org.lamsfoundation.lams.tool.notebook.service.NotebookServiceProxy; -import org.lamsfoundation.lams.tool.notebook.util.NotebookConstants; import org.lamsfoundation.lams.tool.notebook.util.NotebookException; import org.lamsfoundation.lams.tool.notebook.web.forms.LearningForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -191,27 +187,9 @@ Long toolSessionID = WebUtil.readLongParam(request, "toolSessionID"); NotebookUser notebookUser = getCurrentUser(toolSessionID); - // learningForm.getContentEditable() will be null if the deadline has passed - if (messageForm.getContentEditable() != null && messageForm.getContentEditable()) { - // TODO fix idType to use real value not 999 - if (notebookUser.getEntryUID() == null) { - notebookUser.setEntryUID(notebookService.createNotebookEntry(toolSessionID, - CoreNotebookConstants.NOTEBOOK_TOOL, NotebookConstants.TOOL_SIGNATURE, - notebookUser.getUserId().intValue(), messageForm.getEntryText())); - } else { - // update existing entry. - notebookService.updateEntry(notebookUser.getEntryUID(), messageForm.getEntryText()); - } - - notebookUser.setFinishedActivity(true); - notebookService.saveOrUpdateNotebookUser(notebookUser); - } - - ToolSessionManager sessionMgrService = NotebookServiceProxy - .getNotebookSessionManager(applicationContext.getServletContext()); - try { - String nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, notebookUser.getUserId()); + String nextActivityUrl = notebookService.finishToolSession(notebookUser, messageForm.getContentEditable(), + messageForm.getEntryText()); response.sendRedirect(nextActivityUrl); } catch (DataMissingException e) { throw new NotebookException(e); Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_pixlr/src/java/org/lamsfoundation/lams/tool/pixlr/service/PixlrServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/LearningWebsocketServer.java =================================================================== diff -u -r22cca1a815f7aee530e14ab87b7744f381d03ac1 -r9b4a3799f9589dbda9a792e10a4ebd649db1e3db --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/LearningWebsocketServer.java (.../LearningWebsocketServer.java) (revision 22cca1a815f7aee530e14ab87b7744f381d03ac1) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/controller/LearningWebsocketServer.java (.../LearningWebsocketServer.java) (revision 9b4a3799f9589dbda9a792e10a4ebd649db1e3db) @@ -20,14 +20,16 @@ import javax.websocket.server.ServerEndpoint; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAnswer; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; import org.lamsfoundation.lams.tool.scratchie.service.IScratchieService; -import org.lamsfoundation.lams.tool.scratchie.service.ScratchieServiceProxy; import org.lamsfoundation.lams.util.hibernate.HibernateSessionManager; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -122,13 +124,13 @@ } } catch (Exception e) { // error caught, but carry on - LearningWebsocketServer.log.error("Error in Scratchie worker thread", e); + log.error("Error in Scratchie worker thread", e); } finally { HibernateSessionManager.closeSession(); try { Thread.sleep(SendWorker.CHECK_INTERVAL); } catch (InterruptedException e) { - LearningWebsocketServer.log.warn("Stopping Scratchie worker thread"); + log.warn("Stopping Scratchie worker thread"); stopFlag = true; } } @@ -224,8 +226,8 @@ } sessionWebsockets.add(websocket); - if (LearningWebsocketServer.log.isDebugEnabled()) { - LearningWebsocketServer.log.debug("User " + websocket.getUserPrincipal().getName() + if (log.isDebugEnabled()) { + log.debug("User " + websocket.getUserPrincipal().getName() + " entered Scratchie with toolSessionId: " + toolSessionId); } } @@ -239,9 +241,9 @@ .valueOf(websocket.getRequestParameterMap().get(AttributeNames.PARAM_TOOL_SESSION_ID).get(0)); LearningWebsocketServer.websockets.get(toolSessionId).remove(websocket); - if (LearningWebsocketServer.log.isDebugEnabled()) { + if (log.isDebugEnabled()) { // If there was something wrong with the connection, put it into logs. - LearningWebsocketServer.log.debug("User " + websocket.getUserPrincipal().getName() + log.debug("User " + websocket.getUserPrincipal().getName() + " left Scratchie with Tool Session ID: " + toolSessionId + (!(reason.getCloseCode().equals(CloseCodes.GOING_AWAY) || reason.getCloseCode().equals(CloseCodes.NORMAL_CLOSURE)) @@ -294,10 +296,11 @@ } private static IScratchieService getScratchieService() { - if (LearningWebsocketServer.scratchieService == null) { - LearningWebsocketServer.scratchieService = ScratchieServiceProxy - .getScratchieService(SessionManager.getServletContext()); + if (scratchieService == null) { + WebApplicationContext wac = WebApplicationContextUtils + .getRequiredWebApplicationContext(SessionManager.getServletContext()); + scratchieService = (IScratchieService) wac.getBean(ScratchieConstants.SCRATCHIE_SERVICE); } - return LearningWebsocketServer.scratchieService; + return scratchieService; } } \ No newline at end of file Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_spreadsheet/src/java/org/lamsfoundation/lams/tool/spreadsheet/service/SpreadsheetServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/service/SurveyServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 9b4a3799f9589dbda9a792e10a4ebd649db1e3db refers to a dead (removed) revision in file `lams_tool_zoom/src/java/org/lamsfoundation/lams/tool/zoom/service/ZoomServiceProxy.java'. Fisheye: No comparison available. Pass `N' to diff?