Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/Attic/AuthoringAction.java,v diff -u -r1.1.2.2 -r1.1.2.3 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringAction.java 6 Oct 2016 07:24:47 -0000 1.1.2.2 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringAction.java 21 Dec 2016 05:34:04 -0000 1.1.2.3 @@ -24,15 +24,18 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Date; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; @@ -53,10 +56,13 @@ import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.service.VoteApplicationException; import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; +import org.lamsfoundation.lams.tool.vote.util.VoteComparator; import org.lamsfoundation.lams.tool.vote.util.VoteUtils; import org.lamsfoundation.lams.tool.vote.web.form.VoteAuthoringForm; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; @@ -148,7 +154,7 @@ String maxInputs = request.getParameter(VoteAppConstants.MAX_INPUTS); if (maxInputs == null) { - AuthoringAction.logger.info("Since minNomcount is equal to null hence setting it to '0'"); + logger.info("Since minNomcount is equal to null hence setting it to '0'"); maxInputs = "0"; } voteAuthoringForm.setMaxInputs(new Short(maxInputs)); @@ -160,6 +166,7 @@ /** * moves a nomination down in the authoring list */ + @SuppressWarnings("unchecked") public ActionForward moveNominationDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; @@ -172,9 +179,9 @@ List questionDTOs = (List) sessionMap.get(VoteAppConstants.LIST_QUESTION_DTO); - questionDTOs = AuthoringUtil.swapQuestions(questionDTOs, questionIndex, "down"); + questionDTOs = AuthoringAction.swapQuestions(questionDTOs, questionIndex, "down"); - questionDTOs = AuthoringUtil.reorderQuestionDTOs(questionDTOs); + questionDTOs = AuthoringAction.reorderQuestionDTOs(questionDTOs); sessionMap.put(VoteAppConstants.LIST_QUESTION_DTO, questionDTOs); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); @@ -217,6 +224,7 @@ /** * moves a nomination up in the authoring list */ + @SuppressWarnings("unchecked") public ActionForward moveNominationUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; @@ -229,9 +237,9 @@ List questionDTOs = (List) sessionMap.get(VoteAppConstants.LIST_QUESTION_DTO); - questionDTOs = AuthoringUtil.swapQuestions(questionDTOs, questionIndex, "up"); + questionDTOs = AuthoringAction.swapQuestions(questionDTOs, questionIndex, "up"); - questionDTOs = AuthoringUtil.reorderQuestionDTOs(questionDTOs); + questionDTOs = AuthoringAction.reorderQuestionDTOs(questionDTOs); sessionMap.put(VoteAppConstants.LIST_QUESTION_DTO, questionDTOs); @@ -274,6 +282,7 @@ /** * removes a nomination from the authoring list */ + @SuppressWarnings("unchecked") public ActionForward removeNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; @@ -283,7 +292,7 @@ .getAttribute(httpSessionID); String questionIndexToDelete = request.getParameter("questionIndex"); - AuthoringAction.logger.info("Question Index to delete" + questionIndexToDelete); + logger.info("Question Index to delete" + questionIndexToDelete); List questionDTOs = (List) sessionMap.get(VoteAppConstants.LIST_QUESTION_DTO); List listFinalQuestionDTO = new LinkedList<>(); @@ -348,6 +357,7 @@ /** * enables editing a nomination */ + @SuppressWarnings("unchecked") public ActionForward newEditableNominationBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; @@ -358,16 +368,16 @@ .getAttribute(httpSessionID); String questionIndex = request.getParameter("questionIndex"); - AuthoringAction.logger.info("Question Index" + questionIndex); + logger.info("Question Index" + questionIndex); voteAuthoringForm.setEditableNominationIndex(questionIndex); List questionDTOs = (List) sessionMap.get(VoteAppConstants.LIST_QUESTION_DTO); String editableNomination = ""; - Iterator iter = questionDTOs.iterator(); + Iterator iter = questionDTOs.iterator(); while (iter.hasNext()) { VoteQuestionDTO voteQuestionDTO = (VoteQuestionDTO) iter.next(); - String question = voteQuestionDTO.getNomination(); + // String question = voteQuestionDTO.getNomination(); String displayOrder = voteQuestionDTO.getDisplayOrder(); if (displayOrder != null && !displayOrder.equals("")) { @@ -407,11 +417,11 @@ HttpServletResponse response) throws IOException, ServletException { VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - String httpSessionID = voteAuthoringForm.getHttpSessionID(); +// String httpSessionID = voteAuthoringForm.getHttpSessionID(); +// +// SessionMap sessionMap = (SessionMap) request.getSession() +// .getAttribute(httpSessionID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(httpSessionID); - String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); voteAuthoringForm.setContentFolderID(contentFolderID); @@ -436,11 +446,12 @@ /** * enables adding a new nomination to the authoring nominations list */ + @SuppressWarnings("unchecked") public ActionForward addSingleNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + //IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); String httpSessionID = voteAuthoringForm.getHttpSessionID(); @@ -463,7 +474,7 @@ int listSize = questionDTOs.size(); if (newNomination != null && newNomination.length() > 0) { - boolean duplicates = AuthoringUtil.checkDuplicateNominations(questionDTOs, newNomination); + boolean duplicates = AuthoringAction.checkDuplicateNominations(questionDTOs, newNomination); if (!duplicates) { VoteQuestionDTO voteQuestionDTO = new VoteQuestionDTO(); @@ -503,6 +514,7 @@ /** * saves a new or updated nomination in the authoring nominations list */ + @SuppressWarnings("unchecked") public ActionForward saveSingleNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { @@ -520,7 +532,7 @@ String editNominationBoxRequest = request.getParameter("editNominationBoxRequest"); - AuthoringAction.logger.info("Edit nomination box request" + editNominationBoxRequest); + logger.info("Edit nomination box request" + editNominationBoxRequest); VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); @@ -536,15 +548,15 @@ if (newNomination != null && newNomination.length() > 0) { if (editNominationBoxRequest != null && editNominationBoxRequest.equals("false")) { - boolean duplicates = AuthoringUtil.checkDuplicateNominations(questionDTOs, newNomination); + boolean duplicates = AuthoringAction.checkDuplicateNominations(questionDTOs, newNomination); if (!duplicates) { VoteQuestionDTO voteQuestionDTO = null; - Iterator iter = questionDTOs.iterator(); + Iterator iter = questionDTOs.iterator(); while (iter.hasNext()) { voteQuestionDTO = (VoteQuestionDTO) iter.next(); - String question = voteQuestionDTO.getNomination(); + //String question = voteQuestionDTO.getNomination(); String displayOrder = voteQuestionDTO.getDisplayOrder(); if (displayOrder != null && !displayOrder.equals("")) { @@ -558,21 +570,21 @@ voteQuestionDTO.setQuestion(newNomination); voteQuestionDTO.setDisplayOrder(editableNominationIndex); - questionDTOs = AuthoringUtil.reorderUpdateListQuestionDTO(questionDTOs, voteQuestionDTO, + questionDTOs = AuthoringAction.reorderUpdateListQuestionDTO(questionDTOs, voteQuestionDTO, editableNominationIndex); } else { - AuthoringAction.logger.info("Duplicate question entry therefore not adding"); + logger.info("Duplicate question entry therefore not adding"); //duplicate question entry, not adding } } else { - AuthoringAction.logger.info("In Request for Save and Edit"); + logger.info("In Request for Save and Edit"); //request for edit and save VoteQuestionDTO voteQuestionDTO = null; - Iterator iter = questionDTOs.iterator(); + Iterator iter = questionDTOs.iterator(); while (iter.hasNext()) { voteQuestionDTO = (VoteQuestionDTO) iter.next(); - String question = voteQuestionDTO.getNomination(); + // String question = voteQuestionDTO.getNomination(); String displayOrder = voteQuestionDTO.getDisplayOrder(); if (displayOrder != null && !displayOrder.equals("")) { @@ -586,11 +598,11 @@ voteQuestionDTO.setNomination(newNomination); voteQuestionDTO.setDisplayOrder(editableNominationIndex); - questionDTOs = AuthoringUtil.reorderUpdateListQuestionDTO(questionDTOs, voteQuestionDTO, + questionDTOs = AuthoringAction.reorderUpdateListQuestionDTO(questionDTOs, voteQuestionDTO, editableNominationIndex); } } else { - AuthoringAction.logger.info("newNomination entry is blank,therefore not adding"); + logger.info("newNomination entry is blank,therefore not adding"); //entry blank, not adding } @@ -623,6 +635,7 @@ /** * persists the nominations list and other user selections in the db. */ + @SuppressWarnings("unchecked") public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { @@ -647,28 +660,28 @@ || voteAuthoringForm.getAssignedDataFlowObject() == 0)) { ActionMessage error = new ActionMessage("nominations.none.submitted"); errors.add(ActionMessages.GLOBAL_MESSAGE, error); - AuthoringAction.logger.error("Nominations not submitted"); + logger.error("Nominations not submitted"); } String maxNomCount = voteAuthoringForm.getMaxNominationCount(); if (maxNomCount != null) { if (maxNomCount.equals("0") || maxNomCount.contains("-")) { ActionMessage error = new ActionMessage("maxNomination.invalid"); errors.add(ActionMessages.GLOBAL_MESSAGE, error); - AuthoringAction.logger.error("Maximum votes in Advance tab is invalid"); + logger.error("Maximum votes in Advance tab is invalid"); } try { - int intMaxNomCount = new Integer(maxNomCount).intValue(); + //int intMaxNomCount = new Integer(maxNomCount).intValue(); } catch (NumberFormatException e) { ActionMessage error = new ActionMessage("maxNomination.invalid"); errors.add(ActionMessages.GLOBAL_MESSAGE, error); - AuthoringAction.logger.error("Maximum votes in Advance tab is invalid"); + logger.error("Maximum votes in Advance tab is invalid"); } } //verifyDuplicateNominations - Map mapQuestion = AuthoringUtil.extractMapQuestion(questionDTOs); + Map mapQuestion = AuthoringAction.extractMapQuestion(questionDTOs); int optionCount = 0; boolean isNominationsDuplicate = false; for (long i = 1; i <= VoteAppConstants.MAX_OPTION_COUNT; i++) { @@ -693,7 +706,7 @@ if (isNominationsDuplicate == true) { ActionMessage error = new ActionMessage("nominations.duplicate"); errors.add(ActionMessages.GLOBAL_MESSAGE, error); - AuthoringAction.logger.error("There are duplicate nomination entries."); + logger.error("There are duplicate nomination entries."); } VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); @@ -740,7 +753,7 @@ VoteContent voteContentTest = voteService.getVoteContent(new Long(strToolContentID)); if (!errors.isEmpty()) { saveErrors(request, errors); - AuthoringAction.logger.error("errors saved: " + errors); + logger.error("errors saved: " + errors); } if (errors.isEmpty()) { @@ -777,7 +790,7 @@ } // store content - VoteContent voteContent = AuthoringUtil.saveOrUpdateVoteContent(voteService, voteAuthoringForm, request, + VoteContent voteContent = AuthoringAction.saveOrUpdateVoteContent(voteService, voteAuthoringForm, request, voteContentTest, strToolContentID); //store questions @@ -788,7 +801,7 @@ //reOrganizeDisplayOrder List sortedQuestions = voteService.getAllQuestionsSorted(voteContent.getUid().longValue()); - Iterator iter = sortedQuestions.iterator(); + Iterator iter = sortedQuestions.iterator(); while (iter.hasNext()) { VoteQueContent question = (VoteQueContent) iter.next(); @@ -991,13 +1004,13 @@ defaultContentID = voteService.getToolDefaultContentIdBySignature(VoteAppConstants.MY_SIGNATURE); if (defaultContentID == 0) { VoteUtils.cleanUpUserExceptions(request); - AuthoringAction.logger.error("Exception occured: No default content"); + logger.error("Exception occured: No default content"); saveInRequestError(request, "error.defaultContent.notSetup"); return mapping.findForward(VoteAppConstants.ERROR_LIST); } } catch (Exception e) { VoteUtils.cleanUpUserExceptions(request); - AuthoringAction.logger.error("error getting the default content id: " + e.getMessage()); + logger.error("error getting the default content id: " + e.getMessage()); saveInRequestError(request, "error.defaultContent.notSetup"); return mapping.findForward(VoteAppConstants.ERROR_LIST); } @@ -1007,14 +1020,14 @@ VoteContent voteContent = voteService.getVoteContent(new Long(defaultContentID)); if (voteContent == null) { VoteUtils.cleanUpUserExceptions(request); - AuthoringAction.logger.error("Exception occured: No default content"); + logger.error("Exception occured: No default content"); saveInRequestError(request, "error.defaultContent.notSetup"); return mapping.findForward(VoteAppConstants.ERROR_LIST); } } catch (Exception e) { - AuthoringAction.logger.error("other problems: " + e); + logger.error("other problems: " + e); VoteUtils.cleanUpUserExceptions(request); - AuthoringAction.logger.error("Exception occured: No default question content"); + logger.error("Exception occured: No default question content"); saveInRequestError(request, "error.defaultContent.notSetup"); return mapping.findForward(VoteAppConstants.ERROR_LIST); } @@ -1044,15 +1057,15 @@ String maxNomcount = voteContent.getMaxNominationCount(); if (maxNomcount.equals("")) { - AuthoringAction.logger.info("Since minNomcount is equal to null hence setting it to '0'"); + logger.info("Since minNomcount is equal to null hence setting it to '0'"); maxNomcount = "0"; } voteAuthoringForm.setMaxNominationCount(maxNomcount); voteGeneralAuthoringDTO.setMaxNominationCount(maxNomcount); String minNomcount = voteContent.getMinNominationCount(); if ((minNomcount == null) || minNomcount.equals("")) { - AuthoringAction.logger.info("Since minNomcount is equal to null hence setting it to '0'"); + logger.info("Since minNomcount is equal to null hence setting it to '0'"); minNomcount = "0"; } voteAuthoringForm.setMinNominationCount(minNomcount); @@ -1068,8 +1081,272 @@ private void saveInRequestError(HttpServletRequest request, String message) { ActionMessages errors = new ActionMessages(); errors.add(Globals.ERROR_KEY, new ActionMessage(message)); - AuthoringAction.logger.error("add " + message + " to ActionMessages:"); + logger.error("add " + message + " to ActionMessages:"); saveErrors(request, errors); } + protected static List swapQuestions(List questionDTOs, String questionIndex, + String direction) { + + int intQuestionIndex = new Integer(questionIndex).intValue(); + int intOriginalQuestionIndex = intQuestionIndex; + + int replacedQuestionIndex = 0; + if (direction.equals("down")) { + replacedQuestionIndex = ++intQuestionIndex; + } else { + replacedQuestionIndex = --intQuestionIndex; + } + + VoteQuestionDTO mainQuestion = AuthoringAction.getQuestionAtDisplayOrder(questionDTOs, + intOriginalQuestionIndex); + + VoteQuestionDTO replacedQuestion = AuthoringAction.getQuestionAtDisplayOrder(questionDTOs, + replacedQuestionIndex); + + List newQuestionDtos = new LinkedList(); + + Iterator iter = questionDTOs.iterator(); + while (iter.hasNext()) { + VoteQuestionDTO questionDTO = iter.next(); + VoteQuestionDTO tempQuestion = new VoteQuestionDTO(); + + if (!questionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString()) + && !questionDTO.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { + logger.info("Normal Copy"); + // normal copy + tempQuestion = questionDTO; + + } else if (questionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) { + // move type 1 + logger.info("Move type 1"); + tempQuestion = replacedQuestion; + + } else if (questionDTO.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { + // move type 1 + logger.info("Move type 1"); + tempQuestion = mainQuestion; + } + + newQuestionDtos.add(tempQuestion); + } + + return newQuestionDtos; + } + + protected static VoteQuestionDTO getQuestionAtDisplayOrder(List questionDTOs, + int intOriginalQuestionIndex) { + + Iterator iter = questionDTOs.iterator(); + while (iter.hasNext()) { + VoteQuestionDTO voteQuestionDTO = iter.next(); + + if (new Integer(intOriginalQuestionIndex).toString().equals(voteQuestionDTO.getDisplayOrder())) { + return voteQuestionDTO; + } + } + return null; + } + + protected static List reorderQuestionDTOs(List listQuestionDTO) { + List listFinalQuestionDTO = new LinkedList(); + + int queIndex = 0; + Iterator iter = listQuestionDTO.iterator(); + while (iter.hasNext()) { + VoteQuestionDTO voteQuestionDTO = iter.next(); + + String question = voteQuestionDTO.getNomination(); + + // String displayOrder = voteQuestionDTO.getDisplayOrder(); + + if (question != null && !question.equals("")) { + ++queIndex; + + voteQuestionDTO.setNomination(question); + voteQuestionDTO.setDisplayOrder(new Integer(queIndex).toString()); + + listFinalQuestionDTO.add(voteQuestionDTO); + } + } + + return listFinalQuestionDTO; + } + + @SuppressWarnings("rawtypes") + public static boolean checkDuplicateNominations(List listQuestionDTO, String newQuestion) { + if (logger.isDebugEnabled()) { + logger.debug("New Question" + newQuestion); + } + + Map mapQuestion = AuthoringAction.extractMapQuestion(listQuestionDTO); + + Iterator itMap = mapQuestion.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry) itMap.next(); + if (pairs.getValue() != null && !pairs.getValue().equals("")) { + + if (pairs.getValue().equals(newQuestion)) { + return true; + } + } + } + return false; + } + + protected static Map extractMapQuestion(List listQuestionDTO) { + Map mapQuestion = new TreeMap(new VoteComparator()); + + Iterator iter = listQuestionDTO.iterator(); + int queIndex = 0; + while (iter.hasNext()) { + VoteQuestionDTO voteQuestionDTO = (VoteQuestionDTO) iter.next(); + + queIndex++; + mapQuestion.put(new Integer(queIndex).toString(), voteQuestionDTO.getNomination()); + } + return mapQuestion; + } + + protected static List reorderUpdateListQuestionDTO(List listQuestionDTO, + VoteQuestionDTO voteQuestionDTONew, String editableQuestionIndex) { + + List listFinalQuestionDTO = new LinkedList(); + + int queIndex = 0; + Iterator iter = listQuestionDTO.iterator(); + while (iter.hasNext()) { + VoteQuestionDTO voteQuestionDTO = (VoteQuestionDTO) iter.next(); + + ++queIndex; + String question = voteQuestionDTO.getNomination(); + + String displayOrder = voteQuestionDTO.getDisplayOrder(); + + if (displayOrder.equals(editableQuestionIndex)) { + voteQuestionDTO.setNomination(voteQuestionDTONew.getNomination()); + voteQuestionDTO.setDisplayOrder(voteQuestionDTONew.getDisplayOrder()); + + listFinalQuestionDTO.add(voteQuestionDTO); + } else { + voteQuestionDTO.setNomination(question); + voteQuestionDTO.setDisplayOrder(displayOrder); + + listFinalQuestionDTO.add(voteQuestionDTO); + } + } + + return listFinalQuestionDTO; + } + + protected static VoteContent saveOrUpdateVoteContent(IVoteService voteService, VoteAuthoringForm voteAuthoringForm, + HttpServletRequest request, VoteContent voteContent, String strToolContentID) { + if (logger.isDebugEnabled()) { + logger.debug("ToolContentID" + strToolContentID); + } + UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); + + String richTextTitle = request.getParameter(VoteAppConstants.TITLE); + String richTextInstructions = request.getParameter(VoteAppConstants.INSTRUCTIONS); + + String lockOnFinish = request.getParameter("lockOnFinish"); + + String allowTextEntry = request.getParameter("allowText"); + + String showResults = request.getParameter("showResults"); + + String maxInputs = request.getParameter("maxInputs"); + + String useSelectLeaderToolOuput = request.getParameter("useSelectLeaderToolOuput"); + + String reflect = request.getParameter(VoteAppConstants.REFLECT); + + String reflectionSubject = voteAuthoringForm.getReflectionSubject(); + + String maxNomcount = voteAuthoringForm.getMaxNominationCount(); + + String minNomcount = voteAuthoringForm.getMinNominationCount(); + + boolean lockOnFinishBoolean = false; + boolean allowTextEntryBoolean = false; + boolean useSelectLeaderToolOuputBoolean = false; + boolean reflectBoolean = false; + boolean showResultsBoolean = false; + short maxInputsShort = 0; + + if (lockOnFinish != null && lockOnFinish.equalsIgnoreCase("1")) { + lockOnFinishBoolean = true; + } + + if (allowTextEntry != null && allowTextEntry.equalsIgnoreCase("1")) { + allowTextEntryBoolean = true; + } + + if (useSelectLeaderToolOuput != null && useSelectLeaderToolOuput.equalsIgnoreCase("1")) { + useSelectLeaderToolOuputBoolean = true; + } + + if (reflect != null && reflect.equalsIgnoreCase("1")) { + reflectBoolean = true; + } + + if (showResults != null && showResults.equalsIgnoreCase("1")) { + showResultsBoolean = true; + } + + if (maxInputs != null && !"0".equals(maxInputs)) { + maxInputsShort = Short.parseShort(maxInputs); + } + + long userId = 0; + if (toolUser != null) { + userId = toolUser.getUserID().longValue(); + } else { + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if (user != null) { + userId = user.getUserID().longValue(); + } else { + userId = 0; + } + } + + boolean newContent = false; + if (voteContent == null) { + voteContent = new VoteContent(); + newContent = true; + } + + voteContent.setVoteContentId(new Long(strToolContentID)); + voteContent.setTitle(richTextTitle); + voteContent.setInstructions(richTextInstructions); + voteContent.setUpdateDate(new Date(System.currentTimeMillis())); + /** keep updating this one */ + voteContent.setCreatedBy(userId); + /** make sure we are setting the userId from the User object above */ + + voteContent.setLockOnFinish(lockOnFinishBoolean); + voteContent.setAllowText(allowTextEntryBoolean); + voteContent.setShowResults(showResultsBoolean); + voteContent.setUseSelectLeaderToolOuput(useSelectLeaderToolOuputBoolean); + voteContent.setReflect(reflectBoolean); + voteContent.setMaxNominationCount(maxNomcount); + voteContent.setMinNominationCount(minNomcount); + + voteContent.setReflectionSubject(reflectionSubject); + + voteContent.setMaxExternalInputs(maxInputsShort); + + if (newContent) { + logger.info("In New Content"); + voteService.saveVoteContent(voteContent); + } else { + voteService.updateVote(voteContent); + } + + voteContent = voteService.getVoteContent(new Long(strToolContentID)); + + return voteContent; + } + } Fisheye: Tag 1.32.2.4 refers to a dead (removed) revision in file `lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/Attic/LearningAction.java,v diff -u -r1.1.2.3 -r1.1.2.4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningAction.java 13 Dec 2016 22:59:14 -0000 1.1.2.3 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningAction.java 21 Dec 2016 05:34:04 -0000 1.1.2.4 @@ -120,7 +120,7 @@ repopulateRequestParameters(request, voteLearningForm); String toolSessionID = request.getParameter(TOOL_SESSION_ID); - LearningAction.logger.info("Tool session ID" + toolSessionID); + logger.info("Tool session ID" + toolSessionID); voteLearningForm.setToolSessionID(toolSessionID); String userID = request.getParameter(USER_ID); @@ -181,11 +181,11 @@ repopulateRequestParameters(request, voteLearningForm); String toolSessionID = request.getParameter(TOOL_SESSION_ID); - LearningAction.logger.info("Tool session id :" + toolSessionID); + logger.info("Tool session id :" + toolSessionID); voteLearningForm.setToolSessionID(toolSessionID); String userID = request.getParameter(USER_ID); - LearningAction.logger.info("User id :" + userID); + logger.info("User id :" + userID); voteLearningForm.setUserID(userID); String revisitingUser = request.getParameter(REVISITING_USER); @@ -204,10 +204,10 @@ long userId = toolUser.getUserID().longValue(); VoteQueUsr voteQueUsr = voteService.getUserByUserId(userId); - List attempts = voteService.getAttemptsForUser(voteQueUsr.getUid()); + List attempts = voteService.getAttemptsForUser(voteQueUsr.getUid()); - Map mapQuestionsContent = new TreeMap(new VoteComparator()); - Iterator listIterator = attempts.iterator(); + Map mapQuestionsContent = new TreeMap(new VoteComparator()); + Iterator listIterator = attempts.iterator(); int order = 0; while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); @@ -220,7 +220,7 @@ request.setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapQuestionsContent); } else { //this is not a revisiting user - LearningAction.logger.info("If not a revisiting user"); + logger.info("If not a revisiting user"); } voteLearningForm.resetCommands(); @@ -243,11 +243,11 @@ repopulateRequestParameters(request, voteLearningForm); String toolSessionID = request.getParameter(TOOL_SESSION_ID); - LearningAction.logger.info("Tool session id:" + toolSessionID); + logger.info("Tool session id:" + toolSessionID); voteLearningForm.setToolSessionID(toolSessionID); String userID = request.getParameter(USER_ID); - LearningAction.logger.info("User id:" + userID); + logger.info("User id:" + userID); voteLearningForm.setUserID(userID); String revisitingUser = request.getParameter(REVISITING_USER); @@ -294,12 +294,12 @@ repopulateRequestParameters(request, voteLearningForm); String toolSessionID = request.getParameter(TOOL_SESSION_ID); - LearningAction.logger.info("Tool Session id :" + toolSessionID); + logger.info("Tool Session id :" + toolSessionID); voteLearningForm.setToolSessionID(toolSessionID); VoteSession voteSession = voteService.getSessionBySessionId(new Long(toolSessionID)); String userID = request.getParameter(USER_ID); - LearningAction.logger.info("User id:" + userID); + logger.info("User id:" + userID); voteLearningForm.setUserID(userID); VoteQueUsr voteQueUsr = voteService.getVoteUserBySession(new Long(userID), voteSession.getUid()); @@ -331,17 +331,17 @@ try { nextUrl = voteService.leaveToolSession(new Long(toolSessionID), new Long(userID)); } catch (DataMissingException e) { - LearningAction.logger.error("failure getting nextUrl: " + e); + logger.error("failure getting nextUrl: " + e); voteLearningForm.resetCommands(); //throw new ServletException(e); return (mapping.findForward(LEARNING_STARTER)); } catch (ToolException e) { - LearningAction.logger.error("failure getting nextUrl: " + e); + logger.error("failure getting nextUrl: " + e); voteLearningForm.resetCommands(); //throw new ServletException(e); return (mapping.findForward(LEARNING_STARTER)); } catch (Exception e) { - LearningAction.logger.error("unknown exception getting nextUrl: " + e); + logger.error("unknown exception getting nextUrl: " + e); voteLearningForm.resetCommands(); //throw new ServletException(e); return (mapping.findForward(LEARNING_STARTER)); @@ -366,11 +366,11 @@ repopulateRequestParameters(request, voteLearningForm); String toolSessionID = request.getParameter(TOOL_SESSION_ID); - LearningAction.logger.info("Tool session id:" + toolSessionID); + logger.info("Tool session id:" + toolSessionID); voteLearningForm.setToolSessionID(toolSessionID); String userID = request.getParameter(USER_ID); - LearningAction.logger.info("User id:" + userID); + logger.info("User id:" + userID); voteLearningForm.setUserID(userID); String maxNominationCount = request.getParameter(MAX_NOMINATION_COUNT); @@ -408,7 +408,7 @@ voteLearningForm.setMaxNominationCountReached(new Boolean(true).toString()); voteGeneralLearnerFlowDTO.setMaxNominationCountReached(new Boolean(true).toString()); persistInRequestError(request, "error.maxNominationCount.reached"); - LearningAction.logger.error("You have selected too many nominations."); + logger.error("You have selected too many nominations."); return (mapping.findForward(LOAD_LEARNER)); } @@ -447,15 +447,15 @@ } if ((mapGeneralCheckedOptionsContent.size() == 0 && (userEntryAvailable == true))) { - Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); + Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); if (userEntry.length() > 0) { voteService.createAttempt(user, mapLeanerCheckedOptionsContent, userEntry, session, voteContentUid); } } if ((mapGeneralCheckedOptionsContent.size() > 0) && (userEntryAvailable == true)) { - Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); + Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); if (userEntry.length() > 0) { voteService.createAttempt(user, mapLeanerCheckedOptionsContent, userEntry, session, voteContentUid); @@ -517,7 +517,7 @@ Map mapQuestionsContent = voteService.buildQuestionMap(voteContent, null); request.setAttribute(MAP_QUESTION_CONTENT_LEARNER, mapQuestionsContent); - Map mapGeneralCheckedOptionsContent = new TreeMap(new VoteComparator()); + Map mapGeneralCheckedOptionsContent = new TreeMap(new VoteComparator()); request.setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapGeneralCheckedOptionsContent); voteLearningForm.setUserEntry(""); @@ -541,7 +541,7 @@ VoteSession session = voteService.getSessionBySessionId(toolSessionId); VoteQueUsr leader = session.getGroupLeader(); - LearningAction.logger.info("Leader :" + leader); + logger.info("Leader :" + leader); boolean isLeaderResponseFinalized = leader.isResponseFinalised(); @@ -560,15 +560,15 @@ IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); String toolSessionID = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); - LearningAction.logger.info("Tool Session Id" + toolSessionID); + logger.info("Tool Session Id" + toolSessionID); voteLearningForm.setToolSessionID(toolSessionID); String userID = request.getParameter("userID"); - LearningAction.logger.info("User Id:" + userID); + logger.info("User Id:" + userID); voteLearningForm.setUserID(userID); String reflectionEntry = request.getParameter(ENTRY_TEXT); - LearningAction.logger.info("reflection entry: " + reflectionEntry); + logger.info("reflection entry: " + reflectionEntry); voteService.createNotebookEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(userID), reflectionEntry); @@ -583,20 +583,20 @@ IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); String toolSessionID = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); - LearningAction.logger.info("toolSessionID:" + toolSessionID); + logger.info("toolSessionID:" + toolSessionID); VoteSession voteSession = voteService.getSessionBySessionId(new Long(toolSessionID)); VoteContent voteContent = voteSession.getVoteContent(); VoteGeneralLearnerFlowDTO voteGeneralLearnerFlowDTO = new VoteGeneralLearnerFlowDTO(); voteGeneralLearnerFlowDTO.setActivityTitle(voteContent.getTitle()); - String reflectionSubject = voteContent.getReflectionSubject(); + //String reflectionSubject = voteContent.getReflectionSubject(); //reflectionSubject = VoteUtils.replaceNewLines(reflectionSubject); voteGeneralLearnerFlowDTO.setReflectionSubject(voteContent.getReflectionSubject()); String userID = request.getParameter("userID"); - LearningAction.logger.info("User Id :" + userID); + logger.info("User Id :" + userID); voteLearningForm.setUserID(userID); NotebookEntry notebookEntry = voteService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, @@ -658,8 +658,7 @@ String groupLeaderName = request.getParameter(ATTR_GROUP_LEADER_NAME); voteLearningForm.setGroupLeaderName(groupLeaderName); - // will be null if submission deadline is passed - boolean isUserLeader = WebUtil.readBooleanParam(request, "userLeader", false); + boolean isUserLeader = WebUtil.readBooleanParam(request, "userLeader"); voteLearningForm.setIsUserLeader(isUserLeader); } @@ -708,7 +707,7 @@ if (voteSession == null) { VoteUtils.cleanUpUserExceptions(request); - LearningAction.logger.error("error: The tool expects voteSession."); + logger.error("error: The tool expects voteSession."); return mapping.findForward(VoteAppConstants.ERROR_LIST); } @@ -719,7 +718,7 @@ VoteContent voteContent = voteSession.getVoteContent(); if (voteContent == null) { VoteUtils.cleanUpUserExceptions(request); - LearningAction.logger.error("error: The tool expects voteContent."); + logger.error("error: The tool expects voteContent."); persistInRequestError(request, "error.content.doesNotExist"); return mapping.findForward(VoteAppConstants.ERROR_LIST); } @@ -868,7 +867,8 @@ voteGeneralLearnerFlowDTO.setReportViewOnly(new Boolean(true).toString()); } - Set userAttempts = voteService.getAttemptsForUserAndSessionUseOpenAnswer(user.getUid(), sessionUid); + Set userAttempts = voteService.getAttemptsForUserAndSessionUseOpenAnswer(user.getUid(), + sessionUid); request.setAttribute(VoteAppConstants.LIST_GENERAL_CHECKED_OPTIONS_CONTENT, userAttempts); voteService.prepareChartData(request, voteContent.getVoteContentId(), voteSession.getUid(), @@ -902,15 +902,15 @@ */ private void putMapQuestionsContentIntoRequest(HttpServletRequest request, IVoteService voteService, VoteQueUsr user) { - List attempts = null; + List attempts = null; if (user != null) { attempts = voteService.getAttemptsForUser(user.getUid()); } - Map localMapQuestionsContent = new TreeMap(new VoteComparator()); + Map localMapQuestionsContent = new TreeMap(new VoteComparator()); if (attempts != null) { - Iterator listIterator = attempts.iterator(); + Iterator listIterator = attempts.iterator(); int order = 0; while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); @@ -944,7 +944,7 @@ protected void setupAttributes(HttpServletRequest request, VoteContent voteContent, VoteLearningForm voteLearningForm, VoteGeneralLearnerFlowDTO voteGeneralLearnerFlowDTO) { - Map mapGeneralCheckedOptionsContent = new TreeMap(new VoteComparator()); + Map mapGeneralCheckedOptionsContent = new TreeMap(new VoteComparator()); request.setAttribute(VoteAppConstants.MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapGeneralCheckedOptionsContent); voteLearningForm.setActivityTitle(voteContent.getTitle()); @@ -981,7 +981,7 @@ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); if (user != null && user.getUserID() != null) { userID = user.getUserID().toString(); - LearningAction.logger.info("User Id : " + userID); + logger.info("User Id : " + userID); voteLearningForm.setUserID(userID); } } @@ -994,7 +994,7 @@ if (strToolSessionId == null || strToolSessionId.length() == 0) { VoteUtils.cleanUpUserExceptions(request); // persistInRequestError(request, "error.toolSessionId.required"); - LearningAction.logger.error("error.toolSessionId.required"); + logger.error("error.toolSessionId.required"); return mapping.findForward(VoteAppConstants.ERROR_LIST); } else { try { @@ -1003,7 +1003,7 @@ } catch (NumberFormatException e) { VoteUtils.cleanUpUserExceptions(request); // persistInRequestError(request, "error.sessionId.numberFormatException"); - LearningAction.logger.error("add error.sessionId.numberFormatException to ActionMessages."); + logger.error("add error.sessionId.numberFormatException to ActionMessages."); return mapping.findForward(VoteAppConstants.ERROR_LIST); } } @@ -1013,13 +1013,13 @@ if (mode == null || mode.length() == 0) { VoteUtils.cleanUpUserExceptions(request); - LearningAction.logger.error("mode missing: "); + logger.error("mode missing: "); return mapping.findForward(VoteAppConstants.ERROR_LIST); } if (!mode.equals("learner") && !mode.equals("teacher") && !mode.equals("author")) { VoteUtils.cleanUpUserExceptions(request); - LearningAction.logger.error("mode invalid: "); + logger.error("mode invalid: "); return mapping.findForward(VoteAppConstants.ERROR_LIST); } voteLearningForm.setLearningMode(mode); @@ -1061,7 +1061,7 @@ String userName = toolUser.getLogin(); String fullName = toolUser.getFirstName() + " " + toolUser.getLastName(); - user = new VoteQueUsr(userId, userName, fullName, session, new TreeSet()); + user = new VoteQueUsr(userId, userName, fullName, session, new TreeSet()); voteService.createVoteQueUsr(user); } @@ -1072,9 +1072,8 @@ VoteSession session = voteService.getSessionBySessionId(new Long(toolSessionId)); VoteQueUsr user = voteService.getVoteUserBySession(new Long(userId.intValue()), session.getUid()); if (user == null) { - LearningAction.logger - .error("Unable to find specified user for Vote activity. Screens are likely to fail. SessionId=" - + new Long(toolSessionId) + " UserId=" + userId); + logger.error("Unable to find specified user for Vote activity. Screens are likely to fail. SessionId=" + + new Long(toolSessionId) + " UserId=" + userId); } return user; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/Attic/MonitoringAction.java,v diff -u -r1.1.2.4 -r1.1.2.5 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringAction.java 16 Dec 2016 09:26:47 -0000 1.1.2.4 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringAction.java 21 Dec 2016 05:34:04 -0000 1.1.2.5 @@ -27,8 +27,10 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.SortedSet; import java.util.TimeZone; +import java.util.TreeMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -52,13 +54,15 @@ import org.lamsfoundation.lams.tool.vote.dto.VoteGeneralAuthoringDTO; import org.lamsfoundation.lams.tool.vote.dto.VoteGeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.vote.dto.VoteGeneralMonitoringDTO; +import org.lamsfoundation.lams.tool.vote.dto.VoteMonitoredUserDTO; import org.lamsfoundation.lams.tool.vote.dto.VoteQuestionDTO; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.service.VoteApplicationException; import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; +import org.lamsfoundation.lams.tool.vote.util.VoteComparator; import org.lamsfoundation.lams.tool.vote.util.VoteUtils; import org.lamsfoundation.lams.tool.vote.web.form.VoteMonitoringForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -101,7 +105,7 @@ IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); Long currentUid = WebUtil.readLongParam(request, "currentUid"); - MonitoringAction.logger.info("Current Uid" + currentUid); + logger.info("Current Uid" + currentUid); VoteUsrAttempt voteUsrAttempt = voteService.getAttemptByUID(currentUid); @@ -133,7 +137,7 @@ voteMonitoringForm.setVoteService(voteService); VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - MonitoringUtil.repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); + MonitoringAction.repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); Long questionUid = WebUtil.readLongParam(request, VoteAppConstants.ATTR_QUESTION_UID, false); Long sessionUid = WebUtil.readLongParam(request, VoteAppConstants.ATTR_SESSION_UID, true); @@ -155,7 +159,7 @@ Long sessionUid = WebUtil.readLongParam(request, VoteAppConstants.ATTR_SESSION_UID, true); if (sessionUid == 0L) { sessionUid = null; - MonitoringAction.logger.info("Setting sessionUid to null"); + logger.info("Setting sessionUid to null"); } Long questionUid = WebUtil.readLongParam(request, VoteAppConstants.ATTR_QUESTION_UID, false); @@ -256,7 +260,7 @@ Long sessionUid = WebUtil.readLongParam(request, VoteAppConstants.ATTR_SESSION_UID, true); if (sessionUid == 0L) { - MonitoringAction.logger.info("Setting sessionUid to null"); + logger.info("Setting sessionUid to null"); sessionUid = null; } @@ -322,7 +326,7 @@ HttpServletResponse response) throws IOException, ServletException, ToolException { IVoteService VoteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - String uid = request.getParameter("uid"); + //String uid = request.getParameter("uid"); String userId = request.getParameter("userId"); @@ -352,7 +356,7 @@ * @param request * @param response * @return - * @throws IOException + * @throws IOException */ public ActionForward setSubmissionDeadline(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { @@ -404,12 +408,12 @@ /* we have made sure TOOL_CONTENT_ID is passed */ String toolContentID = voteMonitoringForm.getToolContentID(); - MonitoringAction.logger.warn("Make sure ToolContentId is passed" + toolContentID); + logger.warn("Make sure ToolContentId is passed" + toolContentID); VoteContent voteContent = voteService.getVoteContent(new Long(toolContentID)); if (voteContent == null) { VoteUtils.cleanUpUserExceptions(request); - MonitoringAction.logger.error("Vote Content does not exist"); + logger.error("Vote Content does not exist"); voteGeneralMonitoringDTO.setUserExceptionContentDoesNotExist(Boolean.TRUE.toString()); return (mapping.findForward(VoteAppConstants.ERROR_LIST)); } @@ -444,7 +448,8 @@ Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(teacherTimeZone, submissionDeadline); request.setAttribute(VoteAppConstants.ATTR_SUBMISSION_DEADLINE, tzSubmissionDeadline.getTime()); // use the unconverted time, as convertToStringForJSON() does the timezone conversion if needed - request.setAttribute(VoteAppConstants.ATTR_SUBMISSION_DEADLINE_DATESTRING, DateUtil.convertToStringForJSON(submissionDeadline, request.getLocale())); + request.setAttribute(VoteAppConstants.ATTR_SUBMISSION_DEADLINE_DATESTRING, + DateUtil.convertToStringForJSON(submissionDeadline, request.getLocale())); } voteMonitoringForm.setCurrentTab("1"); @@ -465,9 +470,9 @@ voteMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); - List listQuestionDTO = new LinkedList(); + List listQuestionDTO = new LinkedList(); - Iterator queIterator = voteContent.getVoteQueContents().iterator(); + Iterator queIterator = voteContent.getVoteQueContents().iterator(); while (queIterator.hasNext()) { VoteQuestionDTO voteQuestionDTO = new VoteQuestionDTO(); @@ -487,7 +492,7 @@ voteGeneralAuthoringDTO.setActivityTitle(voteGeneralMonitoringDTO.getActivityTitle()); voteGeneralAuthoringDTO.setActivityInstructions(voteGeneralMonitoringDTO.getActivityInstructions()); - MonitoringUtil.repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); + MonitoringAction.repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); boolean isGroupedActivity = voteService.isGroupedActivity(new Long(toolContentID)); request.setAttribute("isGroupedActivity", isGroupedActivity); @@ -508,11 +513,42 @@ try { voteMonitoringForm.setToolContentID(strToolContentId); } catch (NumberFormatException e) { - MonitoringAction.logger.error("Number Format Exception"); + logger.error("Number Format Exception"); VoteUtils.cleanUpUserExceptions(request); return (mapping.findForward(VoteAppConstants.ERROR_LIST)); } } return null; } + + public static Map convertToVoteMonitoredUserDTOMap(List list) { + Map map = new TreeMap(new VoteComparator()); + + Iterator listIterator = list.iterator(); + Long mapIndex = new Long(1); + + while (listIterator.hasNext()) { + ; + VoteMonitoredUserDTO data = listIterator.next(); + + map.put(mapIndex.toString(), data); + mapIndex = new Long(mapIndex.longValue() + 1); + } + return map; + } + + public static void repopulateRequestParameters(HttpServletRequest request, VoteMonitoringForm voteMonitoringForm, + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO) { + + String toolContentID = request.getParameter(VoteAppConstants.TOOL_CONTENT_ID); + voteMonitoringForm.setToolContentID(toolContentID); + voteGeneralMonitoringDTO.setToolContentID(toolContentID); + + String responseId = request.getParameter(VoteAppConstants.RESPONSE_ID); + voteMonitoringForm.setResponseId(responseId); + voteGeneralMonitoringDTO.setResponseId(responseId); + + String currentUid = request.getParameter(VoteAppConstants.CURRENT_UID); + voteMonitoringForm.setCurrentUid(currentUid); + } } Fisheye: Tag 1.58.2.2 refers to a dead (removed) revision in file `lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java'. Fisheye: No comparison available. Pass `N' to diff?