Index: lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUploadedFile.hbm.xml
===================================================================
diff -u -rae28185f07883077586773f760d1bde953e2d9bf -r00759d7592ccc90e8769763524afb69546f641d4
--- lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUploadedFile.hbm.xml (.../VoteUploadedFile.hbm.xml) (revision ae28185f07883077586773f760d1bde953e2d9bf)
+++ lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUploadedFile.hbm.xml (.../VoteUploadedFile.hbm.xml) (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -9,48 +9,40 @@
name="org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile"
table="tl_lavote11_uploadedfile"
>
+
DTO that holds question and user attempts data for jsp purposes + *
+ * + * @author Ozgur Demirtas + */ +public class EditActivityDTO implements Comparable +{ + private String monitoredContentInUse; + + + /** + * @return Returns the monitoredContentInUse. + */ + public String getMonitoredContentInUse() { + return monitoredContentInUse; + } + /** + * @param monitoredContentInUse The monitoredContentInUse to set. + */ + public void setMonitoredContentInUse(String monitoredContentInUse) { + this.monitoredContentInUse = monitoredContentInUse; + } + public String toString() { + return new ToStringBuilder(this) + .append("monitoredContentInUse", monitoredContentInUse) + .toString(); + } + + public int compareTo(Object o) + { + EditActivityDTO editActivityDTO = (EditActivityDTO) o; + + if (editActivityDTO == null) + return 1; + else + return 0; + } + +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllGroupsDTO.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllGroupsDTO.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllGroupsDTO.java (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,104 @@ +/**************************************************************** + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.vote; + +import java.util.List; + +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + *DTO that holds question and user attempts data for jsp purposes + *
+ * + * @author Ozgur Demirtas + */ +public class VoteAllGroupsDTO implements Comparable +{ + + private String sessionId; + + private String sessionName; + + private List groupData; + + + + public String toString() { + return new ToStringBuilder(this) + .append("sessionId:", sessionId) + .append("sessionName:", sessionName) + .append("groupData: ", groupData) + .toString(); + } + + public int compareTo(Object o) + { + VoteAllGroupsDTO qaAllGroupsDTO = (VoteAllGroupsDTO) o; + + if (qaAllGroupsDTO == null) + return 1; + else + return 0; + } + + + /** + * @return Returns the groupData. + */ + public List getGroupData() { + return groupData; + } + /** + * @param groupData The groupData to set. + */ + public void setGroupData(List groupData) { + this.groupData = groupData; + } + /** + * @return Returns the sessionName. + */ + public String getSessionName() { + return sessionName; + } + /** + * @param sessionName The sessionName to set. + */ + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } + /** + * @return Returns the sessionId. + */ + public String getSessionId() { + return sessionId; + } + /** + * @param sessionId The sessionId to set. + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -74,6 +74,12 @@ public static final String SELECTED_TOOL_SESSION_ID ="selectedToolSessionId"; public static final String DEFAULT_VOTING_TITLE ="Voting Title"; public static final String DEFAULT_VOTING_INSTRUCTIONS ="Voting Instructions"; + public static final String NOTEBOOK_ENTRIES_EXIST ="notebookEntriesExist"; + public static final String NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST ="noSessionsNotebookEntriesExist"; + public static final String UUID ="uuid"; + public static final String VOTE_STATS_DTO ="voteStatsDTO"; + public static final String LIST_ALL_GROUPS_DTO ="listAllGroupsDTO"; + public static final String CURRENT_SESSION_NAME ="currentSessionName"; public static final String ATTACHMENT_LIST_KEY = "attachmentListKey"; public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey"; @@ -82,6 +88,7 @@ public static final String VOTE_GENERAL_MONITORING_DTO = "voteGeneralMonitoringDTO"; public static final String LEARNER_NOTEBOOK ="learnerNotebook"; + public static final String AUTHORING ="authoring"; public static final String SOURCE_VOTE_STARTER ="sourceVoteStarter"; public static final String REMOVABLE_OPTION_INDEX ="removableOptionIndex"; @@ -95,11 +102,16 @@ public static final String VOTE_GENERAL_AUTHORING_DTO ="voteGeneralAuthoringDTO"; public static final String MAP_OPTIONS_CONTENT_KEY ="mapOptionsContentKey"; public static final String HTTP_SESSION_ID ="httpSessionID"; + public static final String LIST_NOMINATION_CONTENT_DTO = "listNominationContentDTO"; + public static final String LIST_NOMINATION_CONTENT_DTO_KEY = "listNominationContentDTOKey"; public static final String DEFAULT_ONLINE_INST ="online instructions"; public static final String DEFAULT_OFFLINE_INST ="offline instructions"; + public static final String ONLINE_INSTRUCTIONS ="onlineInstructions"; + public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions"; public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey"; public static final String OFFLINE_INSTRUCTIONS_KEY = "offlineInstructionsKey"; + public static final String TOTAL_NOMINATION_COUNT = "totalNominationCount"; public static final String EXPORT_PORTFOLIO_DTO = "exportPortfolioDto"; public static final String NOTEBOOK ="notebook"; @@ -185,6 +197,8 @@ public static final String CREATION_DATE ="creationDate"; public static final String DEFINE_LATER ="defineLater"; public static final String VIEW_ANSWERS ="viewAnswers"; + + public static final String EDIT_ACTIVITY_DTO ="editActivityDTO"; public static final String REFLECT ="reflect"; public static final String ON ="ON"; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java (.../VoteGeneralAuthoringDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java (.../VoteGeneralAuthoringDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -75,6 +75,22 @@ protected String validationError; protected String userExceptionOptionsDuplicate; protected String httpSessionID; + + protected String contentFolderID; + protected String editableQuestionText; + protected String editableQuestionFeedback; + + protected List attachmentList; + protected List deletedAttachmentList; + protected String reflect; + protected String reflectionSubject; + + protected Map mapNominationContent; + protected String editableNominationText; + protected String editableNominationFeedback; + protected String isToolSessionChanged; + protected String responseId; + protected String currentUid; /** @@ -514,13 +530,18 @@ public String toString() { return new ToStringBuilder(this) .append("activeModule: ", activeModule) + .append("contentFolderID: ", contentFolderID) + .append("editableQuestionText: ", editableQuestionText) .append("defineLaterInEditMode: ", defineLaterInEditMode) + .append("reflectionSubject: ", reflectionSubject) .append("submissionAttempt: ", submissionAttempt) + .append("mapNominationContent: ", mapNominationContent) .append("sbmtSuccess: ", sbmtSuccess) .append("exceptionMaxNominationInvalid: ", exceptionMaxNominationInvalid) .append("toolContentID: ", toolContentID) .append("defaultContentId: ", defaultContentId) - .append("defaultContentIdStr: ", defaultContentIdStr) + .append("defaultContentIdStr: ", defaultContentIdStr) + .append("reflect: ", reflect) .append("isDefineLater: ", isDefineLater) .append("allowText: ", allowText) .append("voteChangable: ", voteChangable) @@ -549,4 +570,162 @@ .append("editActivityEditMode: ", editActivityEditMode) .toString(); } + + /** + * @return Returns the contentFolderID. + */ + public String getContentFolderID() { + return contentFolderID; + } + /** + * @param contentFolderID The contentFolderID to set. + */ + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } + /** + * @return Returns the editableQuestionFeedback. + */ + public String getEditableQuestionFeedback() { + return editableQuestionFeedback; + } + /** + * @param editableQuestionFeedback The editableQuestionFeedback to set. + */ + public void setEditableQuestionFeedback(String editableQuestionFeedback) { + this.editableQuestionFeedback = editableQuestionFeedback; + } + /** + * @return Returns the editableQuestionText. + */ + public String getEditableQuestionText() { + return editableQuestionText; + } + /** + * @param editableQuestionText The editableQuestionText to set. + */ + public void setEditableQuestionText(String editableQuestionText) { + this.editableQuestionText = editableQuestionText; + } + + /** + * @return Returns the attachmentList. + */ + public List getAttachmentList() { + return attachmentList; + } + /** + * @param attachmentList The attachmentList to set. + */ + public void setAttachmentList(List attachmentList) { + this.attachmentList = attachmentList; + } + /** + * @return Returns the deletedAttachmentList. + */ + public List getDeletedAttachmentList() { + return deletedAttachmentList; + } + /** + * @param deletedAttachmentList The deletedAttachmentList to set. + */ + public void setDeletedAttachmentList(List deletedAttachmentList) { + this.deletedAttachmentList = deletedAttachmentList; + } + /** + * @return Returns the reflect. + */ + public String getReflect() { + return reflect; + } + /** + * @param reflect The reflect to set. + */ + public void setReflect(String reflect) { + this.reflect = reflect; + } + /** + * @return Returns the reflectionSubject. + */ + public String getReflectionSubject() { + return reflectionSubject; + } + /** + * @param reflectionSubject The reflectionSubject to set. + */ + public void setReflectionSubject(String reflectionSubject) { + this.reflectionSubject = reflectionSubject; + } + /** + * @return Returns the editableNominationFeedback. + */ + public String getEditableNominationFeedback() { + return editableNominationFeedback; + } + /** + * @param editableNominationFeedback The editableNominationFeedback to set. + */ + public void setEditableNominationFeedback(String editableNominationFeedback) { + this.editableNominationFeedback = editableNominationFeedback; + } + /** + * @return Returns the editableNominationText. + */ + public String getEditableNominationText() { + return editableNominationText; + } + /** + * @param editableNominationText The editableNominationText to set. + */ + public void setEditableNominationText(String editableNominationText) { + this.editableNominationText = editableNominationText; + } + /** + * @return Returns the mapNominationContent. + */ + public Map getMapNominationContent() { + return mapNominationContent; + } + /** + * @param mapNominationContent The mapNominationContent to set. + */ + public void setMapNominationContent(Map mapNominationContent) { + this.mapNominationContent = mapNominationContent; + } + /** + * @return Returns the isToolSessionChanged. + */ + public String getIsToolSessionChanged() { + return isToolSessionChanged; + } + /** + * @param isToolSessionChanged The isToolSessionChanged to set. + */ + public void setIsToolSessionChanged(String isToolSessionChanged) { + this.isToolSessionChanged = isToolSessionChanged; + } + /** + * @return Returns the currentUid. + */ + public String getCurrentUid() { + return currentUid; + } + /** + * @param currentUid The currentUid to set. + */ + public void setCurrentUid(String currentUid) { + this.currentUid = currentUid; + } + /** + * @return Returns the responseId. + */ + public String getResponseId() { + return responseId; + } + /** + * @param responseId The responseId to set. + */ + public void setResponseId(String responseId) { + this.responseId = responseId; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralMonitoringDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralMonitoringDTO.java (.../VoteGeneralMonitoringDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralMonitoringDTO.java (.../VoteGeneralMonitoringDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -46,6 +46,7 @@ protected String userExceptionContentDoesNotExist; protected String userExceptionNoStudentActivity; protected String isMonitoredContentInUse; + protected String monitoredContentInUse; protected String activeModule; protected String currentTab; @@ -92,6 +93,15 @@ protected String completedSessionUserPercent; protected List mapStudentsVoted; + protected String onlineInstructions; + protected String offlineInstructions; + protected List attachmentList; + protected List deletedAttachmentList; + + protected String contentFolderID; + + + /** * @return Returns the listOfflineFilesMetadata. */ @@ -698,6 +708,7 @@ return new ToStringBuilder(this) .append("toolContentID: ", toolContentID) .append("activeModule: ", activeModule) + .append("monitoredContentInUse: ", monitoredContentInUse) .append("currentMonitoringTab: ", currentMonitoringTab) .append("selectionCase: ", selectionCase) .append("isToolSessionChanged: ", isToolSessionChanged) @@ -750,5 +761,79 @@ else return 0; } + + /** + * @return Returns the monitoredContentInUse. + */ + public String getMonitoredContentInUse() { + return monitoredContentInUse; + } + /** + * @param monitoredContentInUse The monitoredContentInUse to set. + */ + public void setMonitoredContentInUse(String monitoredContentInUse) { + this.monitoredContentInUse = monitoredContentInUse; + } + /** + * @return Returns the offlineInstructions. + */ + public String getOfflineInstructions() { + return offlineInstructions; + } + /** + * @param offlineInstructions The offlineInstructions to set. + */ + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } + /** + * @return Returns the onlineInstructions. + */ + public String getOnlineInstructions() { + return onlineInstructions; + } + /** + * @param onlineInstructions The onlineInstructions to set. + */ + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } + + /** + * @return Returns the attachmentList. + */ + public List getAttachmentList() { + return attachmentList; + } + /** + * @param attachmentList The attachmentList to set. + */ + public void setAttachmentList(List attachmentList) { + this.attachmentList = attachmentList; + } + /** + * @return Returns the contentFolderID. + */ + public String getContentFolderID() { + return contentFolderID; + } + /** + * @param contentFolderID The contentFolderID to set. + */ + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } + /** + * @return Returns the deletedAttachmentList. + */ + public List getDeletedAttachmentList() { + return deletedAttachmentList; + } + /** + * @param deletedAttachmentList The deletedAttachmentList to set. + */ + public void setDeletedAttachmentList(List deletedAttachmentList) { + this.deletedAttachmentList = deletedAttachmentList; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredAnswersDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredAnswersDTO.java (.../VoteMonitoredAnswersDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredAnswersDTO.java (.../VoteMonitoredAnswersDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -46,6 +46,34 @@ private Map questionAttempts; + private String sessionId; + + private String sessionName; + + /** + * @return Returns the sessionId. + */ + public String getSessionId() { + return sessionId; + } + /** + * @param sessionId The sessionId to set. + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + /** + * @return Returns the sessionName. + */ + public String getSessionName() { + return sessionName; + } + /** + * @param sessionName The sessionName to set. + */ + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } /** * @return Returns the candidateAnswers. */ Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredUserDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredUserDTO.java (.../VoteMonitoredUserDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredUserDTO.java (.../VoteMonitoredUserDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -59,6 +59,10 @@ private String questionUid; private Map usersAttempts; + + private String responsePresentable; + + /** * @return Returns the queUsrId. @@ -220,4 +224,16 @@ public void setAttemptTime(Date attemptTime) { this.attemptTime = attemptTime; } + /** + * @return Returns the responsePresentable. + */ + public String getResponsePresentable() { + return responsePresentable; + } + /** + * @param responsePresentable The responsePresentable to set. + */ + public void setResponsePresentable(String responsePresentable) { + this.responsePresentable = responsePresentable; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteNominationContentDTO.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteNominationContentDTO.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteNominationContentDTO.java (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,107 @@ +/**************************************************************** + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.vote; + +import org.apache.commons.lang.builder.ToStringBuilder; + + + +/** + *Votes dto + *
+ * + * @author Ozgur Demirtas + */ +public class VoteNominationContentDTO implements Comparable +{ + private String question; + private String displayOrder; + private String feedback; + + public String toString() { + return new ToStringBuilder(this) + .append("question:", question) + .append("feedback:", feedback) + .append("displayOrder:", displayOrder) + .toString(); + } + + public int compareTo(Object o) + { + VoteMonitoredUserDTO voteMonitoredUserDTO = (VoteMonitoredUserDTO) o; + + if (voteMonitoredUserDTO == null) + return 1; + else + return 0; + } + /** + * @return Returns the displayOrder. + */ + public String getDisplayOrder() { + return displayOrder; + } + /** + * @param displayOrder The displayOrder to set. + */ + public void setDisplayOrder(String displayOrder) { + this.displayOrder = displayOrder; + } + /** + * @return Returns the feedback. + */ + public String getFeedback() { + return feedback; + } + /** + * @param feedback The feedback to set. + */ + public void setFeedback(String feedback) { + this.feedback = feedback; + } + /** + * @return Returns the question. + */ + public String getNomination() { + return question; + } + /** + * @param question The question to set. + */ + public void setNomination(String question) { + this.question = question; + } + /** + * @return Returns the question. + */ + public String getQuestion() { + return question; + } + /** + * @param question The question to set. + */ + public void setQuestion(String question) { + this.question = question; + } +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteStatsDTO.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteStatsDTO.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteStatsDTO.java (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,84 @@ +/**************************************************************** + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.vote; + +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + *DTO that holds stats data + *
+ * + * @author Ozgur Demirtas + */ +public class VoteStatsDTO implements Comparable +{ + private String countAllUsers; + + private String countSessionComplete; + + public String toString() { + return new ToStringBuilder(this) + .append("question", countAllUsers) + .append("countSessionComplete", countSessionComplete) + .toString(); + } + + public int compareTo(Object o) + { + VoteStatsDTO qaStatsDTO = (VoteStatsDTO) o; + + if (qaStatsDTO == null) + return 1; + else + return 0; + } + + + /** + * @return Returns the countAllUsers. + */ + public String getCountAllUsers() { + return countAllUsers; + } + /** + * @param countAllUsers The countAllUsers to set. + */ + public void setCountAllUsers(String countAllUsers) { + this.countAllUsers = countAllUsers; + } + /** + * @return Returns the countSessionComplete. + */ + public String getCountSessionComplete() { + return countSessionComplete; + } + /** + * @param countSessionComplete The countSessionComplete to set. + */ + public void setCountSessionComplete(String countSessionComplete) { + this.countSessionComplete = countSessionComplete; + } +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -23,6 +23,7 @@ package org.lamsfoundation.lams.tool.vote; import java.text.DateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; @@ -36,6 +37,7 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; +import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.web.VoteAuthoringForm; import org.lamsfoundation.lams.usermanagement.User; @@ -63,7 +65,26 @@ return newText; } + public static String getCurrentLearnerID() + { + String userID = ""; + HttpSession ss = SessionManager.getSession(); + logger.debug("ss: " + ss); + + if (ss != null) + { + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user != null) && (user.getUserID() != null)) + { + userID = user.getUserID().toString(); + logger.debug("retrieved userId: " + userID); + } + } + return userID; + } + + /** * * getGMTDateTime(HttpServletRequest request) @@ -539,4 +560,154 @@ request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_MUST_EQUAL100); request.getSession().removeAttribute(USER_EXCEPTION_SINGLE_OPTION); } + + + + public static void setFormProperties(HttpServletRequest request, IVoteService voteService, + VoteAuthoringForm voteAuthoringForm, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO, String strToolContentID, + String defaultContentIdStr, String activeModule, SessionMap sessionMap, String httpSessionID) + { + logger.debug("setFormProperties: "); + logger.debug("using strToolContentID: " + strToolContentID); + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + logger.debug("using activeModule: " + activeModule); + logger.debug("using httpSessionID: " + httpSessionID); + + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + + voteAuthoringForm.setToolContentID(strToolContentID); + + if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0)) + voteAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString()); + + voteAuthoringForm.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + String voteChangable=request.getParameter("voteChangable"); + logger.debug("voteChangable: " + voteChangable); + voteAuthoringForm.setVoteChangable(voteChangable); + voteGeneralAuthoringDTO.setVoteChangable(voteChangable); + + String lockOnFinish=request.getParameter("lockOnFinish"); + logger.debug("lockOnFinish: " + lockOnFinish); + voteAuthoringForm.setLockOnFinish(lockOnFinish); + voteGeneralAuthoringDTO.setLockOnFinish(lockOnFinish); + + String allowText=request.getParameter("allowText"); + logger.debug("allowText: " + allowText); + voteAuthoringForm.setAllowText(allowText); + voteGeneralAuthoringDTO.setAllowText(allowText); + + String maxNominationCount=request.getParameter("maxNominationCount"); + logger.debug("maxNominationCount: " + maxNominationCount); + voteAuthoringForm.setMaxNominationCount(maxNominationCount); + voteGeneralAuthoringDTO.setMaxNominationCount(maxNominationCount); + + String reflect=request.getParameter("reflect"); + logger.debug("reflect: " + maxNominationCount); + voteAuthoringForm.setReflect(reflect); + voteGeneralAuthoringDTO.setReflect(reflect); + + String reflectionSubject=request.getParameter("reflectionSubject"); + logger.debug("reflectionSubject: " + reflectionSubject); + voteAuthoringForm.setReflectionSubject(reflectionSubject); + voteGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); + + + String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); + logger.debug("offlineInstructions: " + offlineInstructions); + voteAuthoringForm.setOfflineInstructions(offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); + logger.debug("onlineInstructions: " + onlineInstructions); + voteAuthoringForm.setOnlineInstructions(onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + logger.debug("ending setFormProperties with voteAuthoringForm: " + voteAuthoringForm); + logger.debug("ending setFormProperties with voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + } + + + public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, IVoteService voteService) + { + logger.debug("voteService: " + voteService); + logger.debug("value:" + value); + logger.debug("strToolContentID:" + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + + logger.debug("voteContent:" + voteContent); + if (voteContent != null) + { + voteContent.setDefineLater(value); + logger.debug("defineLater has been set to:" + value); + voteService.updateVote(voteContent); + } + } + + + + /** If this file exists in attachments map, move it to the deleted attachments map. + * Returns the updated deletedAttachments map, creating a new one if needed. If uuid supplied + * then tries to match on that, otherwise uses filename and isOnline. */ + public static List moveToDelete(String uuid, List attachmentsList, List deletedAttachmentsList ) { + + logger.debug("doing moveToDelete: " + attachmentsList); + logger.debug("doing moveToDelete: " + deletedAttachmentsList); + List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); + + logger.debug("deletedList: " + deletedList); + + if ( attachmentsList != null ) { + logger.debug("attachmentsList not null: " + attachmentsList); + Iterator iter = attachmentsList.iterator(); + VoteUploadedFile attachment = null; + while ( iter.hasNext() && attachment == null ) { + VoteUploadedFile value = (VoteUploadedFile) iter.next(); + logger.debug("value: " + value); + + if ( uuid.equals(value.getUuid()) ) { + logger.debug("value made attachment:"); + attachment = value; + } + + } + if ( attachment != null ) { + logger.debug("attachment not null"); + deletedList.add(attachment); + attachmentsList.remove(attachment); + } + } + + logger.debug("final attachmentsList: " + attachmentsList); + logger.debug("final deletedAttachmentsList: " + deletedAttachmentsList); + return deletedList; + } + + + public static List moveToDelete(String filename, boolean isOnline, List attachmentsList, List deletedAttachmentsList ) { + + List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); + + if ( attachmentsList != null ) { + Iterator iter = attachmentsList.iterator(); + VoteUploadedFile attachment = null; + while ( iter.hasNext() && attachment == null ) { + VoteUploadedFile value = (VoteUploadedFile) iter.next(); + if ( filename.equals(value.getFileName()) && isOnline == value.isFileOnline()) { + attachment = value; + } + + } + if ( attachment != null ) { + deletedList.add(attachment); + attachmentsList.remove(attachment); + } + } + + return deletedList; + } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -35,21 +35,23 @@ public interface IVoteContentDAO { public VoteContent getVoteContentByUID(Long uid); - public VoteContent findVoteContentById(Long mcContentId); + public VoteContent findVoteContentById(Long voteContentId); - public VoteContent getVoteContentBySession(Long mcSessionId); + public VoteContent getVoteContentBySession(Long voteSessionId); - public void saveVoteContent(VoteContent mcContent); + public void saveVoteContent(VoteContent voteContent); - public void updateVoteContent(VoteContent mcContent); + public void updateVoteContent(VoteContent voteContent); + + public void saveOrUpdateVote(VoteContent voteContent); - public void removeVote(VoteContent mcContent); + public void removeVote(VoteContent voteContent); - public void removeVoteById(Long mcContentId); + public void removeVoteById(Long voteContentId); - public void removeVoteSessions(VoteContent mcContent); + public void removeVoteSessions(VoteContent voteContent); - public void addVoteSession(Long mcContentId, VoteSession mcSession); + public void addVoteSession(Long voteContentId, VoteSession voteSession); public List findAll(Class objClass); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -63,5 +63,7 @@ public void removeVoteQueContent(VoteQueContent voteQueContent); + public List getAllQuestionEntriesSorted(final long voteContentId); + public void flush(); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUploadedFileDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUploadedFileDAO.java (.../IVoteUploadedFileDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUploadedFileDAO.java (.../IVoteUploadedFileDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -23,60 +23,34 @@ import java.util.List; +import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; /** * @author Ozgur Demirtas * *Interface that defines the contract for IVoteUploadedFile access
*/ + public interface IVoteUploadedFileDAO { - public VoteUploadedFile getUploadedFileById(long submissionId); - - public VoteUploadedFile loadUploadedFileById(long uid); - - public void updateUploadFile(VoteUploadedFile voteUploadedFile); - - public void saveUploadFile(VoteUploadedFile voteUploadedFile); - - public void createUploadFile(VoteUploadedFile voteUploadedFile); - - public void UpdateUploadFile(VoteUploadedFile voteUploadedFile); + public VoteUploadedFile loadUploadedFileById(long submissionId); - public void removeOffLineFile(String filename, Long voteContentId); + public void updateUploadFile(VoteUploadedFile voteUploadedFile); + + public void saveUploadFile(VoteUploadedFile voteUploadedFile); + + public void createUploadFile(VoteUploadedFile voteUploadedFile); + + public void UpdateUploadFile(VoteUploadedFile voteUploadedFile); - public void removeOnLineFile(String filename, Long voteContentId); - - public boolean isOffLineFilePersisted(String filename); - - public boolean isOnLineFilePersisted(String filename); - - public List getOnlineFilesMetaData(Long voteContentId); - - public List getOfflineFilesMetaData(Long voteContentId); - - public boolean isUuidPersisted(String uuid); - - public void cleanUploadedFilesMetaData(); - - public String getFileUuid(String filename); - - public void removeUploadFile(Long uid); - - public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline); - - public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId); - - public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId); - - public List retrieveVoteUploadedOfflineFilesUuidPlusFilename(Long voteContentId); - - public List retrieveVoteUploadedOfflineFilesName(Long voteContentId); - - public List retrieveVoteUploadedOnlineFilesName(Long voteContentId); - - public void deleteUploadFile(VoteUploadedFile voteUploadedFile); - - public void flush(); + public void removeUploadFile(Long submissionId); + + public void deleteUploadFile(VoteUploadedFile voteUploadedFile); + + public List retrieveVoteUploadedFiles(VoteContent vote); + + public void cleanUploadedFilesMetaData(); + + public void flush(); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -84,7 +84,7 @@ public int getLastNominationCount(Long userId); - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); + //public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long voteSessionId); @@ -101,6 +101,8 @@ public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId); public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId); + + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -53,6 +53,14 @@ return (VoteContent) this.getHibernateTemplate().get(VoteContent.class, uid); } + public void saveOrUpdateVote(VoteContent vote) + { + this.getSession().setFlushMode(FlushMode.AUTO); + logger.debug("before saveOrUpdateVote: " + vote); + this.getHibernateTemplate().saveOrUpdate(vote); + } + + public VoteContent findVoteContentById(Long voteContentId) { String query = "from VoteContent as vote where vote.voteContentId = ?"; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -48,6 +48,8 @@ private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from voteQueContent in class VoteQueContent where voteQueContent.displayOrder=:displayOrder and voteQueContent.voteContentId=:voteContentUid"; + private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from voteQueContent in class VoteQueContent where voteQueContent.voteContentId=:voteContentId order by voteQueContent.displayOrder"; + public VoteQueContent getVoteQueContentByUID(Long uid) { @@ -197,6 +199,18 @@ } + public List getAllQuestionEntriesSorted(final long voteContentId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER) + .setLong("voteContentId", voteContentId) + .list(); + + return list; + } + + + public void saveVoteQueContent(VoteQueContent voteQueContent) { this.getHibernateTemplate().save(voteQueContent); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUploadedFileDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUploadedFileDAO.java (.../VoteUploadedFileDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUploadedFileDAO.java (.../VoteUploadedFileDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -28,6 +28,7 @@ import org.apache.log4j.Logger; import org.hibernate.FlushMode; import org.lamsfoundation.lams.tool.vote.dao.IVoteUploadedFileDAO; +import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; @@ -37,44 +38,29 @@ * @author ozgurd *Hibernate implementation for database access to VoteUploadedFile for the voting tool.
*/ + + public class VoteUploadedFileDAO extends HibernateDaoSupport implements IVoteUploadedFileDAO { static Logger logger = Logger.getLogger(VoteUploadedFileDAO.class.getName()); + - private static final String GET_ONLINE_FILENAMES_FOR_CONTENT = "select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1"; - private static final String GET_OFFLINE_FILENAMES_FOR_CONTENT = "select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; + private static final String GET_UPLOADED_FILES = "from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContent.voteContentId = :contentId"; + + private static final String DELETE_FILES_META_DATA = "from voteUploadedFile in class VoteUploadedFile"; - private static final String GET_ONLINE_FILES_UUID = "select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1"; - private static final String GET_ONLINE_FILES_NAME ="select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1 order by voteUploadedFile.uuid"; - - private static final String GET_OFFLINE_FILES_UUID = "select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; - private static final String GET_OFFLINE_FILES_NAME ="select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0 order by voteUploadedFile.uuid"; - - private static final String GET_FILES_UUID ="select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.filename=:filename"; - - private static final String GET_OFFLINE_FILES_UUIDPLUSFILENAME = "select (voteUploadedFile.uuid + '~' + voteUploadedFile.filename) from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; - - private static final String FIND_ALL_UPLOADED_FILE_DATA = "from voteUploadedFile in class VoteUploadedFile"; - - private static final String IS_UUID_PERSISTED ="select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.uuid=:uuid"; - - private static final String GET_ONLINE_FILES_METADATA = "from voteUploadedFile in class VoteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1"; - - private static final String GET_OFFLINE_FILES_METADATA = "from voteUploadedFile in class VoteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; - - private static final String IS_OFFLINE_FILENAME_PERSISTED ="select voteUploadedFile from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.filename=:filename and voteUploadedFile.fileOnline=0"; - - private static final String IS_ONLINE_FILENAME_PERSISTED ="select voteUploadedFile from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.filename=:filename and voteUploadedFile.fileOnline=1"; - - public VoteUploadedFile getUploadedFileById(long submissionId) { return (VoteUploadedFile) this.getHibernateTemplate() .load(VoteUploadedFile.class, new Long(submissionId)); } - public VoteUploadedFile loadUploadedFileById(long uid) + /** + * + * return null if not found + */ + public VoteUploadedFile loadUploadedFileById(long submissionId) { - return (VoteUploadedFile) this.getHibernateTemplate().get(VoteUploadedFile.class, new Long(uid)); + return (VoteUploadedFile) this.getHibernateTemplate().get(VoteUploadedFile.class, new Long(submissionId)); } @@ -83,15 +69,13 @@ { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().update(voteUploadedFile); - this.getSession().setFlushMode(FlushMode.AUTO); } public void saveUploadFile(VoteUploadedFile voteUploadedFile) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().save(voteUploadedFile); - this.getSession().setFlushMode(FlushMode.AUTO); } public void createUploadFile(VoteUploadedFile voteUploadedFile) @@ -107,245 +91,47 @@ } - public void removeOffLineFile(String filename, Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_OFFLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - VoteUploadedFile voteFile=(VoteUploadedFile)listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(voteFile); - templ.flush(); - } - } - } - - public void removeOnLineFile(String filename, Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_ONLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - VoteUploadedFile voteFile=(VoteUploadedFile)listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(voteFile); - templ.flush(); - } - } - } - - public boolean isOffLineFilePersisted(String filename) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_OFFLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .list(); - - if (list != null && list.size() > 0) - { - return true; - } - return false; - } - - - public boolean isOnLineFilePersisted(String filename) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_ONLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .list(); - - if (list != null && list.size() > 0) - { - return true; - } - return false; - } - - - public List getOnlineFilesMetaData(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_METADATA) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public List getOfflineFilesMetaData(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_METADATA) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public boolean isUuidPersisted(String uuid) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_UUID_PERSISTED) - .setString("uuid", uuid) - .list(); - - if (list != null && list.size() > 0) - { - return true; - } - return false; - } - - public void cleanUploadedFilesMetaData() { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(FIND_ALL_UPLOADED_FILE_DATA) + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(DELETE_FILES_META_DATA) .list(); if(list != null && list.size() > 0){ Iterator listIterator=list.iterator(); while (listIterator.hasNext()) { - VoteUploadedFile voteFile=(VoteUploadedFile)listIterator.next(); + VoteUploadedFile mcFile=(VoteUploadedFile)listIterator.next(); this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(voteFile); + templ.delete(mcFile); templ.flush(); } } } - - public String getFileUuid(String filename) + public void removeUploadFile(Long submissionId) { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_FILES_UUID) - .setString("filename", filename) - .list(); - - if (list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - String uuid=(String)listIterator.next(); - logger.debug("uuid :" + uuid); - return uuid; - } - } - else - { - return null; - } - return null; - } - - - public void removeUploadFile(Long uid) - { - if (uid != null ) { + if (submissionId != null ) { - String query = "from uploadedFile in class org.lamsfoundation.lams.tool.vote.VoteUploadedFile" - + " where uploadedFile.uid = ?"; + String query = "from uploadedFile in class org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile" + + " where uploadedFile.submissionId = ?"; Object obj = this.getSession().createQuery(query) - .setLong(0,uid.longValue()) + .setLong(0,submissionId.longValue()) .uniqueResult(); if ( obj != null ) { + this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().delete(obj); } } } - public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline) + public List retrieveVoteUploadedFiles(VoteContent vote) { List listFilenames=null; - - if (fileOnline) - { - listFilenames=(getHibernateTemplate().findByNamedParam(GET_ONLINE_FILENAMES_FOR_CONTENT, - "voteContentId", - voteContentId)); - } - else - { - listFilenames=(getHibernateTemplate().findByNamedParam(GET_OFFLINE_FILENAMES_FOR_CONTENT, - "voteContentId", - voteContentId)); - } + listFilenames=(getHibernateTemplate().findByNamedParam(GET_UPLOADED_FILES, "contentId", vote.getVoteContentId())); return listFilenames; } - - public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_UUID) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - - return list; - } - - public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_UUID) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - public List retrieveVoteUploadedOfflineFilesUuidPlusFilename(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_UUIDPLUSFILENAME) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public List retrieveVoteUploadedOfflineFilesName(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_NAME) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public List retrieveVoteUploadedOnlineFilesName(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_NAME) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - public void deleteUploadFile(VoteUploadedFile voteUploadedFile) { this.getSession().setFlushMode(FlushMode.AUTO); @@ -356,4 +142,5 @@ { this.getHibernateTemplate().flush(); } + } \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -443,24 +443,18 @@ } - - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT) .setLong("queUsrId", queUsrId.longValue()) .setLong("voteQueContentId", voteQueContentId.longValue()) .list(); - if(list != null && list.size() > 0){ - VoteUsrAttempt voteA = (VoteUsrAttempt) list.get(0); - return voteA; - } - - return null; + return list; } - + public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long voteSessionId) { HibernateTemplate templ = this.getHibernateTemplate(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java (.../VoteContent.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java (.../VoteContent.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -369,6 +369,9 @@ * @return Returns the voteAttachments. */ public Set getVoteAttachments() { + if(voteAttachments == null) + voteAttachments = new TreeSet(); + return voteAttachments; } /** Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUploadedFile.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUploadedFile.java (.../VoteUploadedFile.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUploadedFile.java (.../VoteUploadedFile.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -25,6 +25,8 @@ import java.io.Serializable; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.log4j.Logger; import org.lamsfoundation.lams.contentrepository.ItemNotFoundException; @@ -43,9 +45,8 @@ public class VoteUploadedFile implements Serializable, Comparable { static Logger logger = Logger.getLogger(VoteUploadedFile.class.getName()); - /** identifier field */ - private Long uid; + private Long submissionId; /** persistent field */ private String uuid; @@ -54,71 +55,46 @@ private boolean fileOnline; /** persistent field */ - private String filename; + private String fileName; - - private Long voteContentId; - /** persistent field */ private VoteContent voteContent; public VoteUploadedFile(){}; /** full constructor */ - public VoteUploadedFile(Long uid, + public VoteUploadedFile(Long submissionId, String uuid, boolean fileOnline, - String filename, + String fileName, VoteContent voteContent) { - this.uid=uid; + this.submissionId=submissionId; this.uuid = uuid; this.fileOnline = fileOnline; - this.filename = filename; + this.fileName = fileName; this.voteContent=voteContent; } - - public VoteUploadedFile(String uuid, - boolean fileOnline, - String filename, - VoteContent voteContent) - { - this.uuid = uuid; - this.fileOnline = fileOnline; - this.filename = filename; - this.voteContent=voteContent; - } - public VoteUploadedFile(String uuid, - boolean fileOnline, - String filename, - Long voteContentId) - { - this.uuid = uuid; - this.fileOnline = fileOnline; - this.filename = filename; - this.voteContentId=voteContentId; - } - - public static VoteUploadedFile newInstance(IToolContentHandler toolContentHandler, VoteUploadedFile mcUploadedFile, + public static VoteUploadedFile newInstance(IToolContentHandler toolContentHandler, VoteUploadedFile voteUploadedFile, VoteContent newMcContent) throws ItemNotFoundException, RepositoryCheckedException { VoteUploadedFile newMcUploadedFile=null; try { - String fileUuid = mcUploadedFile.getUuid(); + String fileUuid = voteUploadedFile.getUuid(); if(toolContentHandler != null){ - NodeKey copiedNodeKey = toolContentHandler.copyFile(new Long(mcUploadedFile.getUuid())); + NodeKey copiedNodeKey = toolContentHandler.copyFile(new Long(voteUploadedFile.getUuid())); logger.debug("copied NodeKey: " + copiedNodeKey); logger.debug("copied NodeKey uuid: " + copiedNodeKey.getUuid().toString()); fileUuid = copiedNodeKey.getUuid().toString(); } newMcUploadedFile = new VoteUploadedFile(fileUuid, - mcUploadedFile.isFileOnline(), - mcUploadedFile.getFilename(), + voteUploadedFile.isFileOnline(), + voteUploadedFile.getFileName(), newMcContent); } @@ -131,24 +107,79 @@ } + + public VoteUploadedFile(String uuid, + boolean fileOnline, + String fileName, + VoteContent voteContent) + { + logger.debug("constructor gets called."); + this.uuid = uuid; + this.fileOnline = fileOnline; + this.fileName = fileName; + this.voteContent=voteContent; + } + + public String toString() { return new ToStringBuilder(this) .append("uuid: ", getUuid()) + .append("fileName: ", getFileName()) .toString(); } + + public boolean equals(Object other) { + if ( !(other instanceof VoteUploadedFile) ) return false; + VoteUploadedFile castOther = (VoteUploadedFile) other; + return new EqualsBuilder() + .append(this.getUuid(), castOther.getUuid()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder() + .append(getUuid()) + .toHashCode(); + } + + /** + * @return Returns the fileName. + */ + public String getFileName() { + return fileName; + } + /** + * @param fileName The fileName to set. + */ + public void setFileName(String fileName) { + this.fileName = fileName; + } /** - * @return Returns the uid. + * @return Returns the voteContent. */ + public VoteContent getVoteContent() { + return voteContent; + } + /** + * @param voteContent The voteContent to set. + */ + public void setVoteContent(VoteContent voteContent) { + this.voteContent = voteContent; + } + + /** + * @return Returns the submissionId. + */ public Long getSubmissionId() { - return uid; + return submissionId; } /** - * @param uid The uid to set. + * @param submissionId The submissionId to set. */ - public void setSubmissionId(Long uid) { - this.uid = uid; + public void setSubmissionId(Long submissionId) { + this.submissionId = submissionId; } /** * @return Returns the uuid. @@ -174,65 +205,16 @@ public void setFileOnline(boolean fileOnline) { this.fileOnline = fileOnline; } - /** - * @return Returns the uid. - */ - public Long getUid() { - return uid; - } - /** - * @param uid The uid to set. - */ - public void setUid(Long uid) { - this.uid = uid; - } - /** - * @return Returns the filename. - */ - public String getFilename() { - return filename; - } - /** - * @param filename The filename to set. - */ - public void setFilename(String filename) { - this.filename = filename; - } public int compareTo(Object o) { - VoteUploadedFile optContent = (VoteUploadedFile) o; + VoteUploadedFile file = (VoteUploadedFile) o; //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference. - if (uid == null) + if (submissionId == null) return 1; else - return (int) (uid.longValue() - optContent.uid.longValue()); + return (int) (submissionId.longValue() - file.submissionId.longValue()); } - /** - * @return Returns the voteContentId. - */ - public Long getVoteContentId() { - return voteContentId; - } - /** - * @param voteContentId The voteContentId to set. - */ - public void setVoteContentId(Long voteContentId) { - this.voteContentId = voteContentId; - } - /** - * @return Returns the voteContent. - */ - public VoteContent getVoteContent() { - return voteContent; - } - /** - * @param voteContent The voteContent to set. - */ - public void setVoteContent(VoteContent voteContent) { - this.voteContent = voteContent; - } - public String getFileProperty() { if (isFileOnline()) { Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -41,6 +41,7 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr; import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; +import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.usermanagement.User; @@ -120,8 +121,10 @@ public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException; - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException; + //public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException; + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId) throws VoteApplicationException; + public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException; public List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException; @@ -249,18 +252,6 @@ public InputStream downloadFile(Long uuid, Long versionID) throws VoteApplicationException; - public String getFileUuid(String filename) throws VoteApplicationException; - - public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedOfflineFilesName(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedOnlineFilesName(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline) throws VoteApplicationException; - public void cleanUploadedFilesMetaData() throws VoteApplicationException; public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent) throws VoteApplicationException; @@ -279,20 +270,8 @@ public NodeKey copyFile(Long uuid) throws RepositoryCheckedException; - public void removeOffLineFile(String filename, Long voteContentId) throws VoteApplicationException; + public List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException; - public void removeOnLineFile(String filename, Long voteContentId) throws VoteApplicationException; - - public boolean isOffLineFilePersisted(String filename) throws VoteApplicationException; - - public boolean isOnLineFilePersisted(String filename) throws VoteApplicationException; - - public boolean isUuidPersisted(String uuid) throws VoteApplicationException; - - public List getOnlineFilesMetaData(Long voteContentId) throws VoteApplicationException; - - public List getOfflineFilesMetaData(Long voteContentId) throws VoteApplicationException; - public List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException; public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException; @@ -304,6 +283,10 @@ public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); - + public void removeFile(Long submissionId) throws VoteApplicationException; + + public void persistFile(VoteContent content, VoteUploadedFile file) throws VoteApplicationException; + + public List retrieveVoteUploadedFiles(VoteContent Vote) throws VoteApplicationException; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -58,10 +58,12 @@ import org.lamsfoundation.lams.tool.ToolContentManager; import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.ToolSessionManager; +import org.lamsfoundation.lams.tool.vote.util.VoteToolContentHandler; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.LamsToolServiceException; import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; import org.lamsfoundation.lams.tool.exception.ToolException; + import org.lamsfoundation.lams.tool.service.ILamsToolService; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteApplicationException; @@ -100,10 +102,11 @@ { static Logger logger = Logger.getLogger(VoteServicePOJO.class.getName()); - /*repository access related constants */ - private final String repositoryUser = "vote11"; - private final char[] repositoryId = {'v','o','t','e','_','1', '1'}; - private final String repositoryWorkspace = "vote11"; + private static String repositoryWorkspaceName = "vote11"; + private final String repositoryUser = "vote11"; + private final char[] repositoryId = {'v','o','t','e','_','1', '1'}; + + private IRepositoryService repositoryService; private ICredentials cred; @@ -133,7 +136,7 @@ { repositoryService.createCredentials(cred); logger.debug("created credentails."); - repositoryService.addWorkspace(cred,repositoryWorkspace); + repositoryService.addWorkspace(cred,repositoryWorkspaceName); logger.debug("created workspace."); } catch (ItemExistsException ie) { logger.warn("Tried to configure repository but it " @@ -147,6 +150,7 @@ } + public void createVote(VoteContent voteContent) throws VoteApplicationException { try @@ -739,24 +743,9 @@ e); } } - - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException - { - try - { - return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(queUsrId, voteQueContentId); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is getting vote UsrAttempt by user id and que content id: " - + e.getMessage(), - e); - } - } - public List getUserRecords(final String userEntry) throws VoteApplicationException { try @@ -1362,6 +1351,21 @@ } + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException + { + try + { + return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(queUsrId, voteQueContentId); + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is getting vote voteUsrRespDAO by user id and que content id: " + + e.getMessage(), + e); + } + } + + /** * checks the parameter content in the user responses table * @param voteContent @@ -1410,7 +1414,6 @@ public int countIncompleteSession(VoteContent vote) throws VoteApplicationException { - //int countIncompleteSession=voteSessionDAO.countIncompleteSession(vote); int countIncompleteSession=2; return countIncompleteSession; } @@ -1426,7 +1429,7 @@ */ public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException { - //int countStudentActivity=voteSessionDAO.studentActivityOccurred(vote); + int countStudentActivity=2; if (countStudentActivity > 0) @@ -2060,12 +2063,13 @@ repositoryService = RepositoryProxy.getRepositoryService(); logger.debug("retrieved repositoryService : " + repositoryService); + ICredentials credentials = new SimpleCredentials( repositoryUser, repositoryId); try { ITicket ticket = repositoryService.login(credentials, - repositoryWorkspace); + repositoryWorkspaceName); logger.debug("retrieved ticket: " + ticket); return ticket; } catch (AccessDeniedException e) { @@ -2080,6 +2084,7 @@ } + /** * This method deletes the content with the givenuuid
and
* versionID
from the content repository
@@ -2104,7 +2109,9 @@
}
}
+
+
/**
* This method is called everytime a new content has to be added to the
* repository. In order to do so first of all a valid ticket is obtained
@@ -2153,94 +2160,8 @@
}
- public void removeOffLineFile(String filename, Long voteContentId) throws VoteApplicationException
- {
- try
- {
- voteUploadedFileDAO.removeOffLineFile(filename, voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing offline filename"
- + e.getMessage(),
- e);
- }
- }
-
- public void removeOnLineFile(String filename, Long voteContentId) throws VoteApplicationException
- {
- try
- {
- voteUploadedFileDAO.removeOnLineFile(filename, voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is removing online filename"
- + e.getMessage(),
- e);
- }
- }
- public boolean isOffLineFilePersisted(String filename) throws VoteApplicationException
- {
- try
- {
- return voteUploadedFileDAO.isOffLineFilePersisted(filename);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is checking if offline filename is persisted: "
- + e.getMessage(),
- e);
- }
- }
-
- public boolean isOnLineFilePersisted(String filename) throws VoteApplicationException
- {
- try
- {
- return voteUploadedFileDAO.isOnLineFilePersisted(filename);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is checking if online filename is persisted: "
- + e.getMessage(),
- e);
- }
- }
-
- public String getFileUuid(String filename) throws VoteApplicationException
- {
- try
- {
- return voteUploadedFileDAO.getFileUuid(filename);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is loading uuid by filename: "
- + e.getMessage(),
- e);
- }
- }
-
-
- public List getOnlineFilesMetaData(Long voteContentId) throws VoteApplicationException
- {
- return voteUploadedFileDAO.getOnlineFilesMetaData(voteContentId);
- }
-
-
- public List getOfflineFilesMetaData(Long voteContentId) throws VoteApplicationException
- {
- return voteUploadedFileDAO.getOfflineFilesMetaData(voteContentId);
- }
-
- public boolean isUuidPersisted(String uuid) throws VoteApplicationException
- {
- return voteUploadedFileDAO.isUuidPersisted(uuid);
- }
-
/**
* adds a new entry to the uploaded files table
*/
@@ -2263,74 +2184,148 @@
logger.debug("files meta data has been cleaned up");
}
+
- public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline) throws VoteApplicationException {
- try
- {
- return voteUploadedFileDAO.retrieveVoteUploadedFiles(voteContentId, fileOnline);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: "
- + e.getMessage(),
- e);
- }
- }
+ /* ===============Methods implemented from ToolContentImport102Manager =============== */
+
- public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId) throws VoteApplicationException {
- try
- {
- return voteUploadedFileDAO.retrieveVoteUploadedOfflineFilesUuid(voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: offline + uuids "
- + e.getMessage(),
- e);
- }
+ /**
+ * Import the data for a 1.0.2 Chat
+ */
+ public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues)
+ {
+ Date now = new Date();
+ VoteContent toolContentObj = new VoteContent();
+ toolContentObj.setContentInUse(Boolean.FALSE);
+ toolContentObj.setCreatedBy(user.getUserID().longValue());
+ toolContentObj.setCreationDate(now);
+ toolContentObj.setDefineLater(Boolean.FALSE);
+ toolContentObj.setInstructions((String)importValues.get(ToolContentImport102Manager.CONTENT_BODY));
+ toolContentObj.setOfflineInstructions(null);
+ toolContentObj.setOnlineInstructions(null);
+ toolContentObj.setReflectionSubject(null);
+ toolContentObj.setReflect(Boolean.FALSE);
+ toolContentObj.setRunOffline(Boolean.FALSE);
+ toolContentObj.setTitle((String)importValues.get(ToolContentImport102Manager.CONTENT_TITLE));
+
+ toolContentObj.setContent(null);
+ toolContentObj.setUpdateDate(now);
+ toolContentObj.setVoteContentId(toolContentId);
+ toolContentObj.setVoteChangable(Boolean.FALSE);
+
+ try {
+ Boolean bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_VOTE_ALLOW_POLL_NOMINATIONS);
+ toolContentObj.setAllowText(bool!=null?bool:false);
+
+ bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_MB_REUSABLE);
+ toolContentObj.setLockOnFinish(bool!=null?bool:true);
+
+ Integer maxCount = WDDXProcessor.convertToInteger(importValues, ToolContentImport102Manager.CONTENT_VOTE_MAXCHOOSE);
+ toolContentObj.setMaxNominationCount(maxCount != null ? maxCount.toString() : "1");
+
+ } catch (WDDXProcessorConversionException e) {
+ logger.error("Unable to content for activity "+toolContentObj.getTitle()+"properly due to a WDDXProcessorConversionException.",e);
+ throw new ToolException("Invalid import data format for activity "+toolContentObj.getTitle()+"- WDDX caused an exception. Some data from the design will have been lost. See log for more details.");
+ }
+
+ // leave as empty, no need to set them to anything.
+ //setVoteUploadedFiles(Set voteAttachments);
+ //setVoteSessions(Set voteSessions);
+
+ // set up question from body
+ Vector nominations = (Vector) importValues.get(CONTENT_VOTE_NOMINATIONS);
+ if ( nominations != null ) {
+ Iterator iter = nominations.iterator();
+ int order = 1;
+ while (iter.hasNext()) {
+ String element = (String) iter.next();
+ VoteQueContent nomination = new VoteQueContent(element, toolContentObj, null);
+ nomination.setDisplayOrder(order++);
+ toolContentObj.getVoteQueContents().add(nomination);
+ }
+ }
+
+ voteContentDAO.saveVoteContent(toolContentObj);
+ }
+
+ /** Set the description, throws away the title value as this is not supported in 2.0 */
+ public void setReflectiveData(Long toolContentId, String title, String description)
+ throws ToolException, DataMissingException {
+
+ VoteContent toolContentObj = null;
+ if ( toolContentId != null ) {
+ toolContentObj=retrieveVote(toolContentId);
+ }
+ if ( toolContentObj == null ) {
+ throw new DataMissingException("Unable to set reflective data titled "+title
+ +" on activity toolContentId "+toolContentId
+ +" as the tool content does not exist.");
+ }
+
+ toolContentObj.setReflect(Boolean.TRUE);
+ toolContentObj.setReflectionSubject(description);
+ }
+
+ public Long createNotebookEntry(Long id, Integer idType, String signature,
+ Integer userID, String entry) {
+ logger.debug("coreNotebookService: " + coreNotebookService);
+ return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry);
}
- public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId) throws VoteApplicationException {
- try
- {
- return voteUploadedFileDAO.retrieveVoteUploadedOnlineFilesUuid(voteContentId);
- }
- catch (DataAccessException e)
- {
- throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: online + uuids "
- + e.getMessage(),
- e);
- }
+
+
+ public NotebookEntry getEntry(Long id, Integer idType, String signature,
+ Integer userID) {
+
+ ListAction class that controls the logic of tool behavior.
@@ -77,6 +85,68 @@ * * @author Ozgur Demirtas * + * ++
+
+
-
-
-
-
-
-
+
-
-
+
+
-
-
-
+
+
+
+
+
+
+
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+ ');"
+ style="float:right;width:150px" class="button-add-item">
+
+
+
+ ');"
+ style="float:right;width:150px" class="button-add-item">
+
-
-
+
-
-
+
-
+
-
-
+
+
+
-
-
- images/down.gif" align=left onclick="javascript:submitModifyNomination('1','moveNominationDown');">
-
+
-
-
+  
+
+
+
+
+
-
-
-
- images/up.gif" align=left onclick="javascript:submitModifyNomination('
images/down.gif" align=left onclick="javascript:submitModifyNomination('
images/up.gif" align=left onclick="javascript:submitModifyNomination('
-
-
-
-
-
-
-
-
-
-  
-  
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_vote/web/authoring/InstructionsContent.jsp
===================================================================
diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4
--- lams_tool_vote/web/authoring/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf)
+++ lams_tool_vote/web/authoring/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -1,3 +1,4 @@
+
<%--
Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
License Information: http://lamsfoundation.org/licensing/lams/2.0/
@@ -13,143 +14,185 @@
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
http://www.gnu.org/licenses/gpl.txt
--%>
+<%@ include file="/common/taglibs.jsp" %>
-<%@ taglib uri="tags-bean" prefix="bean"%>
-<%@ taglib uri="tags-html" prefix="html"%>
-<%@ taglib uri="tags-logic" prefix="logic" %>
-<%@ taglib uri="tags-logic-el" prefix="logic-el" %>
-<%@ taglib uri="tags-core" prefix="c"%>
-<%@ taglib uri="tags-fmt" prefix="fmt" %>
-<%@ taglib uri="fck-editor" prefix="FCK" %>
-<%@ taglib uri="tags-lams" prefix="lams" %>
+
-
+
-
-
+
-
-
+
-
-
-
+
-
+
+
-
-
-
-
-
-
+
-
-
-
-
+
-
-
+
+
-
+
+
-
+
+
-
-
-
+
-
+
+
+
Index: lams_tool_vote/web/authoring/editNominationBox.jsp
===================================================================
diff -u
--- lams_tool_vote/web/authoring/editNominationBox.jsp (revision 0)
+++ lams_tool_vote/web/authoring/editNominationBox.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -0,0 +1,94 @@
+<%--
+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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ http://www.gnu.org/licenses/gpl.txt
+--%>
+
+
+
+<%@ include file="/common/taglibs.jsp"%>
+
+
+ <%@ include file="/common/header.jsp"%>
+
+
+
+
-
+
-
+
+
-
-
-
+
+
+
+
-
-
+
+
-
+
-
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
-
-
- images/delete.gif" align=left onclick="javascript:submitDeleteFile('
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '/>")' class="button">
+
+
-
-
-
-
+
-
-
+
+
-
-
+
+
+
-
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
- images/delete.gif" align=left onclick="javascript:submitDeleteFile('
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '/>")' class="button">
+
+
-
+
-
-
-
+
+
+
+
-
-
-
-  
-
-
+
+
+
+
Index: lams_tool_vote/web/authoring/itemlist.jsp
===================================================================
diff -u
--- lams_tool_vote/web/authoring/itemlist.jsp (revision 0)
+++ lams_tool_vote/web/authoring/itemlist.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -0,0 +1,103 @@
+<%--
+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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ http://www.gnu.org/licenses/gpl.txt
+--%>
+
+<%@ include file="/common/taglibs.jsp" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                     
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ images/down.gif" border="0">
+
+
images/up.gif" border="0">
+
+
images/down.gif" border="0">
+
+
+ ','moveNominationUp');">
+
images/up.gif" border="0">
+
+
+ ');">
+
+
+ images/edit.gif" border="0">
+
+
+
+
+ images/delete.gif" border="0">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ images/down.gif" border="0">
+
+
images/up.gif" border="0">
+
+
images/down.gif" border="0">
+
+
+
+
images/up.gif" border="0">
+
+
+
+
+
+ images/edit.gif" border="0">
+
+
+
+
+ images/delete.gif" border="0">
+
+
+
+
+
+
+
Index: lams_tool_vote/web/common/header.jsp
===================================================================
diff -u -rc277bb1c30c1283b5f66c6f651855c51a5f87bc5 -r00759d7592ccc90e8769763524afb69546f641d4
--- lams_tool_vote/web/common/header.jsp (.../header.jsp) (revision c277bb1c30c1283b5f66c6f651855c51a5f87bc5)
+++ lams_tool_vote/web/common/header.jsp (.../header.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -1,25 +1,36 @@
<%@ include file="/common/taglibs.jsp"%>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                     
+
+
+
+
+
+
+
+   
Index: lams_tool_vote/web/images/iconInformation.gif
===================================================================
diff -u
Binary files differ
Index: lams_tool_vote/web/images/iconWarning.gif
===================================================================
diff -u
Binary files differ
Index: lams_tool_vote/web/includes/blank.jsp
===================================================================
diff -u
--- lams_tool_vote/web/includes/blank.jsp (revision 0)
+++ lams_tool_vote/web/includes/blank.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -0,0 +1,3 @@
+<%@ include file="/common/taglibs.jsp" %>
+<%@ include file="/common/messages.jsp" %>
+
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/css/rsrc.css'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_vote/web/includes/error.jsp
===================================================================
diff -u
--- lams_tool_vote/web/includes/error.jsp (revision 0)
+++ lams_tool_vote/web/includes/error.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -0,0 +1,7 @@
+<%@ page language="java" %>
+<%@ include file="/includes/taglibs.jsp" %>
+
+
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/fckcontroller.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/rsrccommon.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/rsrcresourceitem.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/tabcontroller.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/tree.js'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/tree_tpl.js'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_vote/web/includes/layout.jsp
===================================================================
diff -u
--- lams_tool_vote/web/includes/layout.jsp (revision 0)
+++ lams_tool_vote/web/includes/layout.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4)
@@ -0,0 +1,32 @@
+
+
+<%@ include file="/common/taglibs.jsp"%>
+<%@ taglib uri="tags-tiles" prefix="tiles"%>
+
+
+
+
+
+
+
+
+
+
+
+
@@ -42,7 +36,7 @@
-