Index: lams_build/lib/lams/lams-learning.jar =================================================================== diff -u -rd14cbf6345f10cc57377b00715c99f83aea6cd2b -r04802eaaf2249d4faf8784f702664d28f46fdebc Binary files differ Index: lams_learning/src/java/org/lamsfoundation/lams/learning/export/service/ExportPortfolioService.java =================================================================== diff -u -r810a3898f726d0eae005128cde246c8e0d3c0ed3 -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/export/service/ExportPortfolioService.java (.../ExportPortfolioService.java) (revision 810a3898f726d0eae005128cde246c8e0d3c0ed3) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/export/service/ExportPortfolioService.java (.../ExportPortfolioService.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -44,7 +44,7 @@ import org.lamsfoundation.lams.learning.export.ExportPortfolioConstants; import org.lamsfoundation.lams.learning.export.ExportPortfolioException; import org.lamsfoundation.lams.learning.export.Portfolio; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learningdesign.dao.IActivityDAO; import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.lesson.Lesson; @@ -81,7 +81,7 @@ private ILamsCoreToolService lamsCoreToolService; private IActivityDAO activityDAO; - private ILearnerService learnerService; + private ICoreLearnerService learnerService; private IBaseDAO baseDAO; private ILessonDAO lessonDAO; protected MessageService messageService; @@ -90,7 +90,7 @@ /** * @param learnerService The learnerService to set. */ - public void setLearnerService(ILearnerService learnerService) { + public void setLearnerService(ICoreLearnerService learnerService) { this.learnerService = learnerService; } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/MainExportServlet.java =================================================================== diff -u -reb7240215d5100a3624b61903fac9af0d8a26b5e -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/MainExportServlet.java (.../MainExportServlet.java) (revision eb7240215d5100a3624b61903fac9af0d8a26b5e) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/MainExportServlet.java (.../MainExportServlet.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -99,7 +99,6 @@ Cookie[] cookies = request.getCookies(); IExportPortfolioService exportService = ExportPortfolioServiceProxy.getExportPortfolioService(this.getServletContext()); - // ILearnerService learnerService = LearnerServiceProxy.getLearnerService(this.getServletContext()); String mode = WebUtil.readStrParam(request, AttributeNames.PARAM_MODE); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/ICoreLearnerService.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/ICoreLearnerService.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/ICoreLearnerService.java (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -0,0 +1,245 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * 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 version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.learning.service; + +import java.util.List; + +import org.lamsfoundation.lams.learningdesign.Activity; +import org.lamsfoundation.lams.learningdesign.GateActivity; +import org.lamsfoundation.lams.lesson.LearnerProgress; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.dto.LearnerProgressDTO; +import org.lamsfoundation.lams.lesson.dto.LessonDTO; +import org.lamsfoundation.lams.tool.exception.LamsToolServiceException; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.MessageService; +/** + * + * All Learner service methods that are available within the core. These methods may require + * all the tool's Spring context files to be loaded, in addition to the core Spring context files. + * Hence it should only be used from lams-learning, lams-monitoring, lams-central wars. + */ +public interface ICoreLearnerService extends ILearnerService +{ + + /** Get the I18N service. Used by actions for internationalising errors that go back to Flash */ + public MessageService getMessageService(); + + /** Get the user service. Used when the action needs the real user object, not just the userId */ + public IUserManagementService getUserManagementService(); + + /** + * Gets the lesson object for the given key. + * + */ + public Lesson getLesson(Long lessonID); + + /** + * Get the lesson data for a particular lesson. In a DTO format suitable for sending to the client. + */ + public LessonDTO getLessonData(Long lessonId); + + + /** + * Joins a User to a a new lesson as a learner + * @param learnerId the Learner's userID + * @param lessionID identifies the Lesson to start + * @throws LearnerServiceException in case of problems. + */ + public LearnerProgress joinLesson(Integer learnerId, Long lessonID) ; + + /** + * This method navigate through all the tool activities for the given + * activity. For each tool activity, we look up the database + * to check up the existance of correspondent tool session. If the tool + * session doesn't exist, we create a new tool session instance. + * + * @param learnerProgress the learner progress we are processing. + * @throws LamsToolServiceException + */ + public void createToolSessionsIfNecessary(Activity activity, LearnerProgress learnerProgress); + + /** + * Returns the current progress data of the User. + * @param learnerId the Learner's userID + * @param lessonId the Lesson to get progress from. + * @return LearnerProgess contains the learner's progress for the lesson. + * @throws LearnerServiceException in case of problems. + */ + public LearnerProgress getProgress(Integer learnerId, Long lessonId); + + /** + * Return the current progress data against progress id. + * @param progressId + * @return + */ + public LearnerProgress getProgressById(Long progressId); + + /** + * Return the current progress data for a user for a lesson + * Returns a DTO suitable to send to Flash. + * @param lesson id + * @param learner id + * @return + */ + public LearnerProgressDTO getProgressDTOByLessonId(Long lessonId, Integer learnerId); + + /** + * Marks an activity as attempted. Called when a user selects an OptionsActivity. + * @param learnerId the Learner's userID + * @param lessonId the Lesson to get progress from. + * @param activity the activity being attempted. + * @return LearnerProgress + */ + public LearnerProgress chooseActivity(Integer learnerId, Long lessonId, Activity activity); + + + /** + * Calculates learner progress and returns the data required to be displayed to the learner (including URL(s)). + * @param completedActivityID identifies the activity just completed + * @param learner the Learner + * @return the bean containing the display data for the Learner + * @throws LearnerServiceException in case of problems. + */ + public LearnerProgress calculateProgress(Activity completedActivity, Integer learnerId); + + /** + * Complete the activity in the progress engine and delegate to the progress + * engine to calculate the next activity in the learning design. This + * process might be triggerred by system controlled the activity, such as + * grouping and gate. This method should be used when we don't have an activity + * or a lesson that is already part of the Hibernate session. + * + * @param learnerId the learner who are running this activity in the design. + * @param activity the activity is being run. + * @return the url for next activity. + */ + public String completeActivity(Integer learnerId,Long activityId); + + /** + * Complete the activity in the progress engine and delegate to the progress + * engine to calculate the next activity in the learning design. This method should + * be used when we t have an activity that is already part of the Hibernate session. + * It is currently triggered by complete tool session progress from tool. + * + * @param learnerId the learner who are running this activity in the design. + * @param activity the activity is being run. + * @return the url for next activity. + */ + public String completeActivity(Integer learnerId,Activity activity); + + /** + * Retrieve all lessons that has been started, suspended or finished. All + * finished but archived lesson should not be loaded. + * TODO to be removed when dummy learner interface is removed + * @param learner the user who intend to start a lesson + * @return a list of active lessons. + */ + public LessonDTO[] getActiveLessonsFor(Integer learnerId); + + /** + * Mark the learner progress as restarting to indicate the current learner + * has exit the lesson. Doesn't use the cached progress object in case it + * + * @param userId + * @param lessonId + */ + public void exitLesson(Long progressId); + + /** + * Returns an activity according to the activity id. + * @param activityId the activity id. + * @return the activity requested. + */ + public Activity getActivity(Long activityId); + + /** + * Returns all the active learners by the lesson id. + * @param lessonId the requested lesson id. + * @return the list of learners. + */ + public List getActiveLearnersByLesson(long lessonId); + + /** + * Returns a count of all the active learners by lesson id. + * More efficient than calling getActiveLearnersByLesson(lessonId).size() + */ + public Integer getCountActiveLearnersByLesson(long lessonId); + + /** + * Perform grouping for the learners who have started the lesson, + * based on the grouping activity. + * + * @param lessonId lesson id + * @param groupingActivityId the activity that has create grouping. + * @param learnerId the learner who triggers the grouping. + * @param forceGrouping if forceGrouping==true and the lesson is a preview lesson then the groupings is done irrespective of the grouping type + * @return true if grouping done, false if waiting for grouping to occur + */ + public boolean performGrouping(Long lessonId, Long groupingActivityId, Integer learnerId, boolean forceGrouping); + + + /** + * Check up the gate status to go through the gate. This also updates the gate. + * This method should be used when we do not have an grouping activity + * that is already part of the Hibernate session. + * @param gateid the gate that current learner is facing. It could be + * synch gate, schedule gate or permission gate. + * @param knocker the learner who wants to go through the gate. + * @param forceGate if forceGate==true and the lesson is a preview lesson then the gate is opened straight away. + * @return true if the gate is now open + */ + public boolean knockGate(Long gateActivityId, User knocker, boolean forceGate); + + /** + * Check up the gate status to go through the gate. This also updates the gate. + * This method should be used when we do have an grouping activity + * that is already part of the Hibernate session. + * @param gate the gate that current learner is facing. It could be + * synch gate, schedule gate or permission gate. + * Don't supply the actual gate from the cached web version + * as it might be out of date or not attached to the session + * @param knocker the learner who wants to go through the gate. + * @param forceGate if forceGate==true and the lesson is a preview lesson then the gate is opened straight away. + * @return true if the gate is now open + */ + public boolean knockGate(GateActivity gateActivity, User knocker, boolean forceGate); + + /** + * Get the learner url for a particular activity. + * + * @param learnerId + * @param activityId + */ + public String getLearnerActivityURL(Integer learnerId, Long activityId); + + /** + * Get the lesson for this activity. If the activity is not part of a lesson (ie is from an authoring + * design then it will return null. + */ + public Lesson getLessonByActivity(Activity activity); + +} Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -24,97 +24,13 @@ /* $$Id$$ */ package org.lamsfoundation.lams.learning.service; -import java.util.List; - -import org.lamsfoundation.lams.learningdesign.Activity; -import org.lamsfoundation.lams.learningdesign.GateActivity; -import org.lamsfoundation.lams.lesson.LearnerProgress; -import org.lamsfoundation.lams.lesson.Lesson; -import org.lamsfoundation.lams.lesson.dto.LearnerProgressDTO; -import org.lamsfoundation.lams.lesson.dto.LessonDTO; -import org.lamsfoundation.lams.usermanagement.User; -import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; -import org.lamsfoundation.lams.util.MessageService; /** - * - * @author chris + * Learner service methods available to tools. These methods should work fine as long as the web + * context contains the core Spring context files. */ public interface ILearnerService { - - /** Get the I18N service. Used by actions for internationalising errors that go back to Flash */ - public MessageService getMessageService(); - - /** Get the user service. Used when the action needs the real user object, not just the userId */ - public IUserManagementService getUserManagementService(); - /** - * Gets the lesson object for the given key. - * - */ - public Lesson getLesson(Long lessonID); - - /** - * Get the lesson data for a particular lesson. In a DTO format suitable for sending to the client. - */ - public LessonDTO getLessonData(Long lessonId); - - - /** - * Joins a User to a a new lesson as a learner - * @param learnerId the Learner's userID - * @param lessionID identifies the Lesson to start - * @throws LearnerServiceException in case of problems. - */ - public LearnerProgress joinLesson(Integer learnerId, Long lessonID) ; - - - /** - * Returns the current progress data of the User. - * @param learnerId the Learner's userID - * @param lessonId the Lesson to get progress from. - * @return LearnerProgess contains the learner's progress for the lesson. - * @throws LearnerServiceException in case of problems. - */ - public LearnerProgress getProgress(Integer learnerId, Long lessonId); - - /** - * Return the current progress data against progress id. - * @param progressId - * @return - */ - public LearnerProgress getProgressById(Long progressId); - - /** - * Return the current progress data for a user for a lesson - * Returns a DTO suitable to send to Flash. - * @param lesson id - * @param learner id - * @return - */ - public LearnerProgressDTO getProgressDTOByLessonId(Long lessonId, Integer learnerId); - - /** - * Marks an activity as attempted. Called when a user selects an OptionsActivity. - * @param learnerId the Learner's userID - * @param lessonId the Lesson to get progress from. - * @param activity the activity being attempted. - * @return LearnerProgress - */ - public LearnerProgress chooseActivity(Integer learnerId, Long lessonId, Activity activity); - - - /** - * Calculates learner progress and returns the data required to be displayed to the learner (including URL(s)). - * @param completedActivityID identifies the activity just completed - * @param learner the Learner - * @return the bean containing the display data for the Learner - * @throws LearnerServiceException in case of problems. - */ - public LearnerProgress calculateProgress(Activity completedActivity, Integer learnerId); - - - /** * Marks an tool session as complete and calculates the next activity against * the learning design. This method is for tools to redirect the client on * complete. @@ -128,121 +44,5 @@ * @throws LearnerServiceException in case of problems. */ public String completeToolSession(Long toolSessionId, Long learnerId); - - /** - * Complete the activity in the progress engine and delegate to the progress - * engine to calculate the next activity in the learning design. This - * process might be triggerred by system controlled the activity, such as - * grouping and gate. This method should be used when we don't have an activity - * or a lesson that is already part of the Hibernate session. - * - * @param learnerId the learner who are running this activity in the design. - * @param activity the activity is being run. - * @return the url for next activity. - */ - public String completeActivity(Integer learnerId,Long activityId); - - /** - * Complete the activity in the progress engine and delegate to the progress - * engine to calculate the next activity in the learning design. This method should - * be used when we t have an activity that is already part of the Hibernate session. - * It is currently triggered by complete tool session progress from tool. - * - * @param learnerId the learner who are running this activity in the design. - * @param activity the activity is being run. - * @return the url for next activity. - */ - public String completeActivity(Integer learnerId,Activity activity); - /** - * Retrieve all lessons that has been started, suspended or finished. All - * finished but archived lesson should not be loaded. - * TODO to be removed when dummy learner interface is removed - * @param learner the user who intend to start a lesson - * @return a list of active lessons. - */ - public LessonDTO[] getActiveLessonsFor(Integer learnerId); - - /** - * Mark the learner progress as restarting to indicate the current learner - * has exit the lesson. Doesn't use the cached progress object in case it - * - * @param userId - * @param lessonId - */ - public void exitLesson(Long progressId); - - /** - * Returns an activity according to the activity id. - * @param activityId the activity id. - * @return the activity requested. - */ - public Activity getActivity(Long activityId); - - /** - * Returns all the active learners by the lesson id. - * @param lessonId the requested lesson id. - * @return the list of learners. - */ - public List getActiveLearnersByLesson(long lessonId); - - /** - * Returns a count of all the active learners by lesson id. - * More efficient than calling getActiveLearnersByLesson(lessonId).size() - */ - public Integer getCountActiveLearnersByLesson(long lessonId); - - /** - * Perform grouping for the learners who have started the lesson, - * based on the grouping activity. - * - * @param lessonId lesson id - * @param groupingActivityId the activity that has create grouping. - * @param learnerId the learner who triggers the grouping. - * @param forceGrouping if forceGrouping==true and the lesson is a preview lesson then the groupings is done irrespective of the grouping type - * @return true if grouping done, false if waiting for grouping to occur - */ - public boolean performGrouping(Long lessonId, Long groupingActivityId, Integer learnerId, boolean forceGrouping); - - - /** - * Check up the gate status to go through the gate. This also updates the gate. - * This method should be used when we do not have an grouping activity - * that is already part of the Hibernate session. - * @param gateid the gate that current learner is facing. It could be - * synch gate, schedule gate or permission gate. - * @param knocker the learner who wants to go through the gate. - * @param forceGate if forceGate==true and the lesson is a preview lesson then the gate is opened straight away. - * @return true if the gate is now open - */ - public boolean knockGate(Long gateActivityId, User knocker, boolean forceGate); - - /** - * Check up the gate status to go through the gate. This also updates the gate. - * This method should be used when we do have an grouping activity - * that is already part of the Hibernate session. - * @param gate the gate that current learner is facing. It could be - * synch gate, schedule gate or permission gate. - * Don't supply the actual gate from the cached web version - * as it might be out of date or not attached to the session - * @param knocker the learner who wants to go through the gate. - * @param forceGate if forceGate==true and the lesson is a preview lesson then the gate is opened straight away. - * @return true if the gate is now open - */ - public boolean knockGate(GateActivity gateActivity, User knocker, boolean forceGate); - - /** - * Get the learner url for a particular activity. - * - * @param learnerId - * @param activityId - */ - public String getLearnerActivityURL(Integer learnerId, Long activityId); - - /** - * Get the lesson for this activity. If the activity is not part of a lesson (ie is from an authoring - * design then it will return null. - */ - public Lesson getLessonByActivity(Activity activity); - } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java =================================================================== diff -u -r9bffc1a7278bddba6ffc3c6af493d5bc1faf43f9 -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 9bffc1a7278bddba6ffc3c6af493d5bc1faf43f9) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -62,7 +62,7 @@ * This class is a facade over the Learning middle tier. * @author chris, Jacky Fang */ -public class LearnerService implements ILearnerService +public class LearnerService implements ICoreLearnerService { //--------------------------------------------------------------------- // Instance variables @@ -177,7 +177,7 @@ //--------------------------------------------------------------------- /** * Delegate to lesson dao to load up the lessons. - * @see org.lamsfoundation.lams.learning.service.ILearnerService#getActiveLessonsFor(org.lamsfoundation.lams.usermanagement.User) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getActiveLessonsFor(org.lamsfoundation.lams.usermanagement.User) */ public LessonDTO[] getActiveLessonsFor(Integer learnerId) { @@ -253,13 +253,45 @@ learnerProgressDAO.updateLearnerProgress(learnerProgress); } - createToolSessionsIfNecessary(learnerProgress); lessonService.cacheLessonUser(lesson, learner); return learnerProgress; } + /** + * This method navigate through all the tool activities for the given + * activity. For each tool activity, we look up the database + * to check up the existance of correspondent tool session. If the tool + * session doesn't exist, we create a new tool session instance. + * + * @param learnerProgress the learner progress we are processing. + * @throws LamsToolServiceException + */ + public void createToolSessionsIfNecessary(Activity activity, LearnerProgress learnerProgress) + { + if(activity!=null) { + + try + { + for(Iterator i = activity.getAllToolActivities().iterator();i.hasNext();) + { + ToolActivity toolActivity = (ToolActivity)i.next(); + createToolSessionFor(toolActivity, learnerProgress.getUser(),learnerProgress.getLesson()); + } + } + catch (LamsToolServiceException e) + { + log.error("error occurred in 'createToolSessionFor':"+e.getMessage()); + throw new LearnerServiceException(e.getMessage()); + } + catch (ToolException e) + { + log.error("error occurred in 'createToolSessionFor':"+e.getMessage()); + throw new LearnerServiceException(e.getMessage()); + } + } + } + - /** * Returns the current progress data of the User. * @param learnerId the Learner's userID @@ -273,23 +305,23 @@ } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#getProgressById(java.lang.Long) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getProgressById(java.lang.Long) */ public LearnerProgress getProgressById(Long progressId) { return learnerProgressDAO.getLearnerProgress(progressId); } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#getProgressDTOByLessonId(java.lang.Long, org.lamsfoundation.lams.usermanagement.User) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getProgressDTOByLessonId(java.lang.Long, org.lamsfoundation.lams.usermanagement.User) */ public LearnerProgressDTO getProgressDTOByLessonId(Long lessonId, Integer learnerId) { return learnerProgressDAO.getLearnerProgressByLearner(learnerId, lessonId).getLearnerProgressData(); } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#chooseActivity(org.lamsfoundation.lams.usermanagement.User, java.lang.Long, org.lamsfoundation.lams.learningdesign.Activity) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#chooseActivity(org.lamsfoundation.lams.usermanagement.User, java.lang.Long, org.lamsfoundation.lams.learningdesign.Activity) */ public LearnerProgress chooseActivity(Integer learnerId, Long lessonId, Activity activity) { @@ -320,8 +352,6 @@ { learnerProgress = progressEngine.calculateProgress(learnerProgress.getUser(), completedActivity,learnerProgress); learnerProgressDAO.updateLearnerProgress(learnerProgress); - - createToolSessionsIfNecessary(learnerProgress); } catch (ProgressException e) { @@ -336,26 +366,27 @@ */ public String completeToolSession(Long toolSessionId, Long learnerId) { - //update tool session state in lams - ToolSession toolSession = lamsCoreToolService.getToolSessionById(toolSessionId); + // this method is called by tools, so it mustn't do anything that relies on all the tools' Spring beans + // being available in the context. Hence it is defined in the ILearnerService interface, not the IFullLearnerService + // interface. If it calls any other methods then it mustn't use anything on the ICoreLearnerService interface. + ToolSession toolSession = lamsCoreToolService.getToolSessionById(toolSessionId); toolSession.setToolSessionStateId(ToolSession.ENDED_STATE); - lamsCoreToolService.updateToolSession(toolSession); return completeActivity(new Integer(learnerId.intValue()), toolSession.getToolActivity()); } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#completeActivity(java.lang.Integer, java.lang.Long) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#completeActivity(java.lang.Integer, java.lang.Long) */ public String completeActivity(Integer learnerId,Long activityId) { Activity activity = getActivity(activityId); return completeActivity(learnerId, activity); } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#completeActivity(java.lang.Integer, org.lamsfoundation.lams.learningdesign.Activity, java.lang.Long ) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#completeActivity(java.lang.Integer, org.lamsfoundation.lams.learningdesign.Activity, java.lang.Long ) */ public String completeActivity(Integer learnerId,Activity activity) { @@ -373,7 +404,7 @@ /** * Exit a lesson. - * @see org.lamsfoundation.lams.learning.service.ILearnerService#exitLesson(org.lamsfoundation.lams.lesson.LearnerProgress) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#exitLesson(org.lamsfoundation.lams.lesson.LearnerProgress) */ public void exitLesson(Long progressId) { @@ -390,7 +421,7 @@ } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#getActivity(java.lang.Long) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getActivity(java.lang.Long) */ public Activity getActivity(Long activityId) { @@ -399,7 +430,7 @@ /** * @throws LearnerServiceException - * @see org.lamsfoundation.lams.learning.service.ILearnerService#performGrouping(java.lang.Long, java.lang.Long, java.lang.Integer) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#performGrouping(java.lang.Long, java.lang.Long, java.lang.Integer) */ public boolean performGrouping(Long lessonId, Long groupingActivityId, Integer learnerId, boolean forceGrouping) throws LearnerServiceException { @@ -445,7 +476,7 @@ /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#knockGate(java.lang.Long, org.lamsfoundation.lams.usermanagement.User) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#knockGate(java.lang.Long, org.lamsfoundation.lams.usermanagement.User) */ public boolean knockGate(Long gateActivityId, User knocker, boolean forceGate) { GateActivity gate = (GateActivity) activityDAO.getActivityByActivityId(gateActivityId, GateActivity.class); @@ -458,7 +489,7 @@ throw new LearnerServiceException(error); } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#knockGate(org.lamsfoundation.lams.learningdesign.GateActivity, org.lamsfoundation.lams.usermanagement.User) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#knockGate(org.lamsfoundation.lams.learningdesign.GateActivity, org.lamsfoundation.lams.usermanagement.User) */ public boolean knockGate(GateActivity gate, User knocker, boolean forceGate) { @@ -489,7 +520,7 @@ } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#getLearnerActivityURL(java.lang.Integer, java.lang.Long) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getLearnerActivityURL(java.lang.Integer, java.lang.Long) */ public String getLearnerActivityURL(Integer learnerId, Long activityId) { User learner = (User)userManagementService.findById(User.class,learnerId); @@ -499,15 +530,15 @@ } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#getActiveLearnersByLesson(long) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getActiveLearnersByLesson(long) */ public List getActiveLearnersByLesson(long lessonId) { return lessonService.getActiveLessonLearners(lessonId); } /** - * @see org.lamsfoundation.lams.learning.service.ILearnerService#getCountActiveLessonLearners(long) + * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#getCountActiveLessonLearners(long) */ public Integer getCountActiveLearnersByLesson(long lessonId) { @@ -528,44 +559,8 @@ //--------------------------------------------------------------------- // Helper Methods //--------------------------------------------------------------------- + /** - * This method navigate through all the tool activities included inside - * the next activity. For each tool activity, we look up the database - * to check up the existance of correspondent tool session. If the tool - * session doesn't exist, we create a new tool session instance. - * - * @param learnerProgress the learner progress we are processing. - * @throws LamsToolServiceException - */ - private void createToolSessionsIfNecessary(LearnerProgress learnerProgress) - { - // getNextActivity will be null if we have finished the top part of a parallel activity. - - if(learnerProgress.getNextActivity()!=null) { - - Activity nextActivity = learnerProgress.getNextActivity(); - try - { - for(Iterator i = nextActivity.getAllToolActivities().iterator();i.hasNext();) - { - ToolActivity toolActivity = (ToolActivity)i.next(); - createToolSessionFor(toolActivity, learnerProgress.getUser(),learnerProgress.getLesson()); - } - } - catch (LamsToolServiceException e) - { - log.error("error occurred in 'createToolSessionFor':"+e.getMessage()); - throw new LearnerServiceException(e.getMessage()); - } - catch (ToolException e) - { - log.error("error occurred in 'createToolSessionFor':"+e.getMessage()); - throw new LearnerServiceException(e.getMessage()); - } - } - } - - /** *
Create a lams tool session for learner against a tool activity. This will * have concurrency issues interms of grouped tool session because it might * be inserting some tool session that has already been inserted by other @@ -582,9 +577,8 @@ */ private void createToolSessionFor(ToolActivity toolActivity,User learner,Lesson lesson) throws LamsToolServiceException, ToolException { + // if the tool session already exists, createToolSession() will return null ToolSession toolSession = lamsCoreToolService.createToolSession(learner,toolActivity,lesson); - - // if the tool session already exists, will return null if ( toolSession !=null ) { toolActivity.getToolSessions().add(toolSession); lamsCoreToolService.notifyToolsToCreateSession(toolSession, toolActivity); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceProxy.java =================================================================== diff -u -rcdb910b6cd3de106725e2c22ded380c5c0fab650 -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceProxy.java (.../LearnerServiceProxy.java) (revision cdb910b6cd3de106725e2c22ded380c5c0fab650) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceProxy.java (.../LearnerServiceProxy.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -50,9 +50,9 @@ * @param servletContext the servletContext for current application * @return learner service object. */ - public static final ILearnerService getLearnerService(ServletContext servletContext) + public static final ICoreLearnerService getLearnerService(ServletContext servletContext) { - return (ILearnerService)getDomainService(servletContext,"learnerService"); + return (ICoreLearnerService)getDomainService(servletContext,"learnerService"); } /** Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ActivityAction.java =================================================================== diff -u -r7da79aec2f320705164e3faae07352a54d1de68a -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ActivityAction.java (.../ActivityAction.java) (revision 7da79aec2f320705164e3faae07352a54d1de68a) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ActivityAction.java (.../ActivityAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -30,7 +30,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.form.ActivityForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; @@ -51,9 +51,9 @@ public static final String ACTIVITY_REQUEST_ATTRIBUTE = "activity"; public static final String LEARNER_PROGRESS_REQUEST_ATTRIBUTE = "learnerprogress"; - private ILearnerService learnerService = null; + private ICoreLearnerService learnerService = null; - protected ILearnerService getLearnerService() { + protected ICoreLearnerService getLearnerService() { if (learnerService == null) learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); return learnerService; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ChooseActivityAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ChooseActivityAction.java (.../ChooseActivityAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ChooseActivityAction.java (.../ChooseActivityAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -30,7 +30,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; @@ -68,7 +68,7 @@ return mapping.findForward(ActivityMapping.DOUBLE_SUBMIT_ERROR); } - ILearnerService learnerService = getLearnerService(); + ICoreLearnerService learnerService = getLearnerService(); // Get learner and lesson details. Integer learner = LearningWebUtil.getUserId(); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/CompleteActivityAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/CompleteActivityAction.java (.../CompleteActivityAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/CompleteActivityAction.java (.../CompleteActivityAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -30,7 +30,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; @@ -71,7 +71,7 @@ return mapping.findForward(ActivityMapping.DOUBLE_SUBMIT_ERROR); } - ILearnerService learnerService = getLearnerService(); + ICoreLearnerService learnerService = getLearnerService(); Integer learnerId = LearningWebUtil.getUserId(); LearnerProgress progress = LearningWebUtil.getLearnerProgress(request, learnerService); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayActivityAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayActivityAction.java (.../DisplayActivityAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayActivityAction.java (.../DisplayActivityAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -31,7 +31,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; @@ -78,7 +78,7 @@ HttpServletRequest request, HttpServletResponse response) { - ILearnerService learnerService = getLearnerService(); + ICoreLearnerService learnerService = getLearnerService(); // Flash can only send the lessonID as that is all it has... Integer learnerId = LearningWebUtil.getUserId(); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayOptionsActivityAction.java =================================================================== diff -u -r72b118b48839e745894e1675837457bcf2e250eb -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayOptionsActivityAction.java (.../DisplayOptionsActivityAction.java) (revision 72b118b48839e745894e1675837457bcf2e250eb) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayOptionsActivityAction.java (.../DisplayOptionsActivityAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -35,7 +35,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.bean.ActivityURL; import org.lamsfoundation.lams.learning.web.form.OptionsActivityForm; @@ -73,7 +73,7 @@ OptionsActivityForm form = (OptionsActivityForm)actionForm; ActivityMapping actionMappings = getActivityMapping(); - ILearnerService learnerService = getLearnerService(); + ICoreLearnerService learnerService = getLearnerService(); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); if (!(activity instanceof OptionsActivity)) { Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayToolActivityAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayToolActivityAction.java (.../DisplayToolActivityAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayToolActivityAction.java (.../DisplayToolActivityAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -30,7 +30,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; @@ -64,7 +64,7 @@ //ActivityForm form = (ActivityForm)actionForm; ActivityMapping actionMappings = getActivityMapping(); - ILearnerService learnerService = getLearnerService(); + ICoreLearnerService learnerService = getLearnerService(); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); if (!(activity instanceof ToolActivity)) Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DummyLearnerAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DummyLearnerAction.java (.../DummyLearnerAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DummyLearnerAction.java (.../DummyLearnerAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -34,7 +34,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.lesson.LearnerProgress; @@ -103,7 +103,7 @@ ServletException { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); //get learner. Integer learner = LearningWebUtil.getUserId(); @@ -141,7 +141,7 @@ ServletException { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); //get user and lesson based on request. Integer learner = LearningWebUtil.getUserId(); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -34,7 +34,7 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.DynaActionForm; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; @@ -125,7 +125,7 @@ Long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); Activity activity = learnerService.getActivity(activityId); Lesson lesson = learnerService.getLessonByActivity(activity); User learner = LearningWebUtil.getUser(learnerService); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java =================================================================== diff -u -rea00f78fb5679dec8d15e06d062fb689e3df7dcb -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java (.../GroupingAction.java) (revision ea00f78fb5679dec8d15e06d062fb689e3df7dcb) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java (.../GroupingAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -37,7 +37,7 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.DynaActionForm; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; @@ -132,7 +132,7 @@ boolean forceGroup = WebUtil.readBooleanParam(request,PARAM_FORCE_GROUPING,false); //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); validateLearnerProgress(learnerProgress); @@ -171,7 +171,7 @@ ServletException { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); SortedSet groups = new TreeSet(new GroupComparator()); @@ -209,7 +209,7 @@ ServletException { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); SortedSet groups = new TreeSet(new GroupComparator()); @@ -248,7 +248,7 @@ ServletException { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request,learnerService); Activity groupingActivity = LearningWebUtil.getActivityFromRequest(request,learnerService); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingExportPortfolioServlet.java =================================================================== diff -u -r250486f86b66ac04cece0001879c3dc39c96ed98 -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingExportPortfolioServlet.java (.../GroupingExportPortfolioServlet.java) (revision 250486f86b66ac04cece0001879c3dc39c96ed98) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingExportPortfolioServlet.java (.../GroupingExportPortfolioServlet.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LearnerAction.java =================================================================== diff -u -r63a9aa3781aa91aec33ee6dacebe649d0d0cd0b2 -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LearnerAction.java (.../LearnerAction.java) (revision 63a9aa3781aa91aec33ee6dacebe649d0d0cd0b2) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LearnerAction.java (.../LearnerAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -34,7 +34,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; @@ -106,7 +106,7 @@ * @param learnerService * @return */ - protected FlashMessage handleException(Exception e, String methodKey, ILearnerService learnerService) { + protected FlashMessage handleException(Exception e, String methodKey, ICoreLearnerService learnerService) { log.error("Exception thrown "+methodKey,e); String[] msg = new String[1]; msg[0] = e.getMessage(); @@ -139,7 +139,7 @@ ServletException { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); FlashMessage message = null; try { @@ -204,7 +204,7 @@ ServletException { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); FlashMessage message = null; try { @@ -242,7 +242,7 @@ { //initialize service object - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); FlashMessage message = null; try { @@ -311,7 +311,7 @@ //SessionBean sessionBean = LearningWebUtil.getSessionBean(request,getServlet().getServletContext()); Integer learnerId = LearningWebUtil.getUserId(); - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); Long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID ); LearnerProgressDTO learnerProgress = learnerService.getProgressDTOByLessonId(lessonId, learnerId); @@ -367,7 +367,7 @@ //initialize service object ActivityMapping activityMapping = LearnerServiceProxy.getActivityMapping(this.getServlet().getServletContext()); - ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); //getting requested object according to coming parameters Integer learnerId = LearningWebUtil.getUserId(); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LoadToolActivityAction.java =================================================================== diff -u -r7da79aec2f320705164e3faae07352a54d1de68a -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LoadToolActivityAction.java (.../LoadToolActivityAction.java) (revision 7da79aec2f320705164e3faae07352a54d1de68a) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LoadToolActivityAction.java (.../LoadToolActivityAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -31,7 +31,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.bean.ActivityURL; import org.lamsfoundation.lams.learning.web.form.ActivityForm; @@ -74,9 +74,10 @@ ActivityForm form = (ActivityForm)actionForm; ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(this.getServlet().getServletContext()); - ILearnerService learnerService = getLearnerService(); + ICoreLearnerService learnerService = getLearnerService(); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request,learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); + learnerService.createToolSessionsIfNecessary(activity, learnerProgress); form.setActivityID(activity.getActivityId()); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java =================================================================== diff -u -r493680e80db51839c864498a72867965a89b56ff -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java (.../ActivityMapping.java) (revision 493680e80db51839c864498a72867965a89b56ff) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java (.../ActivityMapping.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -33,8 +33,9 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ForwardingActionForward; import org.apache.struts.action.RedirectingActionForward; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; +import org.lamsfoundation.lams.learning.web.action.ActivityAction; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.ToolActivity; import org.lamsfoundation.lams.lesson.LearnerProgress; @@ -112,7 +113,7 @@ public ActionForward getProgressForward(LearnerProgress progress, boolean redirect, HttpServletRequest request, - ILearnerService learnerService) + ICoreLearnerService learnerService) { ActionForward actionForward = null; @@ -162,6 +163,9 @@ progress, redirect); //setup activity into request for display + Activity realActivity = learnerService.getActivity(progress.getNextActivity().getActivityId()); + request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, realActivity); + LearningWebUtil.putActivityInRequest(request, progress.getNextActivity(), learnerService); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java =================================================================== diff -u -r9bffc1a7278bddba6ffc3c6af493d5bc1faf43f9 -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 9bffc1a7278bddba6ffc3c6af493d5bc1faf43f9) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -28,7 +28,7 @@ import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.action.ActivityAction; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.lesson.LearnerProgress; @@ -72,7 +72,7 @@ * Helper method to retrieve the user data. Gets the id from the user details * in the shared session then retrieves the real user object. */ - public static User getUser(ILearnerService learnerService) + public static User getUser(ICoreLearnerService learnerService) { HttpSession ss = SessionManager.getSession(); UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER); @@ -100,7 +100,7 @@ * If the learner progress id isn't available, then we have to look it up using activity * based on the activity / activity id in the request. */ - public static LearnerProgress getLearnerProgress(HttpServletRequest request, ILearnerService learnerService) { + public static LearnerProgress getLearnerProgress(HttpServletRequest request, ICoreLearnerService learnerService) { LearnerProgress learnerProgress = (LearnerProgress)request.getAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE); if ( learnerProgress != null ) { if ( log.isDebugEnabled() ) { @@ -148,7 +148,7 @@ * @return */ public static Activity getActivityFromRequest(HttpServletRequest request, - ILearnerService learnerService) + ICoreLearnerService learnerService) { Activity activity = (Activity)request.getAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE); @@ -170,7 +170,7 @@ * @param activity */ public static void putActivityInRequest(HttpServletRequest request, Activity activity, - ILearnerService learnerService) + ICoreLearnerService learnerService) { Activity realActivity = learnerService.getActivity(activity.getActivityId()); request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, realActivity); Index: lams_learning/test/java/org/lamsfoundation/lams/learning/export/service/TestExportPortfolioService.java =================================================================== diff -u -reabb1eb30e30ef2d6a8faa2d3471c34e6a619cfc -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/test/java/org/lamsfoundation/lams/learning/export/service/TestExportPortfolioService.java (.../TestExportPortfolioService.java) (revision eabb1eb30e30ef2d6a8faa2d3471c34e6a619cfc) +++ lams_learning/test/java/org/lamsfoundation/lams/learning/export/service/TestExportPortfolioService.java (.../TestExportPortfolioService.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -24,12 +24,8 @@ /* $$Id$$ */ package org.lamsfoundation.lams.learning.export.service; -import java.util.Iterator; -import java.util.Vector; - import org.apache.log4j.Logger; -import org.lamsfoundation.lams.learning.service.ILearnerService; -import org.lamsfoundation.lams.learningdesign.Activity; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learningdesign.dao.ITransitionDAO; import org.lamsfoundation.lams.learningdesign.dao.hibernate.TransitionDAO; import org.lamsfoundation.lams.lesson.LearnerProgress; @@ -57,7 +53,7 @@ //--------------------------------------------------------------------- private static Logger log = Logger.getLogger(TestExportPortfolioService.class); - private ILearnerService learnerService; + private ICoreLearnerService learnerService; private IUserManagementService usermanageService; private ILessonDAO lessonDao; private ILearnerProgressDAO learnerProgressDao; @@ -111,7 +107,7 @@ protected void setUp() throws Exception { super.setUp(); - learnerService = (ILearnerService)this.context.getBean("learnerService"); + learnerService = (ICoreLearnerService)this.context.getBean("learnerService"); usermanageService = (IUserManagementService)this.context.getBean("userManagementService"); lessonDao = (LessonDAO)this.context.getBean("lessonDAO"); learnerProgressDao = (LearnerProgressDAO)this.context.getBean("learnerProgressDAO"); Index: lams_learning/test/java/org/lamsfoundation/lams/learning/service/TestLearnerService.java =================================================================== diff -u -reabb1eb30e30ef2d6a8faa2d3471c34e6a619cfc -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/test/java/org/lamsfoundation/lams/learning/service/TestLearnerService.java (.../TestLearnerService.java) (revision eabb1eb30e30ef2d6a8faa2d3471c34e6a619cfc) +++ lams_learning/test/java/org/lamsfoundation/lams/learning/service/TestLearnerService.java (.../TestLearnerService.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -63,7 +63,7 @@ //--------------------------------------------------------------------- private static Logger log = Logger.getLogger(TestLearnerService.class); - private ILearnerService learnerService; + private ICoreLearnerService learnerService; private IUserManagementService usermanageService; private ILessonDAO lessonDao; private ILearnerProgressDAO learnerProgressDao; @@ -115,7 +115,7 @@ protected void setUp() throws Exception { super.setUp(); - learnerService = (ILearnerService)this.context.getBean("learnerService"); + learnerService = (ICoreLearnerService)this.context.getBean("learnerService"); usermanageService = (IUserManagementService)this.context.getBean("userManagementService"); lessonDao = (LessonDAO)this.context.getBean("lessonDAO"); learnerProgressDao = (LearnerProgressDAO)this.context.getBean("learnerProgressDAO"); Index: lams_learning/test/java/org/lamsfoundation/lams/learning/web/action/TestGateAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/test/java/org/lamsfoundation/lams/learning/web/action/TestGateAction.java (.../TestGateAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/test/java/org/lamsfoundation/lams/learning/web/action/TestGateAction.java (.../TestGateAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -25,10 +25,8 @@ package org.lamsfoundation.lams.learning.web.action; import org.apache.log4j.Logger; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; -import org.lamsfoundation.lams.learningdesign.Activity; -import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -50,7 +48,7 @@ private static final String TEST_LEARNER_ID = "2"; private static final String TEST_LESSON_ID = "2"; - private ILearnerService learnerService; + private ICoreLearnerService learnerService; private static final String TEST_GATE_ACTIVITY_ID = "31"; /** @@ -70,7 +68,7 @@ setConfigFile("/WEB-INF/struts/struts-config.xml"); setRequestPathInfo("/gate.do"); - learnerService = (ILearnerService)this.wac.getBean("learnerService"); + learnerService = (ICoreLearnerService)this.wac.getBean("learnerService"); } /* Index: lams_learning/test/java/org/lamsfoundation/lams/learning/web/action/TestGroupingAction.java =================================================================== diff -u -re5049e0948ac38f849ed086dfa9b8b7dfd8d76ae -r04802eaaf2249d4faf8784f702664d28f46fdebc --- lams_learning/test/java/org/lamsfoundation/lams/learning/web/action/TestGroupingAction.java (.../TestGroupingAction.java) (revision e5049e0948ac38f849ed086dfa9b8b7dfd8d76ae) +++ lams_learning/test/java/org/lamsfoundation/lams/learning/web/action/TestGroupingAction.java (.../TestGroupingAction.java) (revision 04802eaaf2249d4faf8784f702664d28f46fdebc) @@ -26,11 +26,10 @@ import java.util.List; -import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.GroupingActivity; -import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -49,7 +48,7 @@ private static final String TEST_LEARNER_ID = "2"; private static final String TEST_LESSON_ID = "2"; private static Activity groupingActivity; - private ILearnerService learnerService; + private ICoreLearnerService learnerService; /** * @param arg0 * @param arg1 @@ -68,7 +67,7 @@ setConfigFile("/WEB-INF/struts/struts-config.xml"); setRequestPathInfo("/grouping.do"); - learnerService = (ILearnerService)this.wac.getBean("learnerService"); + learnerService = (ICoreLearnerService)this.wac.getBean("learnerService"); } /*