Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== diff -u -r771dd93b9ea84cec2b55db5c66a5d187da0874c0 -r475e17b638d786c744a3d0c46eefb55ac57319ee --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 771dd93b9ea84cec2b55db5c66a5d187da0874c0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 475e17b638d786c744a3d0c46eefb55ac57319ee) @@ -340,75 +340,7 @@ } - - - /** - * persists a candidate answer - * createOptionContent(HttpServletRequest request, Map options, String optionText, - String questionIndex, Map mapGeneralSelectedOptionsContent) - * - * @param request - * @param options - * @param optionText - * @param questionIndex - * @param mapGeneralSelectedOptionsContent - */ - public static void createOptionContent(HttpServletRequest request, Map options, String optionText, - String questionIndex, Map mapGeneralSelectedOptionsContent, IMcService mcService) - { - logger.debug("doing createOptionContent..."); - int optionSize=options.size(); - logger.debug("optionSize:" + optionSize); - logger.debug("optionText:" + optionText); - - String mcQueContentUid=(String)options.get(new Integer(optionSize).toString()); - logger.debug("mcQueContentUid: " + mcQueContentUid); - - boolean isOptionSelected=isOptionSelected(mapGeneralSelectedOptionsContent, optionText, questionIndex); - logger.debug("isOptionSelected: " + isOptionSelected); - - if (mcQueContentUid != null) - { - logger.debug("mcQueContentUid not null: " + mcQueContentUid); - McQueContent mcQueContent= mcService.getMcQueContentByUID(new Long(mcQueContentUid)); - logger.debug("mcQueContent: " + mcQueContent); - - McOptsContent mcOptsContent = mcService.getOptionContentByOptionText(optionText, new Long(mcQueContentUid)); - if (mcOptsContent == null) - { - logger.debug("mcOptsContent null: " + mcOptsContent); - mcOptsContent = new McOptsContent(isOptionSelected, optionText,mcQueContent , new TreeSet()); - mcService.saveMcOptionsContent(mcOptsContent); - logger.debug("persisted mcQueContent: " + mcQueContent); - } - else - { - logger.debug("mcOptsContent not null: " + mcOptsContent); - logger.debug("mcOptsContent already exists: " + mcQueContent); - } - } - else - { - logger.debug("mcQueContentUid null: " + mcQueContentUid); - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("getting existing content with id:" + toolContentId); - McContent mcContent=mcService.retrieveMc(toolContentId); - logger.debug("existing mcContent:" + mcContent); - logger.debug("mcOptsContent is null, get the mcQueContent in an alternative way, use questionIndex: " + questionIndex); - McQueContent mcQueContent=mcService.getQuestionContentByDisplayOrder(new Long(questionIndex), mcContent.getUid()); - logger.debug("exracted mcQueContent:" + mcQueContent); - - if (mcQueContent != null) - { - McOptsContent mcOptsContent = new McOptsContent(isOptionSelected, optionText,mcQueContent , new TreeSet()); - mcService.saveMcOptionsContent(mcOptsContent); - logger.debug("persisted mcQueContent: " + mcQueContent); - } - } - } - - /** * finds whether a candidate answer is selected or not * isOptionSelected(Map mapGeneralSelectedOptionsContent, String optionText, String questionIndex) @@ -465,66 +397,7 @@ - /** - * cleans up authoring http session - * cleanupAuthoringSession(HttpServletRequest request) - * @param request - */ - public static void cleanupAuthoringSession(HttpServletRequest request) - { - request.getSession().removeAttribute(ACTIVE_MODULE); - request.getSession().removeAttribute(DEFAULT_CONTENT_ID); - request.getSession().removeAttribute(SHOW_AUTHORING_TABS); - request.getSession().removeAttribute(TOOL_CONTENT_ID); - request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE); - request.getSession().removeAttribute(LIST_OFFLINEFILES_METADATA); - request.getSession().removeAttribute(LIST_ONLINEFILES_METADATA); - request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); - request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILENAMES); - request.getSession().removeAttribute(EDIT_OPTIONS_MODE); - request.getSession().removeAttribute(IS_REVISITING_USER); - request.getSession().removeAttribute(PASSMARK); - request.getSession().removeAttribute(DEFINE_LATER); - request.getSession().removeAttribute(IS_REVISITING_USER); - request.getSession().removeAttribute(MAP_WEIGHTS); - request.getSession().removeAttribute(DEFINE_LATER_EDIT_ACTIVITY); - //request.getSession().removeAttribute(RICHTEXT_END_LEARNING_MSG); - request.getSession().removeAttribute(RICHTEXT_FEEDBACK_CORRECT); - request.getSession().removeAttribute(RICHTEXT_FEEDBACK_INCORRECT); - request.getSession().removeAttribute(RICHTEXT_TITLE); - request.getSession().removeAttribute(RICHTEXT_INSTRUCTIONS); - request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS); - request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS); - request.getSession().removeAttribute(RETRIES); - request.getSession().removeAttribute(MAP_DEFAULTOPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_DISABLED_QUESTIONS); - request.getSession().removeAttribute(MAP_SELECTED_OPTIONS); - request.getSession().removeAttribute(MAP_FEEDBACK_INCORRECT); - request.getSession().removeAttribute(MAP_FEEDBACK_CORRECT); - request.getSession().removeAttribute(SELECTED_QUESTION); - request.getSession().removeAttribute(SELECTED_QUESTION_INDEX); - request.getSession().removeAttribute(QUESTIONS_WITHNO_OPTIONS); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE); - - /* Preview mode constants*/ - request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER); - request.getSession().removeAttribute(TOTAL_QUESTION_COUNT); - request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); - request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT); - request.getSession().removeAttribute(MAP_OPTIONS_CONTENT); - request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); - request.getSession().removeAttribute(PREVIEW_ONLY); - } - /** * List swapNodes(List listQuestionContentDTO, String questionIndex, String direction) *