Index: lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.hbm.xml =================================================================== diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.hbm.xml (.../VoteContent.hbm.xml) (revision d56929f06ad90a63082d514e6521adc175f3de27) +++ lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.hbm.xml (.../VoteContent.hbm.xml) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -68,6 +68,14 @@ column="update_date" length="20" /> + + + + + + + Index: lams_tool_vote/conf/language/ApplicationResources_en_AU.properties =================================================================== diff -u -ra92b4616d8c3c1c449e2ea93e9f46d08550a17b6 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/conf/language/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision a92b4616d8c3c1c449e2ea93e9f46d08550a17b6) +++ lams_tool_vote/conf/language/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -147,6 +147,10 @@ maxNomination.invalid =Please fix this: Max Votes [Advanced Tab] is invalid. nominations.duplicate =Please fix this: There are duplicate nomination entries. errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes +label.waiting.for.leader =Please, wait while somebody will become a group leader. +label.users.from.group =Other users participating in current group: +label.use.select.leader.tool.output =Use leaders from Select Leader tool +label.group.leader =Group Leader: {0} +label.refresh =Refresh - #======= End labels: Exported 141 labels for en AU ===== Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java =================================================================== diff -u -rded6335c9a04246994586bba62b43b577d2e6fb2 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision ded6335c9a04246994586bba62b43b577d2e6fb2) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -66,6 +66,7 @@ public static final String MIN_NOMINATION_COUNT = "minNominationCount"; public static final String MAX_NOMINATION_COUNT = "maxNominationCount"; public static final String ALLOW_TEXT = "allowText"; + public static final String USE_SELECT_LEADER_TOOL_OUTPUT = "useSelectLeaderToolOuput"; public static final String ALLOW_TEXT_ENTRY = "allowTextEntry"; public static final String SHOW_RESULTS = "showResults"; public static final String LOCK_ON_FINISH = "lockOnFinish"; @@ -135,6 +136,7 @@ public static final String TOOL_CONTENT_ID = "toolContentID"; public static final String TOOL_CONTENT_UID = "toolContentUID"; public static final String TOOL_SESSION_ID = "toolSessionID"; + public static final String ATTR_CONTENT = "content"; public static final String USER_ID = "userID"; public static final String MAX_OPTION_INDEX = "maxOptionIndex"; public static final String COPY_TOOL_CONTENT = "copyToolContent"; @@ -143,9 +145,11 @@ public static final String RUN_OFFLINE = "runOffline"; - // for submission deadline LDEV-2657 public static final String ATTR_SUBMISSION_DEADLINE = "submissionDeadline"; public static final String ATTR_IS_SUBMISSION_DEADLINE_PASSED = "isSubmissionDeadlinePassed"; + public static final String ATTR_GROUP_USERS = "groupUsers"; + public static final String ATTR_IS_USER_LEADER = "isUserLeader"; + public static final String ATTR_GROUP_LEADER_NAME = "groupLeaderName"; /* * refers to number of questions presented initially, we have a single record for default content @@ -203,6 +207,7 @@ 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 WAIT_FOR_LEADER = "waitForLeader"; public static final String EDIT_ACTIVITY_DTO = "editActivityDTO"; @@ -354,4 +359,8 @@ public static final String SUCCESS = "success"; public static final Integer DATA_FLOW_OBJECT_ASSIGMENT_ID = 0; + + //Leader selection tool Constants + public static final String LEADER_SELECTION_TOOL_SIGNATURE = "lalead11"; + public static final String LEADER_SELECTION_TOOL_OUTPUT_NAME_LEADER_USERID = "leader.user.id"; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java =================================================================== diff -u -r618abc7cca98f08ef288878ab371a3693492d835 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java (.../VoteGeneralAuthoringDTO.java) (revision 618abc7cca98f08ef288878ab371a3693492d835) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java (.../VoteGeneralAuthoringDTO.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -27,16 +27,14 @@ import org.apache.commons.lang.builder.ToStringBuilder; - - /** - *

DTO that holds authoring properties for authoring jsps + *

+ * DTO that holds authoring properties for authoring jsps *

* * @author Ozgur Demirtas */ -public class VoteGeneralAuthoringDTO implements Comparable -{ +public class VoteGeneralAuthoringDTO implements Comparable { protected String activeModule; protected String defineLaterInEditMode; protected String submissionAttempt; @@ -48,699 +46,827 @@ protected String isDefineLater; protected String activityTitle; protected String activityInstructions; - protected int maxOptionIndex; + protected int maxOptionIndex; protected String defaultOptionContent; protected String richTextOfflineInstructions; protected String richTextOnlineInstructions; - - protected List listUploadedOfflineFileNames; - protected List listUploadedOnlineFileNames; - protected List listOfflineFilesMetadata; - protected List listOnlineFilesMetadata; - + + protected List listUploadedOfflineFileNames; + protected List listUploadedOnlineFileNames; + protected List listOfflineFilesMetadata; + protected List listOnlineFilesMetadata; + protected String onlineInstructions; - protected String offlineInstructions; - - protected String allowText; - protected String showResults; - protected String lockOnFinish; - protected String maxNominationCount; - protected String minNominationCount; - - protected String editActivityEditMode; - protected Map mapOptionsContent; - protected String userExceptionMaxNominationInvalid; - protected String userExceptionNoToolSessions; - protected String userExceptionFilenameEmpty; - protected String isMonitoredContentInUse; - protected String validationError; - protected String userExceptionOptionsDuplicate; - protected String httpSessionID; + protected String offlineInstructions; - protected String contentFolderID; + protected String useSelectLeaderToolOuput; + protected String allowText; + protected String showResults; + protected String lockOnFinish; + protected String maxNominationCount; + protected String minNominationCount; + + protected String editActivityEditMode; + protected Map mapOptionsContent; + protected String userExceptionMaxNominationInvalid; + protected String userExceptionNoToolSessions; + protected String userExceptionFilenameEmpty; + protected String isMonitoredContentInUse; + 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; - protected List dataFlowObjectNames; - + protected List dataFlowObjectNames; + public List getDataFlowObjectNames() { - return dataFlowObjectNames; + return dataFlowObjectNames; } + public void setDataFlowObjectNames(List dataFlowObjectNames) { - this.dataFlowObjectNames = dataFlowObjectNames; + this.dataFlowObjectNames = dataFlowObjectNames; } + /** * @return Returns the httpSessionID. */ public String getHttpSessionID() { - return httpSessionID; + return httpSessionID; } + /** - * @param httpSessionID The httpSessionID to set. + * @param httpSessionID + * The httpSessionID to set. */ public void setHttpSessionID(String httpSessionID) { - this.httpSessionID = httpSessionID; + this.httpSessionID = httpSessionID; } + /** * @return Returns the maxNominationCount. */ public String getMaxNominationCount() { - return maxNominationCount; + return maxNominationCount; } + /** - * @param maxNominationCount The maxNominationCount to set. + * @param maxNominationCount + * The maxNominationCount to set. */ public void setMaxNominationCount(String maxNominationCount) { - this.maxNominationCount = maxNominationCount; + this.maxNominationCount = maxNominationCount; } + /** * @return Returns the minNominationCount. */ public String getMinNominationCount() { - return minNominationCount; + return minNominationCount; } + /** - * @param minNominationCount The minNominationCount to set. + * @param minNominationCount + * The minNominationCount to set. */ public void setMinNominationCount(String minNominationCount) { - this.minNominationCount = minNominationCount; - } + this.minNominationCount = minNominationCount; + } + /** * @return Returns the activeModule. */ public String getActiveModule() { - return activeModule; + return activeModule; } + /** - * @param listOfflineFilesMetadata The listOfflineFilesMetadata to set. + * @param listOfflineFilesMetadata + * The listOfflineFilesMetadata to set. */ public void setListOfflineFilesMetadata(List listOfflineFilesMetadata) { - this.listOfflineFilesMetadata = listOfflineFilesMetadata; + this.listOfflineFilesMetadata = listOfflineFilesMetadata; } + /** - * @param listOnlineFilesMetadata The listOnlineFilesMetadata to set. + * @param listOnlineFilesMetadata + * The listOnlineFilesMetadata to set. */ public void setListOnlineFilesMetadata(List listOnlineFilesMetadata) { - this.listOnlineFilesMetadata = listOnlineFilesMetadata; + this.listOnlineFilesMetadata = listOnlineFilesMetadata; } + /** - * @param listUploadedOnlineFileNames The listUploadedOnlineFileNames to set. + * @param listUploadedOnlineFileNames + * The listUploadedOnlineFileNames to set. */ public void setListUploadedOnlineFileNames(List listUploadedOnlineFileNames) { - this.listUploadedOnlineFileNames = listUploadedOnlineFileNames; + this.listUploadedOnlineFileNames = listUploadedOnlineFileNames; } - - + /** * @return Returns the isMonitoredContentInUse. */ public String getIsMonitoredContentInUse() { - return isMonitoredContentInUse; + return isMonitoredContentInUse; } + /** - * @param isMonitoredContentInUse The isMonitoredContentInUse to set. + * @param isMonitoredContentInUse + * The isMonitoredContentInUse to set. */ public void setIsMonitoredContentInUse(String isMonitoredContentInUse) { - this.isMonitoredContentInUse = isMonitoredContentInUse; + this.isMonitoredContentInUse = isMonitoredContentInUse; } + /** - * @param activeModule The activeModule to set. + * @param activeModule + * The activeModule to set. */ public void setActiveModule(String activeModule) { - this.activeModule = activeModule; + this.activeModule = activeModule; } + /** * @return Returns the activityInstructions. */ public String getActivityInstructions() { - return activityInstructions; + return activityInstructions; } + /** - * @param activityInstructions The activityInstructions to set. + * @param activityInstructions + * The activityInstructions to set. */ public void setActivityInstructions(String activityInstructions) { - this.activityInstructions = activityInstructions; + this.activityInstructions = activityInstructions; } + /** * @return Returns the activityTitle. */ public String getActivityTitle() { - return activityTitle; + return activityTitle; } + /** - * @param activityTitle The activityTitle to set. + * @param activityTitle + * The activityTitle to set. */ public void setActivityTitle(String activityTitle) { - this.activityTitle = activityTitle; + this.activityTitle = activityTitle; } + /** * @return Returns the defaultContentId. */ public String getDefaultContentId() { - return defaultContentId; + return defaultContentId; } + /** - * @param defaultContentId The defaultContentId to set. + * @param defaultContentId + * The defaultContentId to set. */ public void setDefaultContentId(String defaultContentId) { - this.defaultContentId = defaultContentId; + this.defaultContentId = defaultContentId; } + /** * @return Returns the defaultContentIdStr. */ public String getDefaultContentIdStr() { - return defaultContentIdStr; + return defaultContentIdStr; } + /** - * @param defaultContentIdStr The defaultContentIdStr to set. + * @param defaultContentIdStr + * The defaultContentIdStr to set. */ public void setDefaultContentIdStr(String defaultContentIdStr) { - this.defaultContentIdStr = defaultContentIdStr; + this.defaultContentIdStr = defaultContentIdStr; } + /** * @return Returns the defaultOptionContent. */ public String getDefaultOptionContent() { - return defaultOptionContent; + return defaultOptionContent; } + /** - * @param defaultOptionContent The defaultOptionContent to set. + * @param defaultOptionContent + * The defaultOptionContent to set. */ public void setDefaultOptionContent(String defaultOptionContent) { - this.defaultOptionContent = defaultOptionContent; + this.defaultOptionContent = defaultOptionContent; } + /** * @return Returns the defineLaterInEditMode. */ public String getDefineLaterInEditMode() { - return defineLaterInEditMode; + return defineLaterInEditMode; } + /** - * @param defineLaterInEditMode The defineLaterInEditMode to set. + * @param defineLaterInEditMode + * The defineLaterInEditMode to set. */ public void setDefineLaterInEditMode(String defineLaterInEditMode) { - this.defineLaterInEditMode = defineLaterInEditMode; + this.defineLaterInEditMode = defineLaterInEditMode; } + /** * @return Returns the exceptionMaxNominationInvalid. */ public String getExceptionMaxNominationInvalid() { - return exceptionMaxNominationInvalid; + return exceptionMaxNominationInvalid; } + /** - * @param exceptionMaxNominationInvalid The exceptionMaxNominationInvalid to set. + * @param exceptionMaxNominationInvalid + * The exceptionMaxNominationInvalid to set. */ - public void setExceptionMaxNominationInvalid( - String exceptionMaxNominationInvalid) { - this.exceptionMaxNominationInvalid = exceptionMaxNominationInvalid; + public void setExceptionMaxNominationInvalid(String exceptionMaxNominationInvalid) { + this.exceptionMaxNominationInvalid = exceptionMaxNominationInvalid; } + /** * @return Returns the isDefineLater. */ public String getIsDefineLater() { - return isDefineLater; + return isDefineLater; } + /** - * @param isDefineLater The isDefineLater to set. + * @param isDefineLater + * The isDefineLater to set. */ public void setIsDefineLater(String isDefineLater) { - this.isDefineLater = isDefineLater; + this.isDefineLater = isDefineLater; } - + /** * @return Returns the listUploadedOfflineFileNames. */ public List getListUploadedOfflineFileNames() { - return listUploadedOfflineFileNames; + return listUploadedOfflineFileNames; } + /** - * @param listUploadedOfflineFileNames The listUploadedOfflineFileNames to set. + * @param listUploadedOfflineFileNames + * The listUploadedOfflineFileNames to set. */ - public void setListUploadedOfflineFileNames( - List listUploadedOfflineFileNames) { - this.listUploadedOfflineFileNames = listUploadedOfflineFileNames; + public void setListUploadedOfflineFileNames(List listUploadedOfflineFileNames) { + this.listUploadedOfflineFileNames = listUploadedOfflineFileNames; } + /** * @return Returns the maxOptionIndex. */ public int getMaxOptionIndex() { - return maxOptionIndex; + return maxOptionIndex; } + /** - * @param maxOptionIndex The maxOptionIndex to set. + * @param maxOptionIndex + * The maxOptionIndex to set. */ public void setMaxOptionIndex(int maxOptionIndex) { - this.maxOptionIndex = maxOptionIndex; + this.maxOptionIndex = maxOptionIndex; } + /** * @return Returns the richTextOfflineInstructions. */ public String getRichTextOfflineInstructions() { - return richTextOfflineInstructions; + return richTextOfflineInstructions; } + /** - * @param richTextOfflineInstructions The richTextOfflineInstructions to set. + * @param richTextOfflineInstructions + * The richTextOfflineInstructions to set. */ - public void setRichTextOfflineInstructions( - String richTextOfflineInstructions) { - this.richTextOfflineInstructions = richTextOfflineInstructions; + public void setRichTextOfflineInstructions(String richTextOfflineInstructions) { + this.richTextOfflineInstructions = richTextOfflineInstructions; } + /** * @return Returns the richTextOnlineInstructions. */ public String getRichTextOnlineInstructions() { - return richTextOnlineInstructions; + return richTextOnlineInstructions; } + /** - * @param richTextOnlineInstructions The richTextOnlineInstructions to set. + * @param richTextOnlineInstructions + * The richTextOnlineInstructions to set. */ public void setRichTextOnlineInstructions(String richTextOnlineInstructions) { - this.richTextOnlineInstructions = richTextOnlineInstructions; + this.richTextOnlineInstructions = richTextOnlineInstructions; } + /** * @return Returns the sbmtSuccess. */ public String getSbmtSuccess() { - return sbmtSuccess; + return sbmtSuccess; } + /** - * @param sbmtSuccess The sbmtSuccess to set. + * @param sbmtSuccess + * The sbmtSuccess to set. */ public void setSbmtSuccess(String sbmtSuccess) { - this.sbmtSuccess = sbmtSuccess; + this.sbmtSuccess = sbmtSuccess; } + /** * @return Returns the submissionAttempt. */ public String getSubmissionAttempt() { - return submissionAttempt; + return submissionAttempt; } + /** - * @param submissionAttempt The submissionAttempt to set. + * @param submissionAttempt + * The submissionAttempt to set. */ public void setSubmissionAttempt(String submissionAttempt) { - this.submissionAttempt = submissionAttempt; + this.submissionAttempt = submissionAttempt; } + /** * @return Returns the toolContentID. */ public String getToolContentID() { - return toolContentID; + return toolContentID; } + /** - * @param toolContentID The toolContentID to set. + * @param toolContentID + * The toolContentID to set. */ public void setToolContentID(String toolContentID) { - this.toolContentID = toolContentID; + this.toolContentID = toolContentID; } - + /** * @return Returns the offlineInstructions. */ public String getOfflineInstructions() { - return offlineInstructions; + return offlineInstructions; } + /** - * @param offlineInstructions The offlineInstructions to set. + * @param offlineInstructions + * The offlineInstructions to set. */ public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; + this.offlineInstructions = offlineInstructions; } + /** * @return Returns the onlineInstructions. */ public String getOnlineInstructions() { - return onlineInstructions; + return onlineInstructions; } + /** - * @param onlineInstructions The onlineInstructions to set. + * @param onlineInstructions + * The onlineInstructions to set. */ public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; + this.onlineInstructions = onlineInstructions; } + /** * @return Returns the listOfflineFilesMetadata. */ public List getListOfflineFilesMetadata() { - return listOfflineFilesMetadata; + return listOfflineFilesMetadata; } + /** * @return Returns the listOnlineFilesMetadata. */ public List getListOnlineFilesMetadata() { - return listOnlineFilesMetadata; + return listOnlineFilesMetadata; } + /** * @return Returns the listUploadedOnlineFileNames. */ public List getListUploadedOnlineFileNames() { - return listUploadedOnlineFileNames; + return listUploadedOnlineFileNames; } - /** + * @return Returns the useSelectLeaderToolOuput. + */ + public String getUseSelectLeaderToolOuput() { + return useSelectLeaderToolOuput; + } + + /** + * @param useSelectLeaderToolOuput + * The useSelectLeaderToolOuput to set. + */ + public void setUseSelectLeaderToolOuput(String useSelectLeaderToolOuput) { + this.useSelectLeaderToolOuput = useSelectLeaderToolOuput; + } + + /** * @return Returns the allowText. */ public String getAllowText() { - return allowText; + return allowText; } + /** - * @param allowText The allowText to set. + * @param allowText + * The allowText to set. */ public void setAllowText(String allowText) { - this.allowText = allowText; + this.allowText = allowText; } + /** * @return Returns the lockOnFinish. */ public String getLockOnFinish() { - return lockOnFinish; + return lockOnFinish; } + /** - * @param lockOnFinish The lockOnFinish to set. + * @param lockOnFinish + * The lockOnFinish to set. */ public void setLockOnFinish(String lockOnFinish) { - this.lockOnFinish = lockOnFinish; + this.lockOnFinish = lockOnFinish; } /** * @return Returns the mapOptionsContent. */ public Map getMapOptionsContent() { - return mapOptionsContent; + return mapOptionsContent; } + /** - * @param mapOptionsContent The mapOptionsContent to set. + * @param mapOptionsContent + * The mapOptionsContent to set. */ public void setMapOptionsContent(Map mapOptionsContent) { - this.mapOptionsContent = mapOptionsContent; + this.mapOptionsContent = mapOptionsContent; } - + /** * @return Returns the userExceptionMaxNominationInvalid. */ public String getUserExceptionMaxNominationInvalid() { - return userExceptionMaxNominationInvalid; + return userExceptionMaxNominationInvalid; } + /** - * @param userExceptionMaxNominationInvalid The userExceptionMaxNominationInvalid to set. + * @param userExceptionMaxNominationInvalid + * The userExceptionMaxNominationInvalid to set. */ - public void setUserExceptionMaxNominationInvalid( - String userExceptionMaxNominationInvalid) { - this.userExceptionMaxNominationInvalid = userExceptionMaxNominationInvalid; + public void setUserExceptionMaxNominationInvalid(String userExceptionMaxNominationInvalid) { + this.userExceptionMaxNominationInvalid = userExceptionMaxNominationInvalid; } + /** * @return Returns the userExceptionOptionsDuplicate. */ public String getUserExceptionOptionsDuplicate() { - return userExceptionOptionsDuplicate; + return userExceptionOptionsDuplicate; } + /** - * @param userExceptionOptionsDuplicate The userExceptionOptionsDuplicate to set. + * @param userExceptionOptionsDuplicate + * The userExceptionOptionsDuplicate to set. */ - public void setUserExceptionOptionsDuplicate( - String userExceptionOptionsDuplicate) { - this.userExceptionOptionsDuplicate = userExceptionOptionsDuplicate; + public void setUserExceptionOptionsDuplicate(String userExceptionOptionsDuplicate) { + this.userExceptionOptionsDuplicate = userExceptionOptionsDuplicate; } + /** * @return Returns the validationError. */ public String getValidationError() { - return validationError; + return validationError; } + /** - * @param validationError The validationError to set. + * @param validationError + * The validationError to set. */ public void setValidationError(String validationError) { - this.validationError = validationError; + this.validationError = validationError; } - + /** * @return Returns the editActivityEditMode. */ public String getEditActivityEditMode() { - return editActivityEditMode; + return editActivityEditMode; } - + /** - * @param editActivityEditMode The editActivityEditMode to set. + * @param editActivityEditMode + * The editActivityEditMode to set. */ public void setEditActivityEditMode(String editActivityEditMode) { - this.editActivityEditMode = editActivityEditMode; + this.editActivityEditMode = editActivityEditMode; } + /** * @return Returns the userExceptionNoToolSessions. */ public String getUserExceptionNoToolSessions() { - return userExceptionNoToolSessions; + return userExceptionNoToolSessions; } + /** - * @param userExceptionNoToolSessions The userExceptionNoToolSessions to set. + * @param userExceptionNoToolSessions + * The userExceptionNoToolSessions to set. */ - public void setUserExceptionNoToolSessions( - String userExceptionNoToolSessions) { - this.userExceptionNoToolSessions = userExceptionNoToolSessions; + public void setUserExceptionNoToolSessions(String userExceptionNoToolSessions) { + this.userExceptionNoToolSessions = userExceptionNoToolSessions; } /** * @return Returns the userExceptionFilenameEmpty. */ public String getUserExceptionFilenameEmpty() { - return userExceptionFilenameEmpty; + return userExceptionFilenameEmpty; } + /** - * @param userExceptionFilenameEmpty The userExceptionFilenameEmpty to set. + * @param userExceptionFilenameEmpty + * The userExceptionFilenameEmpty to set. */ public void setUserExceptionFilenameEmpty(String userExceptionFilenameEmpty) { - this.userExceptionFilenameEmpty = userExceptionFilenameEmpty; - } - public int compareTo(Object o) - { - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = (VoteGeneralAuthoringDTO) o; - - if (voteGeneralAuthoringDTO == null) - return 1; - else - return 0; + this.userExceptionFilenameEmpty = userExceptionFilenameEmpty; } - 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("reflect: ", reflect) - .append("isDefineLater: ", isDefineLater) - .append("allowText: ", allowText) - .append("showResults: ", showResults) - .append("lockOnFinish: ", lockOnFinish) - .append("maxNominationCount: ", maxNominationCount) - .append("minNominationCount: ", minNominationCount) - .append("activityTitle: ", activityTitle) - .append("activityInstructions: ", activityInstructions) - .append("maxOptionIndex: ", maxOptionIndex) - .append("defaultOptionContent: ", defaultOptionContent) - .append("richTextOfflineInstructions: ", richTextOfflineInstructions) - .append("richTextOnlineInstructions: ", richTextOnlineInstructions) - .append("listUploadedOfflineFileNames: ", listUploadedOfflineFileNames) - .append("listUploadedOnlineFileNames: ", listUploadedOnlineFileNames) - .append("listOfflineFilesMetadata: ", listOfflineFilesMetadata) - .append("listOnlineFilesMetadata: ", listOnlineFilesMetadata) - .append("mapOptionsContent: ", mapOptionsContent) - .append("onlineInstructions: ", onlineInstructions) - .append("offlineInstructions: ", offlineInstructions) - .append("userExceptionMaxNominationInvalid: ", userExceptionMaxNominationInvalid) - .append("userExceptionFilenameEmpty: ", userExceptionFilenameEmpty) - .append("isMonitoredContentInUse: ", isMonitoredContentInUse) - .append("validationError: ", validationError) - .append("userExceptionOptionsDuplicate: ", userExceptionOptionsDuplicate) - .append("userExceptionNoToolSessions: ", userExceptionNoToolSessions) - .append("httpSessionID: ", httpSessionID) - .append("editActivityEditMode: ", editActivityEditMode) - .toString(); + public int compareTo(Object o) { + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = (VoteGeneralAuthoringDTO) o; + + if (voteGeneralAuthoringDTO == null) + return 1; + else + return 0; } - + + 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("reflect: ", reflect) + .append("isDefineLater: ", isDefineLater).append("allowText: ", allowText) + .append("showResults: ", showResults).append("lockOnFinish: ", lockOnFinish) + .append("maxNominationCount: ", maxNominationCount).append("minNominationCount: ", minNominationCount) + .append("activityTitle: ", activityTitle).append("activityInstructions: ", activityInstructions) + .append("maxOptionIndex: ", maxOptionIndex).append("defaultOptionContent: ", defaultOptionContent) + .append("richTextOfflineInstructions: ", richTextOfflineInstructions) + .append("richTextOnlineInstructions: ", richTextOnlineInstructions) + .append("listUploadedOfflineFileNames: ", listUploadedOfflineFileNames) + .append("listUploadedOnlineFileNames: ", listUploadedOnlineFileNames) + .append("listOfflineFilesMetadata: ", listOfflineFilesMetadata) + .append("listOnlineFilesMetadata: ", listOnlineFilesMetadata) + .append("mapOptionsContent: ", mapOptionsContent).append("onlineInstructions: ", onlineInstructions) + .append("offlineInstructions: ", offlineInstructions) + .append("userExceptionMaxNominationInvalid: ", userExceptionMaxNominationInvalid) + .append("userExceptionFilenameEmpty: ", userExceptionFilenameEmpty) + .append("isMonitoredContentInUse: ", isMonitoredContentInUse) + .append("validationError: ", validationError) + .append("userExceptionOptionsDuplicate: ", userExceptionOptionsDuplicate) + .append("userExceptionNoToolSessions: ", userExceptionNoToolSessions) + .append("httpSessionID: ", httpSessionID).append("editActivityEditMode: ", editActivityEditMode) + .toString(); + } + /** * @return Returns the contentFolderID. */ public String getContentFolderID() { - return contentFolderID; + return contentFolderID; } + /** - * @param contentFolderID The contentFolderID to set. + * @param contentFolderID + * The contentFolderID to set. */ public void setContentFolderID(String contentFolderID) { - this.contentFolderID = contentFolderID; + this.contentFolderID = contentFolderID; } + /** * @return Returns the editableQuestionFeedback. */ public String getEditableQuestionFeedback() { - return editableQuestionFeedback; + return editableQuestionFeedback; } + /** - * @param editableQuestionFeedback The editableQuestionFeedback to set. + * @param editableQuestionFeedback + * The editableQuestionFeedback to set. */ public void setEditableQuestionFeedback(String editableQuestionFeedback) { - this.editableQuestionFeedback = editableQuestionFeedback; + this.editableQuestionFeedback = editableQuestionFeedback; } + /** * @return Returns the editableQuestionText. */ public String getEditableQuestionText() { - return editableQuestionText; + return editableQuestionText; } + /** - * @param editableQuestionText The editableQuestionText to set. + * @param editableQuestionText + * The editableQuestionText to set. */ public void setEditableQuestionText(String editableQuestionText) { - this.editableQuestionText = editableQuestionText; + this.editableQuestionText = editableQuestionText; } - + /** * @return Returns the attachmentList. */ public List getAttachmentList() { - return attachmentList; + return attachmentList; } + /** - * @param attachmentList The attachmentList to set. + * @param attachmentList + * The attachmentList to set. */ public void setAttachmentList(List attachmentList) { - this.attachmentList = attachmentList; + this.attachmentList = attachmentList; } + /** * @return Returns the deletedAttachmentList. */ public List getDeletedAttachmentList() { - return deletedAttachmentList; + return deletedAttachmentList; } + /** - * @param deletedAttachmentList The deletedAttachmentList to set. + * @param deletedAttachmentList + * The deletedAttachmentList to set. */ public void setDeletedAttachmentList(List deletedAttachmentList) { - this.deletedAttachmentList = deletedAttachmentList; + this.deletedAttachmentList = deletedAttachmentList; } + /** * @return Returns the reflect. */ public String getReflect() { - return reflect; + return reflect; } + /** - * @param reflect The reflect to set. + * @param reflect + * The reflect to set. */ public void setReflect(String reflect) { - this.reflect = reflect; + this.reflect = reflect; } + /** * @return Returns the reflectionSubject. */ public String getReflectionSubject() { - return reflectionSubject; + return reflectionSubject; } + /** - * @param reflectionSubject The reflectionSubject to set. + * @param reflectionSubject + * The reflectionSubject to set. */ public void setReflectionSubject(String reflectionSubject) { - this.reflectionSubject = reflectionSubject; + this.reflectionSubject = reflectionSubject; } + /** * @return Returns the editableNominationFeedback. */ public String getEditableNominationFeedback() { - return editableNominationFeedback; + return editableNominationFeedback; } + /** - * @param editableNominationFeedback The editableNominationFeedback to set. + * @param editableNominationFeedback + * The editableNominationFeedback to set. */ public void setEditableNominationFeedback(String editableNominationFeedback) { - this.editableNominationFeedback = editableNominationFeedback; + this.editableNominationFeedback = editableNominationFeedback; } + /** * @return Returns the editableNominationText. */ public String getEditableNominationText() { - return editableNominationText; + return editableNominationText; } + /** - * @param editableNominationText The editableNominationText to set. + * @param editableNominationText + * The editableNominationText to set. */ public void setEditableNominationText(String editableNominationText) { - this.editableNominationText = editableNominationText; + this.editableNominationText = editableNominationText; } + /** * @return Returns the mapNominationContent. */ public Map getMapNominationContent() { - return mapNominationContent; + return mapNominationContent; } + /** - * @param mapNominationContent The mapNominationContent to set. + * @param mapNominationContent + * The mapNominationContent to set. */ public void setMapNominationContent(Map mapNominationContent) { - this.mapNominationContent = mapNominationContent; + this.mapNominationContent = mapNominationContent; } + /** * @return Returns the isToolSessionChanged. */ public String getIsToolSessionChanged() { - return isToolSessionChanged; + return isToolSessionChanged; } + /** - * @param isToolSessionChanged The isToolSessionChanged to set. + * @param isToolSessionChanged + * The isToolSessionChanged to set. */ public void setIsToolSessionChanged(String isToolSessionChanged) { - this.isToolSessionChanged = isToolSessionChanged; + this.isToolSessionChanged = isToolSessionChanged; } + /** * @return Returns the currentUid. */ public String getCurrentUid() { - return currentUid; + return currentUid; } + /** - * @param currentUid The currentUid to set. + * @param currentUid + * The currentUid to set. */ public void setCurrentUid(String currentUid) { - this.currentUid = currentUid; + this.currentUid = currentUid; } + /** * @return Returns the responseId. */ public String getResponseId() { - return responseId; + return responseId; } + /** - * @param responseId The responseId to set. + * @param responseId + * The responseId to set. */ public void setResponseId(String responseId) { - this.responseId = responseId; + this.responseId = responseId; } - public String getShowResults() { - return showResults; - } - public void setShowResults(String showResults) { - this.showResults = showResults; - } + + public String getShowResults() { + return showResults; + } + + public void setShowResults(String showResults) { + this.showResults = showResults; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralLearnerFlowDTO.java =================================================================== diff -u -r57a242c8553eeec5781c2106493aa9f34efa5489 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralLearnerFlowDTO.java (.../VoteGeneralLearnerFlowDTO.java) (revision 57a242c8553eeec5781c2106493aa9f34efa5489) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralLearnerFlowDTO.java (.../VoteGeneralLearnerFlowDTO.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -28,600 +28,701 @@ import org.apache.commons.lang.builder.ToStringBuilder; - - /** - *

DTO that holds learner flow decision properties and some other view-only properties + *

+ * DTO that holds learner flow decision properties and some other view-only properties *

* * @author Ozgur Demirtas */ -public class VoteGeneralLearnerFlowDTO implements Comparable -{ +public class VoteGeneralLearnerFlowDTO implements Comparable { protected String activityTitle; - + protected String activityInstructions; - + protected String revisitingUser; - + protected String userEntry; - + protected String userName; - + protected String castVoteCount; - + protected String maxNominationCountReached; - + protected String minNominationCountReached; - + protected String activityRunOffline; - + protected String toolSessionID; - + protected String toolContentID; - + protected String toolContentUID; - + protected String learningMode; - + protected String maxNominationCount; - + protected String minNominationCount; - + + protected String useSelectLeaderToolOuput; + protected String allowTextEntry; - + protected String showResults; protected String lockOnFinish; - + protected String notebookEntriesVisible; - + protected String reflection; - + protected String reflectionSubject; - + protected String notebookEntry; - + protected String totalQuestionCount; - + protected String previewOnly; - + protected String reportViewOnly; - + protected String requestLearningReport; - + protected String requestLearningReportProgress; - + protected String nominationsSubmited; - + protected Date submissionDeadline; - - protected Map mapGeneralCheckedOptionsContent; - + + protected Map mapGeneralCheckedOptionsContent; + protected Map mapStandardNominationsContent; - + protected Map mapStandardNominationsHTMLedContent; - + protected Map mapStandardRatesContent; - + protected Map mapStandardUserCount; - + protected Map mapStandardQuestionUid; - + protected Map mapStandardToolSessionUid; - + protected List listMonitoredAnswersContainerDto; - + protected List listUserEntries; - + /** * @return Returns the activityRunOffline. */ public String getActivityRunOffline() { - return activityRunOffline; + return activityRunOffline; } + /** - * @param activityRunOffline The activityRunOffline to set. + * @param activityRunOffline + * The activityRunOffline to set. */ public void setActivityRunOffline(String activityRunOffline) { - this.activityRunOffline = activityRunOffline; + this.activityRunOffline = activityRunOffline; } + /** * @return Returns the castVoteCount. */ public String getCastVoteCount() { - return castVoteCount; + return castVoteCount; } + /** - * @param castVoteCount The castVoteCount to set. + * @param castVoteCount + * The castVoteCount to set. */ public void setCastVoteCount(String castVoteCount) { - this.castVoteCount = castVoteCount; + this.castVoteCount = castVoteCount; } + /** * @return Returns the maxNominationCountReached. */ public String getMaxNominationCountReached() { - return maxNominationCountReached; + return maxNominationCountReached; } + /** - * @param maxNominationCountReached The maxNominationCountReached to set. + * @param maxNominationCountReached + * The maxNominationCountReached to set. */ public void setMaxNominationCountReached(String maxNominationCountReached) { - this.maxNominationCountReached = maxNominationCountReached; + this.maxNominationCountReached = maxNominationCountReached; } + /** * @return Returns the minNominationCountReached. */ public String getMinNominationCountReached() { - return minNominationCountReached; + return minNominationCountReached; } + /** - * @param minNominationCountReached The minNominationCountReached to set. + * @param minNominationCountReached + * The minNominationCountReached to set. */ public void setMinNominationCountReached(String minNominationCountReached) { - this.minNominationCountReached = minNominationCountReached; - } + this.minNominationCountReached = minNominationCountReached; + } + /** * @return Returns the revisitingUser. */ public String getRevisitingUser() { - return revisitingUser; + return revisitingUser; } + /** - * @param revisitingUser The revisitingUser to set. + * @param revisitingUser + * The revisitingUser to set. */ public void setRevisitingUser(String revisitingUser) { - this.revisitingUser = revisitingUser; + this.revisitingUser = revisitingUser; } + /** * @return Returns the userEntry. */ public String getUserEntry() { - return userEntry; + return userEntry; } + /** - * @param userEntry The userEntry to set. + * @param userEntry + * The userEntry to set. */ public void setUserEntry(String userEntry) { - this.userEntry = userEntry; + this.userEntry = userEntry; } - /** + /** * @return Returns the activityInstructions. */ public String getActivityInstructions() { - return activityInstructions; + return activityInstructions; } + /** - * @param activityInstructions The activityInstructions to set. + * @param activityInstructions + * The activityInstructions to set. */ public void setActivityInstructions(String activityInstructions) { - this.activityInstructions = activityInstructions; + this.activityInstructions = activityInstructions; } + /** * @return Returns the activityTitle. */ public String getActivityTitle() { - return activityTitle; + return activityTitle; } + /** - * @param activityTitle The activityTitle to set. + * @param activityTitle + * The activityTitle to set. */ public void setActivityTitle(String activityTitle) { - this.activityTitle = activityTitle; + this.activityTitle = activityTitle; } + /** * @return Returns the learningMode. */ public String getLearningMode() { - return learningMode; + return learningMode; } + /** - * @param learningMode The learningMode to set. + * @param learningMode + * The learningMode to set. */ public void setLearningMode(String learningMode) { - this.learningMode = learningMode; + this.learningMode = learningMode; } + /** * @return Returns the toolSessionID. */ public String getToolSessionID() { - return toolSessionID; + return toolSessionID; } + /** - * @param toolSessionID The toolSessionID to set. + * @param toolSessionID + * The toolSessionID to set. */ public void setToolSessionID(String toolSessionID) { - this.toolSessionID = toolSessionID; + this.toolSessionID = toolSessionID; } /** + * @return Returns the useSelectLeaderToolOuput. + */ + public String getUseSelectLeaderToolOuput() { + return useSelectLeaderToolOuput; + } + + /** + * @param useSelectLeaderToolOuput + * The useSelectLeaderToolOuput to set. + */ + public void setUseSelectLeaderToolOuput(String useSelectLeaderToolOuput) { + this.useSelectLeaderToolOuput = useSelectLeaderToolOuput; + } + + /** * @return Returns the allowTextEntry. */ public String getAllowTextEntry() { - return allowTextEntry; + return allowTextEntry; } + /** - * @param allowTextEntry The allowTextEntry to set. + * @param allowTextEntry + * The allowTextEntry to set. */ public void setAllowTextEntry(String allowTextEntry) { - this.allowTextEntry = allowTextEntry; + this.allowTextEntry = allowTextEntry; } + /** * @return Returns the lockOnFinish. */ public String getLockOnFinish() { - return lockOnFinish; + return lockOnFinish; } + /** - * @param lockOnFinish The lockOnFinish to set. + * @param lockOnFinish + * The lockOnFinish to set. */ public void setLockOnFinish(String lockOnFinish) { - this.lockOnFinish = lockOnFinish; + this.lockOnFinish = lockOnFinish; } + /** * @return Returns the maxNominationCount. */ public String getMaxNominationCount() { - return maxNominationCount; + return maxNominationCount; } + /** - * @param maxNominationCount The maxNominationCount to set. + * @param maxNominationCount + * The maxNominationCount to set. */ public void setMaxNominationCount(String maxNominationCount) { - this.maxNominationCount = maxNominationCount; + this.maxNominationCount = maxNominationCount; } + /** * @return Returns the minNominationCount. */ public String getMinNominationCount() { - return minNominationCount; + return minNominationCount; } + /** - * @param minNominationCount The minNominationCount to set. + * @param minNominationCount + * The minNominationCount to set. */ public void setMinNominationCount(String minNominationCount) { - this.minNominationCount = minNominationCount; - } - + this.minNominationCount = minNominationCount; + } + /** * @return Returns the toolContentID. */ public String getToolContentID() { - return toolContentID; + return toolContentID; } + /** - * @param toolContentID The toolContentID to set. + * @param toolContentID + * The toolContentID to set. */ public void setToolContentID(String toolContentID) { - this.toolContentID = toolContentID; + this.toolContentID = toolContentID; } + /** * @return Returns the toolContentUID. */ public String getToolContentUID() { - return toolContentUID; + return toolContentUID; } + /** - * @param toolContentUID The toolContentUID to set. + * @param toolContentUID + * The toolContentUID to set. */ public void setToolContentUID(String toolContentUID) { - this.toolContentUID = toolContentUID; - } - + this.toolContentUID = toolContentUID; + } + /** - * @return the submissionDeadline - */ - public Date getSubmissionDeadline() { - return submissionDeadline; - } - /** - * @param submissionDeadline the submissionDeadline to set - */ - public void setSubmissionDeadline(Date submissionDeadline) { - this.submissionDeadline = submissionDeadline; - } - + * @return the submissionDeadline + */ + public Date getSubmissionDeadline() { + return submissionDeadline; + } + /** + * @param submissionDeadline + * the submissionDeadline to set + */ + public void setSubmissionDeadline(Date submissionDeadline) { + this.submissionDeadline = submissionDeadline; + } + + /** * @return Returns the previewOnly. */ public String getPreviewOnly() { - return previewOnly; + return previewOnly; } + /** - * @param previewOnly The previewOnly to set. + * @param previewOnly + * The previewOnly to set. */ public void setPreviewOnly(String previewOnly) { - this.previewOnly = previewOnly; + this.previewOnly = previewOnly; } - + /** * @return Returns the totalQuestionCount. */ public String getTotalQuestionCount() { - return totalQuestionCount; + return totalQuestionCount; } + /** - * @param totalQuestionCount The totalQuestionCount to set. + * @param totalQuestionCount + * The totalQuestionCount to set. */ public void setTotalQuestionCount(String totalQuestionCount) { - this.totalQuestionCount = totalQuestionCount; + this.totalQuestionCount = totalQuestionCount; } /** * @return Returns the listUserEntries. */ public List getListUserEntries() { - return listUserEntries; + return listUserEntries; } + /** - * @param listUserEntries The listUserEntries to set. + * @param listUserEntries + * The listUserEntries to set. */ public void setListUserEntries(List listUserEntries) { - this.listUserEntries = listUserEntries; + this.listUserEntries = listUserEntries; } - public int compareTo(Object o) - { - VoteGeneralLearnerFlowDTO voteGeneralLearnerFlowDTO = (VoteGeneralLearnerFlowDTO) o; - - if (voteGeneralLearnerFlowDTO == null) - return 1; - else - return 0; + + public int compareTo(Object o) { + VoteGeneralLearnerFlowDTO voteGeneralLearnerFlowDTO = (VoteGeneralLearnerFlowDTO) o; + + if (voteGeneralLearnerFlowDTO == null) + return 1; + else + return 0; } - public String toString() { - return new ToStringBuilder(this) - .append("activityInstructions: ", activityInstructions) - .append("activityTitle: ", activityTitle) - .append("revisitingUser: ", revisitingUser) - .append("userEntry: ", userEntry) - .append("castVoteCount: ", castVoteCount) - .append("maxNominationCountReached: ", maxNominationCountReached) - .append("activityRunOffline: ", activityRunOffline) - .append("toolSessionID: ", toolSessionID) - .append("learningMode: ", learningMode) - .append("maxNominationCount: ", maxNominationCount) - .append("allowTextEntry: ", allowTextEntry) - .append("showResults: ", showResults) - .append("lockOnFinish: ", lockOnFinish) - .append("toolContentID: ", toolContentID) - .append("toolContentUID: ", toolContentUID) - .append("totalQuestionCount: ", totalQuestionCount) - .append("requestLearningReport: ", requestLearningReport) - .append("requestLearningReportProgress: ", requestLearningReportProgress) - .append("nominationsSubmited: ", nominationsSubmited) - .append("mapGeneralCheckedOptionsContent: ", mapGeneralCheckedOptionsContent) - .append("mapStandardNominationsContent: ", mapStandardNominationsContent) - .append("mapStandardNominationsHTMLedContent: ", mapStandardNominationsHTMLedContent) - .append("mapStandardRatesContent: ", mapStandardRatesContent) - .append("mapStandardUserCount: ", mapStandardUserCount) - .append("mapStandardQuestionUid: ", mapStandardQuestionUid) - .append("mapStandardToolSessionUid: ", mapStandardToolSessionUid) - .append("listMonitoredAnswersContainerDto: ", listMonitoredAnswersContainerDto) - .append("listUserEntries: ", listUserEntries) - .append("reportViewOnly: ", reportViewOnly) - .toString(); + public String toString() { + return new ToStringBuilder(this).append("activityInstructions: ", activityInstructions) + .append("activityTitle: ", activityTitle).append("revisitingUser: ", revisitingUser) + .append("userEntry: ", userEntry).append("castVoteCount: ", castVoteCount) + .append("maxNominationCountReached: ", maxNominationCountReached) + .append("activityRunOffline: ", activityRunOffline).append("toolSessionID: ", toolSessionID) + .append("learningMode: ", learningMode).append("maxNominationCount: ", maxNominationCount) + .append("allowTextEntry: ", allowTextEntry).append("showResults: ", showResults) + .append("lockOnFinish: ", lockOnFinish).append("toolContentID: ", toolContentID) + .append("toolContentUID: ", toolContentUID).append("totalQuestionCount: ", totalQuestionCount) + .append("requestLearningReport: ", requestLearningReport) + .append("requestLearningReportProgress: ", requestLearningReportProgress) + .append("nominationsSubmited: ", nominationsSubmited) + .append("mapGeneralCheckedOptionsContent: ", mapGeneralCheckedOptionsContent) + .append("mapStandardNominationsContent: ", mapStandardNominationsContent) + .append("mapStandardNominationsHTMLedContent: ", mapStandardNominationsHTMLedContent) + .append("mapStandardRatesContent: ", mapStandardRatesContent) + .append("mapStandardUserCount: ", mapStandardUserCount) + .append("mapStandardQuestionUid: ", mapStandardQuestionUid) + .append("mapStandardToolSessionUid: ", mapStandardToolSessionUid) + .append("listMonitoredAnswersContainerDto: ", listMonitoredAnswersContainerDto) + .append("listUserEntries: ", listUserEntries).append("reportViewOnly: ", reportViewOnly).toString(); } - - + /** * @return Returns the reportViewOnly. */ public String getReportViewOnly() { - return reportViewOnly; + return reportViewOnly; } + /** - * @param reportViewOnly The reportViewOnly to set. + * @param reportViewOnly + * The reportViewOnly to set. */ public void setReportViewOnly(String reportViewOnly) { - this.reportViewOnly = reportViewOnly; + this.reportViewOnly = reportViewOnly; } + /** * @return Returns the nominationsSubmited. */ public String getNominationsSubmited() { - return nominationsSubmited; + return nominationsSubmited; } + /** - * @param nominationsSubmited The nominationsSubmited to set. + * @param nominationsSubmited + * The nominationsSubmited to set. */ public void setNominationsSubmited(String nominationsSubmited) { - this.nominationsSubmited = nominationsSubmited; + this.nominationsSubmited = nominationsSubmited; } + /** * @return Returns the requestLearningReport. */ public String getRequestLearningReport() { - return requestLearningReport; + return requestLearningReport; } + /** - * @param requestLearningReport The requestLearningReport to set. + * @param requestLearningReport + * The requestLearningReport to set. */ public void setRequestLearningReport(String requestLearningReport) { - this.requestLearningReport = requestLearningReport; + this.requestLearningReport = requestLearningReport; } + /** * @return Returns the requestLearningReportProgress. */ public String getRequestLearningReportProgress() { - return requestLearningReportProgress; + return requestLearningReportProgress; } + /** - * @param requestLearningReportProgress The requestLearningReportProgress to set. + * @param requestLearningReportProgress + * The requestLearningReportProgress to set. */ - public void setRequestLearningReportProgress( - String requestLearningReportProgress) { - this.requestLearningReportProgress = requestLearningReportProgress; + public void setRequestLearningReportProgress(String requestLearningReportProgress) { + this.requestLearningReportProgress = requestLearningReportProgress; } + /** * @return Returns the mapStandardNominationsContent. */ public Map getMapStandardNominationsContent() { - return mapStandardNominationsContent; + return mapStandardNominationsContent; } + /** - * @param mapStandardNominationsContent The mapStandardNominationsContent to set. + * @param mapStandardNominationsContent + * The mapStandardNominationsContent to set. */ - public void setMapStandardNominationsContent( - Map mapStandardNominationsContent) { - this.mapStandardNominationsContent = mapStandardNominationsContent; + public void setMapStandardNominationsContent(Map mapStandardNominationsContent) { + this.mapStandardNominationsContent = mapStandardNominationsContent; } + /** * @return Returns the mapStandardNominationsHTMLedContent. */ public Map getMapStandardNominationsHTMLedContent() { - return mapStandardNominationsHTMLedContent; + return mapStandardNominationsHTMLedContent; } + /** - * @param mapStandardNominationsHTMLedContent The mapStandardNominationsHTMLedContent to set. + * @param mapStandardNominationsHTMLedContent + * The mapStandardNominationsHTMLedContent to set. */ - public void setMapStandardNominationsHTMLedContent( - Map mapStandardNominationsHTMLedContent) { - this.mapStandardNominationsHTMLedContent = mapStandardNominationsHTMLedContent; + public void setMapStandardNominationsHTMLedContent(Map mapStandardNominationsHTMLedContent) { + this.mapStandardNominationsHTMLedContent = mapStandardNominationsHTMLedContent; } + /** * @return Returns the mapStandardRatesContent. */ public Map getMapStandardRatesContent() { - return mapStandardRatesContent; + return mapStandardRatesContent; } + /** - * @param mapStandardRatesContent The mapStandardRatesContent to set. + * @param mapStandardRatesContent + * The mapStandardRatesContent to set. */ public void setMapStandardRatesContent(Map mapStandardRatesContent) { - this.mapStandardRatesContent = mapStandardRatesContent; + this.mapStandardRatesContent = mapStandardRatesContent; } + /** * @return Returns the mapStandardUserCount. */ public Map getMapStandardUserCount() { - return mapStandardUserCount; + return mapStandardUserCount; } + /** - * @param mapStandardUserCount The mapStandardUserCount to set. + * @param mapStandardUserCount + * The mapStandardUserCount to set. */ public void setMapStandardUserCount(Map mapStandardUserCount) { - this.mapStandardUserCount = mapStandardUserCount; + this.mapStandardUserCount = mapStandardUserCount; } + /** * @return Returns the listMonitoredAnswersContainerDto. */ public List getListMonitoredAnswersContainerDto() { - return listMonitoredAnswersContainerDto; + return listMonitoredAnswersContainerDto; } + /** - * @param listMonitoredAnswersContainerDto The listMonitoredAnswersContainerDto to set. + * @param listMonitoredAnswersContainerDto + * The listMonitoredAnswersContainerDto to set. */ - public void setListMonitoredAnswersContainerDto( - List listMonitoredAnswersContainerDto) { - this.listMonitoredAnswersContainerDto = listMonitoredAnswersContainerDto; + public void setListMonitoredAnswersContainerDto(List listMonitoredAnswersContainerDto) { + this.listMonitoredAnswersContainerDto = listMonitoredAnswersContainerDto; } + /** * @return Returns the mapGeneralCheckedOptionsContent. */ public Map getMapGeneralCheckedOptionsContent() { - return mapGeneralCheckedOptionsContent; + return mapGeneralCheckedOptionsContent; } + /** - * @param mapGeneralCheckedOptionsContent The mapGeneralCheckedOptionsContent to set. + * @param mapGeneralCheckedOptionsContent + * The mapGeneralCheckedOptionsContent to set. */ - public void setMapGeneralCheckedOptionsContent( - Map mapGeneralCheckedOptionsContent) { - this.mapGeneralCheckedOptionsContent = mapGeneralCheckedOptionsContent; + public void setMapGeneralCheckedOptionsContent(Map mapGeneralCheckedOptionsContent) { + this.mapGeneralCheckedOptionsContent = mapGeneralCheckedOptionsContent; } + /** * @return Returns the mapStandardQuestionUid. */ public Map getMapStandardQuestionUid() { - return mapStandardQuestionUid; + return mapStandardQuestionUid; } + /** - * @param mapStandardQuestionUid The mapStandardQuestionUid to set. + * @param mapStandardQuestionUid + * The mapStandardQuestionUid to set. */ public void setMapStandardQuestionUid(Map mapStandardQuestionUid) { - this.mapStandardQuestionUid = mapStandardQuestionUid; + this.mapStandardQuestionUid = mapStandardQuestionUid; } + /** * @return Returns the mapStandardToolSessionUid. */ public Map getMapStandardToolSessionUid() { - return mapStandardToolSessionUid; + return mapStandardToolSessionUid; } + /** - * @param mapStandardToolSessionUid The mapStandardToolSessionUid to set. + * @param mapStandardToolSessionUid + * The mapStandardToolSessionUid to set. */ public void setMapStandardToolSessionUid(Map mapStandardToolSessionUid) { - this.mapStandardToolSessionUid = mapStandardToolSessionUid; + this.mapStandardToolSessionUid = mapStandardToolSessionUid; } - + /** * @return Returns the notebookEntriesVisible. */ public String getNotebookEntriesVisible() { - return notebookEntriesVisible; + return notebookEntriesVisible; } + /** - * @param notebookEntriesVisible The notebookEntriesVisible to set. + * @param notebookEntriesVisible + * The notebookEntriesVisible to set. */ public void setNotebookEntriesVisible(String notebookEntriesVisible) { - this.notebookEntriesVisible = notebookEntriesVisible; + this.notebookEntriesVisible = notebookEntriesVisible; } + /** * @return Returns the notebookEntry. */ public String getNotebookEntry() { - return notebookEntry; + return notebookEntry; } + /** - * @param notebookEntry The notebookEntry to set. + * @param notebookEntry + * The notebookEntry to set. */ public void setNotebookEntry(String notebookEntry) { - this.notebookEntry = notebookEntry; + this.notebookEntry = notebookEntry; } + /** * @return Returns the reflection. */ public String getReflection() { - return reflection; + return reflection; } + /** - * @param reflection The reflection to set. + * @param reflection + * The reflection to set. */ public void setReflection(String reflection) { - this.reflection = reflection; + this.reflection = reflection; } + /** * @return Returns the reflectionSubject. */ public String getReflectionSubject() { - return reflectionSubject; + return reflectionSubject; } + /** - * @param reflectionSubject The reflectionSubject to set. + * @param reflectionSubject + * The reflectionSubject to set. */ public void setReflectionSubject(String reflectionSubject) { - this.reflectionSubject = reflectionSubject; + this.reflectionSubject = reflectionSubject; } - + /** * @return Returns the userName. */ public String getUserName() { - return userName; + return userName; } + /** - * @param userName The userName to set. + * @param userName + * The userName to set. */ public void setUserName(String userName) { - this.userName = userName; + this.userName = userName; } - public String getShowResults() { - return showResults; - } - public void setShowResults(String showResults) { - this.showResults = showResults; - } - + + public String getShowResults() { + return showResults; + } + + public void setShowResults(String showResults) { + this.showResults = showResults; + } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -45,622 +45,524 @@ import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; - /** - *

Common Voting utility functions live here.

+ *

+ * Common Voting utility functions live here. + *

* * @author Ozgur Demirtas */ public abstract class VoteUtils implements VoteAppConstants { - - public static String replaceNewLines(String text) - { - String newText = ""; - if (text != null) - { - newText = text.replaceAll("\n","
"); - } - - return newText; + + public static String replaceNewLines(String text) { + String newText = ""; + if (text != null) { + newText = text.replaceAll("\n", "
"); + } + + return newText; } - public static String getCurrentLearnerID() - { - String userID = ""; - HttpSession ss = SessionManager.getSession(); - - if (ss != null) - { - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - if ((user != null) && (user.getUserID() != null)) - { - userID = user.getUserID().toString(); - } - } - return userID; + public static String getCurrentLearnerID() { + String userID = ""; + HttpSession ss = SessionManager.getSession(); + + if (ss != null) { + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user != null) && (user.getUserID() != null)) { + userID = user.getUserID().toString(); + } + } + return userID; } - - - /** - * - * getGMTDateTime(HttpServletRequest request) - * - * @param request - * @return - */ - /* fix this */ - public static Date getGMTDateTime() - { - Date date=new Date(System.currentTimeMillis()); - return date; + /** + * + * getGMTDateTime(HttpServletRequest request) + * + * @param request + * @return + */ + /* fix this */ + public static Date getGMTDateTime() { + Date date = new Date(System.currentTimeMillis()); + return date; } - - - public static UserDTO getToolUser() - { - /*obtain user object from the session*/ - HttpSession ss = SessionManager.getSession(); - /* get back login user DTO */ - UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); - return toolUser; - } - - - public static Long getUserId() - { - UserDTO toolUser=getToolUser(); - long userId=toolUser.getUserID().longValue(); - return new Long(userId); - } - - public static String getUserName() - { - /* double check if username and login is the same */ - UserDTO toolUser=getToolUser(); - String userName=toolUser.getLogin(); - return userName; - } - - public static String getUserFullName() - { - UserDTO toolUser=getToolUser(); - String fullName=toolUser.getFirstName() + " " + toolUser.getLastName(); - return fullName; - } - - public static String getFormattedDateString(Date date) - { - return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); - } - - public static void saveTimeZone(HttpServletRequest request) - { - TimeZone timeZone=TimeZone.getDefault(); - } - - public static String getCurrentTimeZone() - { - TimeZone timeZone=TimeZone.getDefault(); - return timeZone.getDisplayName(); - } - - - /** - * existsContent(long toolContentId) - * @param long toolContentId - * @return boolean - * determine whether a specific toolContentId exists in the db - */ - public static boolean existsContent(Long toolContentId, HttpServletRequest request, IVoteService voteService) - { + public static String getFormattedDateString(Date date) { + return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); + } - VoteContent voteContent=voteService.retrieveVote(toolContentId); - if (voteContent == null) - return false; + public static void saveTimeZone(HttpServletRequest request) { + TimeZone timeZone = TimeZone.getDefault(); + } - - return true; - } + public static String getCurrentTimeZone() { + TimeZone timeZone = TimeZone.getDefault(); + return timeZone.getDisplayName(); + } - /** - * it is expected that the tool session id already exists in the tool sessions table - * existsSession(long toolSessionId) - * @param toolSessionId - * @return boolean - */ - public static boolean existsSession(Long toolSessionId, HttpServletRequest request, IVoteService voteService) - { - - VoteSession voteSession=voteService.retrieveVoteSession(toolSessionId); - - if (voteSession == null) - return false; - - return true; - } - - - public static void readContentValues(HttpServletRequest request, VoteContent defaultVoteContent, - VoteAuthoringForm voteAuthoringForm, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO) - { - /*should never be null anyway as default content MUST exist in the db*/ - if(defaultVoteContent == null) - throw new NullPointerException("Default VoteContent cannot be null"); - - voteGeneralAuthoringDTO.setActivityTitle(defaultVoteContent.getTitle()); - voteGeneralAuthoringDTO.setActivityInstructions(defaultVoteContent.getInstructions()); - - voteAuthoringForm.setAllowText(defaultVoteContent.isAllowText()?"1":"0"); - voteAuthoringForm.setAllowTextEntry(defaultVoteContent.isAllowText()?"1":"0"); + /** + * existsContent(long toolContentId) + * + * @param long toolContentId + * @return boolean determine whether a specific toolContentId exists in the db + */ + public static boolean existsContent(Long toolContentId, HttpServletRequest request, IVoteService voteService) { - voteAuthoringForm.setShowResults(defaultVoteContent.isShowResults()?"1":"0"); - - voteAuthoringForm.setLockOnFinish(defaultVoteContent.isLockOnFinish()?"1":"0"); - voteAuthoringForm.setReflect(defaultVoteContent.isReflect()?"1":"0"); - - voteAuthoringForm.setOnlineInstructions(defaultVoteContent.getOnlineInstructions()); - voteAuthoringForm.setOfflineInstructions(defaultVoteContent.getOfflineInstructions()); - + VoteContent voteContent = voteService.retrieveVote(toolContentId); + if (voteContent == null) + return false; - voteGeneralAuthoringDTO.setAllowText(defaultVoteContent.isAllowText()?"1":"0"); - voteGeneralAuthoringDTO.setLockOnFinish(defaultVoteContent.isLockOnFinish()?"1":"0"); - voteAuthoringForm.setReflect(defaultVoteContent.isReflect()?"1":"0"); - - voteGeneralAuthoringDTO.setOnlineInstructions(defaultVoteContent.getOnlineInstructions()); - voteGeneralAuthoringDTO.setOfflineInstructions(defaultVoteContent.getOfflineInstructions()); + return true; + } - - String maxNomcount= defaultVoteContent.getMaxNominationCount(); - if (maxNomcount.equals("")) - maxNomcount="0"; - voteAuthoringForm.setMaxNominationCount(maxNomcount); - voteGeneralAuthoringDTO.setMaxNominationCount(maxNomcount); - - String minNomcount= defaultVoteContent.getMinNominationCount(); - if ((minNomcount == null) || minNomcount.equals("")) - minNomcount="0"; - voteAuthoringForm.setMinNominationCount(minNomcount); - voteGeneralAuthoringDTO.setMinNominationCount(minNomcount); - } + /** + * it is expected that the tool session id already exists in the tool sessions table existsSession(long + * toolSessionId) + * + * @param toolSessionId + * @return boolean + */ + public static boolean existsSession(Long toolSessionId, HttpServletRequest request, IVoteService voteService) { + VoteSession voteSession = voteService.retrieveVoteSession(toolSessionId); - public static String stripHTML(String htmlText) - { - String noHTMLText = htmlText.replaceAll("\\<.*?\\>","").replaceAll(" ","").replaceAll("&#[0-9][0-9][0-9][0-9];",""); - String[] htmlTokens = noHTMLText.split("\n"); - String noHtmlNoNewLineStr=""; - for (int i=0; i < htmlTokens.length ; i++) - { - if (!htmlTokens[i].trim().equals("")) - { - noHtmlNoNewLineStr = noHtmlNoNewLineStr.length() > 0 ? noHtmlNoNewLineStr + " " + htmlTokens[i] : htmlTokens[i]; - } - } - - if (noHtmlNoNewLineStr.trim().length()==0) - { - //nomination text is just composed of html markup, try getting just a src entry for a picture otherwise give up - htmlText = htmlText.toLowerCase(); - int index = htmlText.indexOf("src"); - if ( index > -1 ) { - index = htmlText.indexOf("\"",index); - if ( index > -1 && index < htmlText.length()) { - int indexStop = htmlText.indexOf("\"", index+1); - if ( indexStop > -1) { - String srcEntry = htmlText.substring(index+1, indexStop); - // get rid of any leading path and just get the filename; - index = srcEntry.lastIndexOf("/"); - if ( index == srcEntry.length()-1 ) - index = srcEntry.lastIndexOf("/", index); - if ( index > -1 ) { - srcEntry = srcEntry.substring(index+1); - } - return srcEntry; - } - } - } - if (htmlText.length() > 50) - return htmlText.substring(0,51); - else - return htmlText; - } - - if (noHtmlNoNewLineStr.length() > 50) - return noHtmlNoNewLineStr.substring(0,51); - - return noHtmlNoNewLineStr; + if (voteSession == null) + return false; + + return true; } - - public static void saveRichText(HttpServletRequest request, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO, - SessionMap sessionMap) - { - String richTextTitle = request.getParameter(TITLE); - String richTextInstructions = request.getParameter(INSTRUCTIONS); - - - - if (richTextTitle != null) - { - voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); - } - String noHTMLTitle = stripHTML(richTextTitle); + public static void readContentValues(HttpServletRequest request, VoteContent defaultVoteContent, + VoteAuthoringForm voteAuthoringForm, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO) { + /* should never be null anyway as default content MUST exist in the db */ + if (defaultVoteContent == null) + throw new NullPointerException("Default VoteContent cannot be null"); - - if (richTextInstructions != null) - { - voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(defaultVoteContent.getTitle()); + voteGeneralAuthoringDTO.setActivityInstructions(defaultVoteContent.getInstructions()); + + voteAuthoringForm.setUseSelectLeaderToolOuput(defaultVoteContent.isUseSelectLeaderToolOuput() ? "1" : "0"); + voteAuthoringForm.setAllowText(defaultVoteContent.isAllowText() ? "1" : "0"); + voteAuthoringForm.setAllowTextEntry(defaultVoteContent.isAllowText() ? "1" : "0"); + + voteAuthoringForm.setShowResults(defaultVoteContent.isShowResults() ? "1" : "0"); + + voteAuthoringForm.setLockOnFinish(defaultVoteContent.isLockOnFinish() ? "1" : "0"); + voteAuthoringForm.setReflect(defaultVoteContent.isReflect() ? "1" : "0"); + + voteAuthoringForm.setOnlineInstructions(defaultVoteContent.getOnlineInstructions()); + voteAuthoringForm.setOfflineInstructions(defaultVoteContent.getOfflineInstructions()); + + voteGeneralAuthoringDTO + .setUseSelectLeaderToolOuput(defaultVoteContent.isUseSelectLeaderToolOuput() ? "1" : "0"); + voteGeneralAuthoringDTO.setAllowText(defaultVoteContent.isAllowText() ? "1" : "0"); + voteGeneralAuthoringDTO.setLockOnFinish(defaultVoteContent.isLockOnFinish() ? "1" : "0"); + voteAuthoringForm.setReflect(defaultVoteContent.isReflect() ? "1" : "0"); + + voteGeneralAuthoringDTO.setOnlineInstructions(defaultVoteContent.getOnlineInstructions()); + voteGeneralAuthoringDTO.setOfflineInstructions(defaultVoteContent.getOfflineInstructions()); + + String maxNomcount = defaultVoteContent.getMaxNominationCount(); + if (maxNomcount.equals("")) + maxNomcount = "0"; + voteAuthoringForm.setMaxNominationCount(maxNomcount); + voteGeneralAuthoringDTO.setMaxNominationCount(maxNomcount); + + String minNomcount = defaultVoteContent.getMinNominationCount(); + if ((minNomcount == null) || minNomcount.equals("")) + minNomcount = "0"; + voteAuthoringForm.setMinNominationCount(minNomcount); + voteGeneralAuthoringDTO.setMinNominationCount(minNomcount); + } + + public static String stripHTML(String htmlText) { + String noHTMLText = htmlText.replaceAll("\\<.*?\\>", "").replaceAll(" ", "") + .replaceAll("&#[0-9][0-9][0-9][0-9];", ""); + String[] htmlTokens = noHTMLText.split("\n"); + String noHtmlNoNewLineStr = ""; + for (int i = 0; i < htmlTokens.length; i++) { + if (!htmlTokens[i].trim().equals("")) { + noHtmlNoNewLineStr = noHtmlNoNewLineStr.length() > 0 ? noHtmlNoNewLineStr + " " + htmlTokens[i] + : htmlTokens[i]; } - - String richTextOfflineInstructions=request.getParameter(RICHTEXT_OFFLINEINSTRUCTIONS); + } - if ((richTextOfflineInstructions != null) && (richTextOfflineInstructions.length() > 0)) - { - voteGeneralAuthoringDTO.setRichTextOfflineInstructions(richTextOfflineInstructions); - sessionMap.put(OFFLINE_INSTRUCTIONS_KEY,richTextOfflineInstructions); + if (noHtmlNoNewLineStr.trim().length() == 0) { + // nomination text is just composed of html markup, try getting just a src entry for a picture otherwise + // give up + htmlText = htmlText.toLowerCase(); + int index = htmlText.indexOf("src"); + if (index > -1) { + index = htmlText.indexOf("\"", index); + if (index > -1 && index < htmlText.length()) { + int indexStop = htmlText.indexOf("\"", index + 1); + if (indexStop > -1) { + String srcEntry = htmlText.substring(index + 1, indexStop); + // get rid of any leading path and just get the filename; + index = srcEntry.lastIndexOf("/"); + if (index == srcEntry.length() - 1) + index = srcEntry.lastIndexOf("/", index); + if (index > -1) { + srcEntry = srcEntry.substring(index + 1); + } + return srcEntry; + } } + } + if (htmlText.length() > 50) + return htmlText.substring(0, 51); + else + return htmlText; + } - String richTextOnlineInstructions=request.getParameter(RICHTEXT_ONLINEINSTRUCTIONS); - - if ((richTextOnlineInstructions != null) && (richTextOnlineInstructions.length() > 0)) - { - voteGeneralAuthoringDTO.setRichTextOnlineInstructions(richTextOnlineInstructions); - sessionMap.put(ONLINE_INSTRUCTIONS_KEY,richTextOnlineInstructions); - } + if (noHtmlNoNewLineStr.length() > 50) + return noHtmlNoNewLineStr.substring(0, 51); + + return noHtmlNoNewLineStr; + } + + public static void saveRichText(HttpServletRequest request, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO, + SessionMap sessionMap) { + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + if (richTextTitle != null) { + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); } - - - public static void configureContentRepository(HttpServletRequest request, IVoteService voteService) - { - voteService.configureContentRepository(); + String noHTMLTitle = stripHTML(richTextTitle); + + if (richTextInstructions != null) { + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); } - - + String richTextOfflineInstructions = request.getParameter(RICHTEXT_OFFLINEINSTRUCTIONS); + + if ((richTextOfflineInstructions != null) && (richTextOfflineInstructions.length() > 0)) { + voteGeneralAuthoringDTO.setRichTextOfflineInstructions(richTextOfflineInstructions); + sessionMap.put(OFFLINE_INSTRUCTIONS_KEY, richTextOfflineInstructions); + } + + String richTextOnlineInstructions = request.getParameter(RICHTEXT_ONLINEINSTRUCTIONS); + + if ((richTextOnlineInstructions != null) && (richTextOnlineInstructions.length() > 0)) { + voteGeneralAuthoringDTO.setRichTextOnlineInstructions(richTextOnlineInstructions); + sessionMap.put(ONLINE_INSTRUCTIONS_KEY, richTextOnlineInstructions); + } + } + + public static void configureContentRepository(HttpServletRequest request, IVoteService voteService) { + voteService.configureContentRepository(); + } + /** * temporary function + * * @return */ - public static int getCurrentUserId(HttpServletRequest request) throws VoteApplicationException - { - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - return user.getUserID().intValue(); + public static int getCurrentUserId(HttpServletRequest request) throws VoteApplicationException { + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + return user.getUserID().intValue(); } - /** * temporary function + * * @return */ - public static User createSimpleUser(Integer userId) - { - User user=new User(); - user.setUserId(userId); - return user; - } + public static User createSimpleUser(Integer userId) { + User user = new User(); + user.setUserId(userId); + return user; + } /** * temporary function + * * @return */ - public static boolean getDefineLaterStatus() - { - return false; + public static boolean getDefineLaterStatus() { + return false; + } + + /** + * builds a map from a list convertToMap(List sessionsList) + * + * @param sessionsList + * @return Map + */ + public static Map convertToMap(List sessionsList, String listType) { + Map map = new TreeMap(new VoteComparator()); + + Iterator listIterator = sessionsList.iterator(); + Long mapIndex = new Long(1); + + while (listIterator.hasNext()) { + if (listType.equals("String")) { + String text = (String) listIterator.next(); + map.put(mapIndex.toString(), text); + } else if (listType.equals("Long")) { + Long LongValue = (Long) listIterator.next(); + map.put(mapIndex.toString(), LongValue); + } + mapIndex = new Long(mapIndex.longValue() + 1); } - - - /** - * builds a map from a list - * convertToMap(List sessionsList) - * - * @param sessionsList - * @return Map - */ - public static Map convertToMap(List sessionsList, String listType) - { - Map map= new TreeMap(new VoteComparator()); - - Iterator listIterator=sessionsList.iterator(); - Long mapIndex=new Long(1); - - - while (listIterator.hasNext()) - { - if (listType.equals("String")) - { - String text=(String)listIterator.next(); - map.put(mapIndex.toString(), text); - } - else if (listType.equals("Long")) - { - Long LongValue=(Long)listIterator.next(); - map.put(mapIndex.toString(), LongValue); - } - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; + return map; + } + + /** + * builds a String based map from a list convertToMap(List sessionsList) + * + * @param sessionsList + * @return Map + */ + public static Map convertToStringMap(List sessionsList, String listType) { + Map map = new TreeMap(new VoteComparator()); + + Iterator listIterator = sessionsList.iterator(); + Long mapIndex = new Long(1); + + while (listIterator.hasNext()) { + if (listType.equals("String")) { + String text = (String) listIterator.next(); + map.put(mapIndex.toString(), text); + } else if (listType.equals("Long")) { + Long LongValue = (Long) listIterator.next(); + map.put(mapIndex.toString(), LongValue.toString()); + } + mapIndex = new Long(mapIndex.longValue() + 1); } - - - /** - * builds a String based map from a list - * convertToMap(List sessionsList) - * - * @param sessionsList - * @return Map - */ - public static Map convertToStringMap(List sessionsList, String listType) - { - Map map= new TreeMap(new VoteComparator()); - - Iterator listIterator=sessionsList.iterator(); - Long mapIndex=new Long(1); - - - while (listIterator.hasNext()) - { - if (listType.equals("String")) - { - String text=(String)listIterator.next(); - map.put(mapIndex.toString(), text); - } - else if (listType.equals("Long")) - { - Long LongValue=(Long)listIterator.next(); - map.put(mapIndex.toString(), LongValue.toString()); - } - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; - } - - - /** - * find out if the content is in use or not. If it is in use, the author can not modify it. - * The idea of content being in use is, once any one learner starts using a particular content - * that content should become unmodifiable. - * - * isContentInUse(VoteContent voteContent) - * @param voteContent - * @return boolean - */ - public static boolean isContentInUse(VoteContent voteContent) - { - return voteContent.isContentInUse(); - } - - - /** - * find out if the content is being edited in monitoring interface or not. If it is, the author can not modify it. - * - * isDefineLater(VoteContent voteContent) - * @param voteContent - * @return boolean - */ - public static boolean isDefineLater(VoteContent voteContent) - { - return voteContent.isDefineLater(); - } - - - /** - * find out if the content is set to run offline or online. If it is set to run offline , the learners are informed about that.. - * isRubnOffline(VoteContent voteContent) - * - * @param voteContent - * @return boolean - */ - public static boolean isRunOffline(VoteContent voteContent) - { - return voteContent.isRunOffline(); - } + return map; + } - - - public static String getDestination(String sourceVoteStarter) - { - - if ((sourceVoteStarter != null) && !sourceVoteStarter.equals("monitoring")) - { - //request is from authoring or define Later url. return to: LOAD_QUESTIONS - return LOAD_QUESTIONS; - } - else if (sourceVoteStarter == null) - { - //request is from authoring url. return to: LOAD_QUESTIONS - return LOAD_QUESTIONS; - } - else - { - //request is from monitoring url. return to: LOAD_MONITORING_CONTENT_EDITACTIVITY - return LOAD_MONITORING_CONTENT_EDITACTIVITY; - } + /** + * find out if the content is in use or not. If it is in use, the author can not modify it. The idea of content + * being in use is, once any one learner starts using a particular content that content should become unmodifiable. + * + * isContentInUse(VoteContent voteContent) + * + * @param voteContent + * @return boolean + */ + public static boolean isContentInUse(VoteContent voteContent) { + return voteContent.isContentInUse(); + } + + /** + * find out if the content is being edited in monitoring interface or not. If it is, the author can not modify it. + * + * isDefineLater(VoteContent voteContent) + * + * @param voteContent + * @return boolean + */ + public static boolean isDefineLater(VoteContent voteContent) { + return voteContent.isDefineLater(); + } + + /** + * find out if the content is set to run offline or online. If it is set to run offline , the learners are informed + * about that.. isRubnOffline(VoteContent voteContent) + * + * @param voteContent + * @return boolean + */ + public static boolean isRunOffline(VoteContent voteContent) { + return voteContent.isRunOffline(); + } + + public static String getDestination(String sourceVoteStarter) { + + if ((sourceVoteStarter != null) && !sourceVoteStarter.equals("monitoring")) { + // request is from authoring or define Later url. return to: LOAD_QUESTIONS + return LOAD_QUESTIONS; + } else if (sourceVoteStarter == null) { + // request is from authoring url. return to: LOAD_QUESTIONS + return LOAD_QUESTIONS; + } else { + // request is from monitoring url. return to: LOAD_MONITORING_CONTENT_EDITACTIVITY + return LOAD_MONITORING_CONTENT_EDITACTIVITY; } + } - public static void setDefineLater(HttpServletRequest request, boolean value, IVoteService voteService, String toolContentID) - { - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - if (voteContent != null) - { - voteContent.setDefineLater(value); - voteService.updateVote(voteContent); - } + public static void setDefineLater(HttpServletRequest request, boolean value, IVoteService voteService, + String toolContentID) { + + VoteContent voteContent = voteService.retrieveVote(new Long(toolContentID)); + if (voteContent != null) { + voteContent.setDefineLater(value); + voteService.updateVote(voteContent); + } } - - /** - * - * cleanUpSessionAbsolute(HttpServletRequest request) - * @param request - */ - public static void cleanUpSessionAbsolute(HttpServletRequest request) - { - cleanUpUserExceptions(request); + /** + * + * cleanUpSessionAbsolute(HttpServletRequest request) + * + * @param request + */ + public static void cleanUpSessionAbsolute(HttpServletRequest request) { + cleanUpUserExceptions(request); } - + /** - *removes attributes except USER_EXCEPTION_NO_STUDENT_ACTIVITY + * removes attributes except USER_EXCEPTION_NO_STUDENT_ACTIVITY */ - public static void cleanUpUserExceptions(HttpServletRequest request) - { - request.getSession().removeAttribute(USER_EXCEPTION_WRONG_FORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_INCOMPATIBLE_IDS); - request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST); - request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST); - request.getSession().removeAttribute(USER_EXCEPTION_TOOLCONTENT_DOESNOTEXIST); - request.getSession().removeAttribute(USER_EXCEPTION_LEARNER_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_INCONSISTENT); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE); - request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE); - request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTNUMERIC); - request.getSession().removeAttribute(USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS); - request.getSession().removeAttribute(USER_EXCEPTION_USERID_EXISTING); - request.getSession().removeAttribute(USER_EXCEPTION_USER_DOESNOTEXIST); - request.getSession().removeAttribute(USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP); - request.getSession().removeAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS); - request.getSession().removeAttribute(USER_EXCEPTION_MODE_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_IN_USE); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_BEING_MODIFIED); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_RUNOFFLINE); - request.getSession().removeAttribute(USER_EXCEPTION_MODE_INVALID); - request.getSession().removeAttribute(USER_EXCEPTION_QUESTION_EMPTY); - request.getSession().removeAttribute(USER_EXCEPTION_ANSWER_EMPTY); - request.getSession().removeAttribute(USER_EXCEPTION_ANSWERS_DUPLICATE); - request.getSession().removeAttribute(USER_EXCEPTION_OPTIONS_COUNT_ZERO); - request.getSession().removeAttribute(USER_EXCEPTION_CHKBOXES_EMPTY); - request.getSession().removeAttribute(USER_EXCEPTION_SUBMIT_NONE); - request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_FILENAME_EMPTY); - request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_MUST_EQUAL100); - request.getSession().removeAttribute(USER_EXCEPTION_SINGLE_OPTION); + public static void cleanUpUserExceptions(HttpServletRequest request) { + request.getSession().removeAttribute(USER_EXCEPTION_WRONG_FORMAT); + request.getSession().removeAttribute(USER_EXCEPTION_INCOMPATIBLE_IDS); + request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST); + request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST); + request.getSession().removeAttribute(USER_EXCEPTION_TOOLCONTENT_DOESNOTEXIST); + request.getSession().removeAttribute(USER_EXCEPTION_LEARNER_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_INCONSISTENT); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTOPTIONSCONTENT_NOT_AVAILABLE); + request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE); + request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTNUMERIC); + request.getSession().removeAttribute(USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS); + request.getSession().removeAttribute(USER_EXCEPTION_USERID_EXISTING); + request.getSession().removeAttribute(USER_EXCEPTION_USER_DOESNOTEXIST); + request.getSession().removeAttribute(USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP); + request.getSession().removeAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS); + request.getSession().removeAttribute(USER_EXCEPTION_MODE_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_IN_USE); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_BEING_MODIFIED); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_RUNOFFLINE); + request.getSession().removeAttribute(USER_EXCEPTION_MODE_INVALID); + request.getSession().removeAttribute(USER_EXCEPTION_QUESTION_EMPTY); + request.getSession().removeAttribute(USER_EXCEPTION_ANSWER_EMPTY); + request.getSession().removeAttribute(USER_EXCEPTION_ANSWERS_DUPLICATE); + request.getSession().removeAttribute(USER_EXCEPTION_OPTIONS_COUNT_ZERO); + request.getSession().removeAttribute(USER_EXCEPTION_CHKBOXES_EMPTY); + request.getSession().removeAttribute(USER_EXCEPTION_SUBMIT_NONE); + request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); + request.getSession().removeAttribute(USER_EXCEPTION_FILENAME_EMPTY); + 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) - { - 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 lockOnFinish=request.getParameter("lockOnFinish"); - voteAuthoringForm.setLockOnFinish(lockOnFinish); - voteGeneralAuthoringDTO.setLockOnFinish(lockOnFinish); - - String allowText=request.getParameter("allowText"); - voteAuthoringForm.setAllowText(allowText); - voteGeneralAuthoringDTO.setAllowText(allowText); - - String showResults=request.getParameter("showResults"); - voteAuthoringForm.setShowResults(showResults); - voteGeneralAuthoringDTO.setShowResults(showResults); + public static void setFormProperties(HttpServletRequest request, IVoteService voteService, + VoteAuthoringForm voteAuthoringForm, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO, + String strToolContentID, String defaultContentIdStr, String activeModule, SessionMap sessionMap, + String httpSessionID) { - String maxNominationCount=request.getParameter("maxNominationCount"); - voteAuthoringForm.setMaxNominationCount(maxNominationCount); - voteGeneralAuthoringDTO.setMaxNominationCount(maxNominationCount); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); - String reflect=request.getParameter("reflect"); - voteAuthoringForm.setReflect(reflect); - voteGeneralAuthoringDTO.setReflect(reflect); + voteAuthoringForm.setToolContentID(strToolContentID); - String reflectionSubject=request.getParameter("reflectionSubject"); - voteAuthoringForm.setReflectionSubject(reflectionSubject); - voteGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); + if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0)) + voteAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString()); + voteAuthoringForm.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setActiveModule(activeModule); - String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); - voteAuthoringForm.setOfflineInstructions(offlineInstructions); - voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + String lockOnFinish = request.getParameter("lockOnFinish"); + voteAuthoringForm.setLockOnFinish(lockOnFinish); + voteGeneralAuthoringDTO.setLockOnFinish(lockOnFinish); + + String useSelectLeaderToolOuput = request.getParameter("useSelectLeaderToolOuput"); + voteAuthoringForm.setUseSelectLeaderToolOuput(useSelectLeaderToolOuput);; + voteGeneralAuthoringDTO.setAllowText(useSelectLeaderToolOuput); - String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); - voteAuthoringForm.setOnlineInstructions(onlineInstructions); - voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + String allowText = request.getParameter("allowText"); + voteAuthoringForm.setAllowText(allowText); + voteGeneralAuthoringDTO.setAllowText(allowText); + + String showResults = request.getParameter("showResults"); + voteAuthoringForm.setShowResults(showResults); + voteGeneralAuthoringDTO.setShowResults(showResults); + + String maxNominationCount = request.getParameter("maxNominationCount"); + voteAuthoringForm.setMaxNominationCount(maxNominationCount); + voteGeneralAuthoringDTO.setMaxNominationCount(maxNominationCount); + + String reflect = request.getParameter("reflect"); + voteAuthoringForm.setReflect(reflect); + voteGeneralAuthoringDTO.setReflect(reflect); + + String reflectionSubject = request.getParameter("reflectionSubject"); + voteAuthoringForm.setReflectionSubject(reflectionSubject); + voteGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); + + String offlineInstructions = request.getParameter(OFFLINE_INSTRUCTIONS); + voteAuthoringForm.setOfflineInstructions(offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + String onlineInstructions = request.getParameter(ONLINE_INSTRUCTIONS); + voteAuthoringForm.setOnlineInstructions(onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); } - - public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, IVoteService voteService) - { - - VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); - - if (voteContent != null) - { - voteContent.setDefineLater(value); - voteService.updateVote(voteContent); - } + public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, + IVoteService voteService) { + + VoteContent voteContent = voteService.retrieveVote(new Long(strToolContentID)); + + if (voteContent != null) { + voteContent.setDefineLater(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 ) { + /** + * 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) { - 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 ( uuid.equals(value.getUuid()) ) { - attachment = value; - } + List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); - } - if ( attachment != null ) { - deletedList.add(attachment); - attachmentsList.remove(attachment); - } - } - - return deletedList; + if (attachmentsList != null) { + Iterator iter = attachmentsList.iterator(); + VoteUploadedFile attachment = null; + while (iter.hasNext() && attachment == null) { + VoteUploadedFile value = (VoteUploadedFile) iter.next(); + + if (uuid.equals(value.getUuid())) { + attachment = value; + } + + } + if (attachment != null) { + deletedList.add(attachment); + attachmentsList.remove(attachment); + } + } + + return deletedList; } + public static List moveToDelete(String filename, boolean isOnline, List attachmentsList, List deletedAttachmentsList) { - public static List moveToDelete(String filename, boolean isOnline, List attachmentsList, List deletedAttachmentsList ) { + List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); - 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 (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; + } + if (attachment != null) { + deletedList.add(attachment); + attachmentsList.remove(attachment); + } + } + + return deletedList; } - + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteSessionDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteSessionDAO.java (.../IVoteSessionDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteSessionDAO.java (.../IVoteSessionDAO.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -31,35 +31,35 @@ /** * @author Ozgur Demirtas * - *

Interface that defines the contract for VoteSession access

+ *

+ * Interface that defines the contract for VoteSession access + *

*/ public interface IVoteSessionDAO { - public VoteSession getVoteSessionByUID(Long uid); - - public VoteSession findVoteSessionById(Long voteSessionId); - - public int countSessionComplete(); + VoteSession getVoteSessionByUID(Long uid); - public int countSessionIncomplete(); - - public void saveVoteSession(VoteSession voteSession); - - public void updateVoteSession(VoteSession voteSession); - - public void removeVoteSessionByUID(Long uid); - - public void removeVoteSessionById(Long voteSessionId); + VoteSession findVoteSessionById(Long voteSessionId); - public void removeVoteSession(VoteSession voteSession); + int countSessionComplete(); - public VoteSession getVoteSessionByUser(final Long userId); - - public void removeVoteUsers(VoteSession voteSession); - - public void addVoteUsers(Long voteSessionId, VoteQueUsr user); - - public List getSessionsFromContent(VoteContent voteContent); - - public List getSessionNamesFromContent(VoteContent voteContent); + void saveVoteSession(VoteSession voteSession); + void updateVoteSession(VoteSession voteSession); + + void removeVoteSessionByUID(Long uid); + + void removeVoteSessionById(Long voteSessionId); + + void removeVoteSession(VoteSession voteSession); + + VoteSession getVoteSessionByUser(final Long userId); + + void removeVoteUsers(VoteSession voteSession); + + void addVoteUsers(Long voteSessionId, VoteQueUsr user); + + List getSessionsFromContent(VoteContent voteContent); + + List getSessionNamesFromContent(VoteContent voteContent); + } \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -r2ed86809be97c2553630665e20d6cc21b57c531c -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 2ed86809be97c2553630665e20d6cc21b57c531c) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -28,77 +28,58 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.tool.vote.service.IVoteService; - /** * @author Ozgur Demirtas * - *

Interface that defines the contract for VoteUsrAttempt access

+ *

+ * Interface that defines the contract for VoteUsrAttempt access + *

*/ -public interface IVoteUsrAttemptDAO -{ - public VoteUsrAttempt getVoteUserAttemptByUID(Long uid); - - public void saveVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); - - public List getAttemptsForUser(final Long queUsrId); - - public List getUserRecords(final String userEntry); - - public Set getUserEntries(); - - public int getUserEnteredVotesCountForContent(final Long voteContentUid); - - public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid); - - public List getSessionUserEntries(final Long voteSessionUid); - - public Set getSessionUserEntriesSet(final Long voteSessionUid); - - public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid); - - public VoteUsrAttempt getAttemptByUID(Long uid); - - public int getCompletedSessionEntriesCount(final Long voteSessionUid); - - public int getSessionEntriesCount(final Long voteSessionId); - - public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid); - - public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, IVoteService voteService); - - public int getUserRecordsEntryCount(final String userEntry); - - public int getAttemptsForQuestionContent(final Long voteQueContentId); - - public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); - - public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); - - public void removeAttemptsForUser(final Long queUsrId); - - public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId); - - public int getLastNominationCount(Long userId); - - //public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); - - public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long voteSessionId); - - public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); - - public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId); - - public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); - - public void removeVoteUsrAttemptByUID(Long uid); - - public void removeVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); - - 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); -} +public interface IVoteUsrAttemptDAO { + void saveVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); + List getAttemptsForUser(final Long queUsrId); + + List getUserRecords(final String userEntry); + + Set getUserEntries(); + + int getUserEnteredVotesCountForContent(final Long voteContentUid); + + List getSessionUserEntries(final Long voteSessionUid); + + Set getSessionUserEntriesSet(final Long voteSessionUid); + + List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid); + + VoteUsrAttempt getAttemptByUID(Long uid); + + int getCompletedSessionEntriesCount(final Long voteSessionUid); + + int getSessionEntriesCount(final Long voteSessionId); + + int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid); + + int getAttemptsForQuestionContent(final Long voteQueContentId); + + int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); + + List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, + final Long voteSessionUid); + + void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId); + + VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId, + final Long voteQueContentId, final Long voteSessionId); + + void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); + + void removeVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); + + Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionUid); + + Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId); + + List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java (.../VoteSessionDAO.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java (.../VoteSessionDAO.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -37,158 +37,114 @@ /** * @author ozgurd - *

Hibernate implementation for database access to Vote sessions for the voting tool.

+ *

+ * Hibernate implementation for database access to Vote sessions for the voting tool. + *

*/ public class VoteSessionDAO extends HibernateDaoSupport implements IVoteSessionDAO { - - private static final String FIND_VOTE_SESSION_CONTENT = "from " + VoteSession.class.getName() + " as votes where vote_session_id=?"; - + + private static final String FIND_VOTE_SESSION_CONTENT = "from " + VoteSession.class.getName() + + " as votes where vote_session_id=?"; + private static final String LOAD_VOTESESSION_BY_USER = "select votes from VoteSession votes left join fetch " - + "votes.voteQueUsers user where user.queUsrId=:userId"; - + + "votes.voteQueUsers user where user.queUsrId=:userId"; + private static final String GET_SESSIONS_FROM_CONTENT = "select votes.voteSessionId from VoteSession votes where votes.voteContent=:voteContent"; - + private static final String COUNT_SESSION_COMPLETE = "from voteSession in class VoteSession where voteSession.sessionStatus='COMPLETE'"; - - private static final String COUNT_SESSION_INCOMPLETE = "from voteSession in class VoteSession where voteSession.sessionStatus='INCOMPLETE'"; - - private static final String GET_SESSIONNAMES_FROM_CONTENT = "select votes.session_name from VoteSession votes where votes.voteContent=:voteContent order by votes.voteSessionId"; - - public VoteSession getVoteSessionByUID(Long uid) - { - return (VoteSession) this.getHibernateTemplate().get(VoteSession.class, uid); - } - - public VoteSession findVoteSessionById(Long voteSessionId) - { - String query = "from VoteSession votes where votes.voteSessionId=?"; - - List list = getSession().createQuery(query) - .setLong(0,voteSessionId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - VoteSession votes = (VoteSession) list.get(0); - return votes; - } - return null; - } - - public int countSessionComplete() - { - List list = getSession().createQuery(COUNT_SESSION_COMPLETE) - .list(); - - if(list != null && list.size() > 0){ - return list.size(); - } - else return 0; - } - public int countSessionIncomplete() - { - List list = getSession().createQuery(COUNT_SESSION_INCOMPLETE) - .list(); - - if(list != null && list.size() > 0){ - return list.size(); - } - else return 0; + private static final String GET_SESSIONNAMES_FROM_CONTENT = "select votes.session_name from VoteSession votes where votes.voteContent=:voteContent order by votes.voteSessionId"; + + public VoteSession getVoteSessionByUID(Long uid) { + return (VoteSession) this.getHibernateTemplate().get(VoteSession.class, uid); + } + + public VoteSession findVoteSessionById(Long voteSessionId) { + String query = "from VoteSession votes where votes.voteSessionId=?"; + + List list = getSession().createQuery(query).setLong(0, voteSessionId.longValue()).list(); + + if (list != null && list.size() > 0) { + VoteSession vote = (VoteSession) list.get(0); + return vote; } - - - public void saveVoteSession(VoteSession voteSession) - { - this.getHibernateTemplate().save(voteSession); + return null; } - - - public void updateVoteSession(VoteSession voteSession) - { - this.getSession().setFlushMode(FlushMode.AUTO); - this.getHibernateTemplate().update(voteSession); + + public int countSessionComplete() { + List list = getSession().createQuery(COUNT_SESSION_COMPLETE).list(); + + if (list != null && list.size() > 0) { + return list.size(); + } else + return 0; } - - public void removeVoteSessionByUID(Long uid) - { - VoteSession votes = (VoteSession)getHibernateTemplate().get(VoteSession.class, uid); - this.getHibernateTemplate().delete(votes); + public void saveVoteSession(VoteSession voteSession) { + this.getHibernateTemplate().save(voteSession); } - - public void removeVoteSessionById(Long voteSessionId) - { - - HibernateTemplate templ = this.getHibernateTemplate(); - if ( voteSessionId != null) { - List list = getSession().createQuery(FIND_VOTE_SESSION_CONTENT) - .setLong(0,voteSessionId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - VoteSession vote = (VoteSession) list.get(0); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(vote); - templ.flush(); - } - } - - + + public void updateVoteSession(VoteSession voteSession) { + this.getSession().setFlushMode(FlushMode.AUTO); + this.getHibernateTemplate().update(voteSession); } - public void removeVoteSession(VoteSession voteSession) - { - this.getSession().setFlushMode(FlushMode.AUTO); - this.getHibernateTemplate().delete(voteSession); + public void removeVoteSessionByUID(Long uid) { + VoteSession votes = (VoteSession) getHibernateTemplate().get(VoteSession.class, uid); + this.getHibernateTemplate().delete(votes); } - + public void removeVoteSessionById(Long voteSessionId) { - public VoteSession getVoteSessionByUser(final Long userId) - { - return (VoteSession) getHibernateTemplate().execute(new HibernateCallback() - { + HibernateTemplate templ = this.getHibernateTemplate(); + if (voteSessionId != null) { + List list = getSession().createQuery(FIND_VOTE_SESSION_CONTENT).setLong(0, voteSessionId.longValue()) + .list(); - public Object doInHibernate(Session session) throws HibernateException - { - return session.createQuery(LOAD_VOTESESSION_BY_USER) - .setLong("userId", - userId.longValue()) - .uniqueResult(); - } - }); + if (list != null && list.size() > 0) { + VoteSession vote = (VoteSession) list.get(0); + this.getSession().setFlushMode(FlushMode.AUTO); + templ.delete(vote); + templ.flush(); + } } - - - public void removeVoteUsers(VoteSession voteSession) - { - this.getHibernateTemplate().deleteAll(voteSession.getVoteQueUsers()); + } - - - public void addVoteUsers(Long voteSessionId, VoteQueUsr user) - { - VoteSession session = findVoteSessionById(voteSessionId); - user.setVoteSession(session); - session.getVoteQueUsers().add(user); - this.getHibernateTemplate().saveOrUpdate(user); - this.getHibernateTemplate().saveOrUpdate(session); - - } - - public List getSessionsFromContent(VoteContent voteContent) - { - return (getHibernateTemplate().findByNamedParam(GET_SESSIONS_FROM_CONTENT, - "voteContent", - voteContent)); - } - - public List getSessionNamesFromContent(VoteContent voteContent) - { - return (getHibernateTemplate().findByNamedParam(GET_SESSIONNAMES_FROM_CONTENT, - "voteContent", - voteContent)); - } + public void removeVoteSession(VoteSession voteSession) { + this.getSession().setFlushMode(FlushMode.AUTO); + this.getHibernateTemplate().delete(voteSession); + } + + public VoteSession getVoteSessionByUser(final Long userId) { + return (VoteSession) getHibernateTemplate().execute(new HibernateCallback() { + + public Object doInHibernate(Session session) throws HibernateException { + return session.createQuery(LOAD_VOTESESSION_BY_USER).setLong("userId", userId.longValue()) + .uniqueResult(); + } + }); + } + + public void removeVoteUsers(VoteSession voteSession) { + this.getHibernateTemplate().deleteAll(voteSession.getVoteQueUsers()); + } + + public void addVoteUsers(Long voteSessionId, VoteQueUsr user) { + VoteSession session = findVoteSessionById(voteSessionId); + user.setVoteSession(session); + session.getVoteQueUsers().add(user); + this.getHibernateTemplate().saveOrUpdate(user); + this.getHibernateTemplate().saveOrUpdate(session); + + } + + public List getSessionsFromContent(VoteContent voteContent) { + return (getHibernateTemplate().findByNamedParam(GET_SESSIONS_FROM_CONTENT, "voteContent", voteContent)); + } + + public List getSessionNamesFromContent(VoteContent voteContent) { + return (getHibernateTemplate().findByNamedParam(GET_SESSIONNAMES_FROM_CONTENT, "voteContent", voteContent)); + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -44,8 +44,6 @@ */ public class VoteUsrAttemptDAO extends HibernateDaoSupport implements IVoteUsrAttemptDAO { - private static final String LOAD_ATTEMPT_FOR_QUE_CONTENT = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueContentId=:voteQueContentId"; - private static final String LOAD_ATTEMPT_FOR_USER = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId"; private static final String LOAD_ATTEMPT_FOR_QUESTION_CONTENT = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.voteQueContentId=:voteQueContentId"; @@ -60,8 +58,6 @@ private static final String LOAD_USER_ENTRY_RECORDS = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.userEntry=:userEntry and voteUsrAttempt.voteQueContentId=1 "; - private static final String LOAD_DISTINCT_USER_ENTRY_RECORDS = "select distinct voteUsrAttempt.queUsrId from VoteUsrAttempt voteUsrAttempt where voteUsrAttempt.userEntry=:userEntry"; - private static final String COUNT_ATTEMPTS_BY_CONTENT_ID = "select count(*) from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where " + "att.voteQueUsr=user and user.voteSession=ses and " + "ses.voteContentId=:voteContentId"; @@ -71,10 +67,6 @@ private static final String COUNT_ENTRIES_BY_SESSION_ID = "select count(*) from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where " + "att.voteQueUsr=user and user.voteSession=ses and ses.uid=:voteSessionUid"; - public VoteUsrAttempt getVoteUserAttemptByUID(Long uid) { - return (VoteUsrAttempt) this.getHibernateTemplate().get(VoteUsrAttempt.class, uid); - } - public VoteUsrAttempt getAttemptByUID(Long uid) { String query = "from VoteUsrAttempt attempt where attempt.uid=?"; @@ -91,7 +83,7 @@ this.getHibernateTemplate().save(voteUsrAttempt); } - public List getAttemptsForUser(final Long queUsrId) { + public List getAttemptsForUser(final Long queUsrId) { List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", queUsrId.longValue()).list(); return list; @@ -137,54 +129,6 @@ return sessionUserEntries; } - public int getUserRecordsEntryCount(final String userEntry) { - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", - userEntry).list(); - - if (list != null && list.size() > 0) { - return list.size(); - } - - return 0; - } - - public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, - IVoteService voteService) { - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", - userEntry).list(); - - int entryCount = 0; - - if (list != null && list.size() > 0) { - Iterator listIterator = list.iterator(); - while (listIterator.hasNext()) { - Long userId = (Long) listIterator.next(); - VoteQueUsr voteQueUsr = voteService.getVoteUserByUID(userId); - - if (voteQueUsr.getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { - ++entryCount; - } - } - } - return entryCount; - } - - public void removeAttemptsForUser(final Long queUsrId) { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", - queUsrId.longValue()).list(); - - if (list != null && list.size() > 0) { - Iterator listIterator = list.iterator(); - while (listIterator.hasNext()) { - VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(attempt); - templ.flush(); - } - } - } - public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) { String strGetUser = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId"; HibernateTemplate templ = this.getHibernateTemplate(); @@ -252,27 +196,6 @@ } - public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid) { - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry", - userEntry).list(); - - List sessionUserEntries = new ArrayList(); - if (list != null && list.size() > 0) { - Iterator listIterator = list.iterator(); - while (listIterator.hasNext()) { - VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { - boolean isVoteVisible = attempt.isVisible(); - if (isVoteVisible == false) { - return false; - } - } - } - } - - return true; - } - public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid) { List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong( "voteQueContentId", voteQueContentId.longValue()).list(); @@ -300,25 +223,25 @@ return list; } - public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, - final Long voteQueContentId, final Long voteSessionId) { - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION) + public VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId, + final Long voteQueContentId, final Long voteSessionUid) { + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION) .setLong("queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()) .list(); if (list != null && list.size() > 0) { - Iterator listIterator = list.iterator(); + Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { - VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) { + VoteUsrAttempt attempt = listIterator.next(); + if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { return attempt; } } } return null; } - public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) { + public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionUid) { List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId", queUsrId.longValue()).list(); @@ -329,8 +252,9 @@ while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) { - if (!attempt.getVoteQueContentId().toString().equals("1")) { + if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { + Long questionUid = attempt.getVoteQueContent().getUid(); + if (!questionUid.toString().equals("1")) { userEntries.add(attempt.getVoteQueContent().getQuestion()); } } @@ -352,7 +276,8 @@ VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) { - if (!attempt.getVoteQueContentId().toString().equals("1")) { + Long questionUid = attempt.getVoteQueContent().getUid(); + if (!questionUid.toString().equals("1")) { userEntries.add(attempt.getVoteQueContent().getQuestion()); } else { //this is a user entered vote @@ -370,22 +295,6 @@ return userEntries; } - public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) { - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong( - "queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); - return list; - } - - public int getLastNominationCount(Long userId) { - return 0; - } - - public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) { - List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUE_CONTENT).setLong("queUsrId", - queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); - return list; - } - public List getUserRecords(final String userEntry) { List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list(); @@ -432,12 +341,6 @@ this.getHibernateTemplate().update(voteUsrAttempt); } - public void removeVoteUsrAttemptByUID(Long uid) { - VoteUsrAttempt votea = (VoteUsrAttempt) getHibernateTemplate().get(VoteUsrAttempt.class, uid); - this.getSession().setFlushMode(FlushMode.AUTO); - this.getHibernateTemplate().delete(votea); - } - public void removeVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().delete(voteUsrAttempt); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dbupdates/patch20131227.sql =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dbupdates/patch20131227.sql (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dbupdates/patch20131227.sql (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -0,0 +1,19 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV +ALTER TABLE tl_lavote11_content ADD COLUMN use_select_leader_tool_ouput TINYINT(1) NOT NULL DEFAULT 0; +ALTER TABLE tl_lavote11_session ADD COLUMN group_leader_uid BIGINT; +ALTER TABLE tl_lavote11_session ADD INDEX FK_lavote11_session_1 (group_leader_uid), ADD CONSTRAINT tl_lavote11_session FOREIGN KEY (group_leader_uid) REFERENCES tl_lavote11_usr (uid) ON DELETE CASCADE ON UPDATE CASCADE; + +-- adding a constraint to the vote user table so no same user_id and vote_session_id can be repetead +ALTER TABLE tl_lavote11_usr ADD UNIQUE INDEX(user_id, vote_session_id); + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java (.../VoteContent.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java (.../VoteContent.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -74,6 +74,8 @@ /** nullable persistent field */ private long createdBy; + + private boolean useSelectLeaderToolOuput; private boolean reflect; @@ -121,11 +123,11 @@ /** full constructor */ public VoteContent(Long voteContentId, String content, String title, String instructions, boolean defineLater, - boolean runOffline, Date creationDate, Date updateDate, boolean allowText, boolean reflect, - String reflectionSubject, String maxNominationCount, String minNominationCount, long createdBy, - boolean lockOnFinish, boolean contentInUse, String offlineInstructions, String onlineInstructions, - boolean showResults, Short maxExternalInputs, Short externalInputsAdded, Set voteQueContents, - Set voteSessions, Set voteAttachments) { + boolean runOffline, Date creationDate, Date updateDate, boolean allowText, + boolean useSelectLeaderToolOuput, boolean reflect, String reflectionSubject, String maxNominationCount, + String minNominationCount, long createdBy, boolean lockOnFinish, boolean contentInUse, + String offlineInstructions, String onlineInstructions, boolean showResults, Short maxExternalInputs, + Short externalInputsAdded, Set voteQueContents, Set voteSessions, Set voteAttachments) { this.voteContentId = voteContentId; this.content = content; this.title = title; @@ -137,6 +139,7 @@ this.maxNominationCount = maxNominationCount; this.minNominationCount = minNominationCount; this.allowText = allowText; + this.useSelectLeaderToolOuput = useSelectLeaderToolOuput; this.reflect = reflect; this.reflectionSubject = reflectionSubject; this.createdBy = createdBy; @@ -179,7 +182,7 @@ throws ItemNotFoundException, RepositoryCheckedException { VoteContent newContent = new VoteContent(newContentId, vote.getContent(), vote.getTitle(), vote .getInstructions(), vote.isDefineLater(), vote.isRunOffline(), vote.getCreationDate(), vote - .getUpdateDate(), vote.isAllowText(), vote.isReflect(), vote.getReflectionSubject(), vote + .getUpdateDate(), vote.isAllowText(), vote.isUseSelectLeaderToolOuput(), vote.isReflect(), vote.getReflectionSubject(), vote .getMaxNominationCount(), vote.getMinNominationCount(), vote.getCreatedBy(), vote.isLockOnFinish(), vote.isContentInUse(), vote.getOfflineInstructions(), vote.getOnlineInstructions(), vote .isShowResults(), vote.getMaxExternalInputs(), vote.getExternalInputsAdded(), new TreeSet(), @@ -491,8 +494,23 @@ public void setReflect(boolean reflect) { this.reflect = reflect; } + + /** + * @param useSelectLeaderToolOuput + * The useSelectLeaderToolOuput to set. + */ + public boolean isUseSelectLeaderToolOuput() { + return useSelectLeaderToolOuput; + } /** + * @return Returns the useSelectLeaderToolOuput. + */ + public void setUseSelectLeaderToolOuput(boolean useSelectLeaderToolOuput) { + this.useSelectLeaderToolOuput = useSelectLeaderToolOuput; + } + + /** * @return Returns the reflectionSubject. */ public String getReflectionSubject() { Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteQueUsr.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteQueUsr.java (.../VoteQueUsr.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteQueUsr.java (.../VoteQueUsr.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -39,6 +39,8 @@ */ public class VoteQueUsr implements Serializable { + private static final long serialVersionUID = 7303944502340276133L; + /** identifier field */ private Long uid; @@ -58,17 +60,18 @@ private Long voteSessionId; /** nullable persistent field */ - private org.lamsfoundation.lams.tool.vote.pojos.VoteSession voteSession; + private VoteSession voteSession; /** persistent field */ private Set voteUsrAttempts; /** full constructor */ - public VoteQueUsr(Long queUsrId, String username, String fullname, org.lamsfoundation.lams.tool.vote.pojos.VoteSession voteSession, Set voteUsrAttempts) { + public VoteQueUsr(Long queUsrId, String username, String fullname, VoteSession voteSession, Set voteUsrAttempts) { this.queUsrId = queUsrId; this.username = username; this.fullname = fullname; this.voteSession = voteSession; + this.voteSessionId = voteSession.getUid(); this.voteUsrAttempts = voteUsrAttempts; } @@ -131,12 +134,16 @@ .toString(); } /** + * Beware, it references Votesession.uid field (not the Votesession.voteSessionId). + * * @return Returns the voteSessionId. */ public Long getVoteSessionId() { return voteSessionId; } /** + * Beware, it references Votesession.uid field (not the Votesession.voteSessionId). + * * @param voteSessionId The voteSessionId to set. */ public void setVoteSessionId(Long voteSessionId) { @@ -145,14 +152,14 @@ /** * @return Returns the voteSession. */ - public org.lamsfoundation.lams.tool.vote.pojos.VoteSession getVoteSession() { + public VoteSession getVoteSession() { return voteSession; } /** * @param voteSession The voteSession to set. */ public void setVoteSession( - org.lamsfoundation.lams.tool.vote.pojos.VoteSession voteSession) { + VoteSession voteSession) { this.voteSession = voteSession; } /** Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteSession.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteSession.java (.../VoteSession.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteSession.java (.../VoteSession.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -28,21 +28,20 @@ import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

Persistent object/bean that defines the content for the Voting tool. - * Provides accessors and mutators to get/set attributes - * It maps to database table: tl_lavote11_session + *

+ * Persistent object/bean that defines the content for the Voting tool. Provides accessors and mutators to get/set + * attributes It maps to database table: tl_lavote11_session *

* * @author Ozgur Demirtas */ public class VoteSession implements Serializable { - public final static String INCOMPLETE = "INCOMPLETE"; - + public final static String INCOMPLETE = "INCOMPLETE"; + public static final String COMPLETED = "COMPLETED"; - + /** identifier field */ private Long uid; @@ -57,166 +56,179 @@ /** nullable persistent field */ private String sessionStatus; - + private String session_name; /** nullable persistent field */ private Long voteContentId; /** nullable persistent field */ - private org.lamsfoundation.lams.tool.vote.pojos.VoteContent voteContent; + private VoteContent voteContent; /** persistent field */ private Set voteQueUsers; + + /** persistent field */ + private VoteQueUsr groupLeader; - /** full constructor */ - public VoteSession(Long voteSessionId, Date sessionStartDate, Date sessionEndDate, String sessionStatus, org.lamsfoundation.lams.tool.vote.pojos.VoteContent voteContent, Set voteQueUsers) { - this.voteSessionId = voteSessionId; - this.sessionStartDate = sessionStartDate; - this.sessionEndDate = sessionEndDate; - this.sessionStatus = sessionStatus; - this.voteContent = voteContent; - this.voteQueUsers = voteQueUsers; + public VoteSession(Long voteSessionId, Date sessionStartDate, String sessionStatus, String session_name, + VoteContent voteContent, Set voteQueUsers) { + this.voteSessionId = voteSessionId; + this.sessionStartDate = sessionStartDate; + this.sessionStatus = sessionStatus; + this.session_name = session_name; + this.voteContent = voteContent; + this.voteQueUsers = voteQueUsers; } - - public VoteSession(Long voteSessionId, Date sessionStartDate, String sessionStatus, String session_name, org.lamsfoundation.lams.tool.vote.pojos.VoteContent voteContent, Set voteQueUsers) { - this.voteSessionId = voteSessionId; - this.sessionStartDate = sessionStartDate; - this.sessionStatus = sessionStatus; - this.session_name = session_name; - this.voteContent = voteContent; - this.voteQueUsers = voteQueUsers; - } - - public VoteSession(Long voteSessionId, Date sessionStartDate, String sessionStatus, org.lamsfoundation.lams.tool.vote.pojos.VoteContent voteContent, Set voteQueUsers) { - this.voteSessionId = voteSessionId; - this.sessionStartDate = sessionStartDate; - this.sessionStatus = sessionStatus; - this.voteContent = voteContent; - this.voteQueUsers = voteQueUsers; - } - + /** default constructor */ public VoteSession() { } - /** minimal constructor */ - public VoteSession(Long voteSessionId, Set voteQueUsers) { - this.voteSessionId = voteSessionId; - this.voteQueUsers = voteQueUsers; - } - public Long getUid() { - return this.uid; + return this.uid; } public void setUid(Long uid) { - this.uid = uid; + this.uid = uid; } - public String toString() { - return new ToStringBuilder(this) - .append("uid", getUid()) - .toString(); + return new ToStringBuilder(this).append("uid", getUid()).toString(); } - /** - * @return Returns the sessionEndDate. - */ - public Date getSessionEndDate() { - return sessionEndDate; - } - /** - * @param sessionEndDate The sessionEndDate to set. - */ - public void setSessionEndDate(Date sessionEndDate) { - this.sessionEndDate = sessionEndDate; - } - /** - * @return Returns the sessionStartDate. - */ - public Date getSessionStartDate() { - return sessionStartDate; - } - /** - * @param sessionStartDate The sessionStartDate to set. - */ - public void setSessionStartDate(Date sessionStartDate) { - this.sessionStartDate = sessionStartDate; - } - /** - * @return Returns the sessionStatus. - */ - public String getSessionStatus() { - return sessionStatus; - } - /** - * @param sessionStatus The sessionStatus to set. - */ - public void setSessionStatus(String sessionStatus) { - this.sessionStatus = sessionStatus; - } - - /** - * @return Returns the session_name. - */ - public String getSession_name() { - return session_name; - } - /** - * @param session_name The session_name to set. - */ - public void setSession_name(String session_name) { - this.session_name = session_name; - } /** + * @return Returns the sessionEndDate. + */ + public Date getSessionEndDate() { + return sessionEndDate; + } + + /** + * @param sessionEndDate + * The sessionEndDate to set. + */ + public void setSessionEndDate(Date sessionEndDate) { + this.sessionEndDate = sessionEndDate; + } + + /** + * @return Returns the sessionStartDate. + */ + public Date getSessionStartDate() { + return sessionStartDate; + } + + /** + * @param sessionStartDate + * The sessionStartDate to set. + */ + public void setSessionStartDate(Date sessionStartDate) { + this.sessionStartDate = sessionStartDate; + } + + /** + * @return Returns the sessionStatus. + */ + public String getSessionStatus() { + return sessionStatus; + } + + /** + * @param sessionStatus + * The sessionStatus to set. + */ + public void setSessionStatus(String sessionStatus) { + this.sessionStatus = sessionStatus; + } + + /** + * @return Returns the session_name. + */ + public String getSession_name() { + return session_name; + } + + /** + * @param session_name + * The session_name to set. + */ + public void setSession_name(String session_name) { + this.session_name = session_name; + } + + /** * @return Returns the voteSessionId. */ public Long getVoteSessionId() { - return voteSessionId; + return voteSessionId; } + /** - * @param voteSessionId The voteSessionId to set. + * @param voteSessionId + * The voteSessionId to set. */ public void setVoteSessionId(Long voteSessionId) { - this.voteSessionId = voteSessionId; + this.voteSessionId = voteSessionId; } + /** * @return Returns the voteContentId. */ public Long getVoteContentId() { - return voteContentId; + return voteContentId; } + /** - * @param voteContentId The voteContentId to set. + * @param voteContentId + * The voteContentId to set. */ public void setVoteContentId(Long voteContentId) { - this.voteContentId = voteContentId; + this.voteContentId = voteContentId; } + /** * @return Returns the voteContent. */ - public org.lamsfoundation.lams.tool.vote.pojos.VoteContent getVoteContent() { - return voteContent; + public VoteContent getVoteContent() { + return voteContent; } + /** - * @param voteContent The voteContent to set. + * @param voteContent + * The voteContent to set. */ - public void setVoteContent( - org.lamsfoundation.lams.tool.vote.pojos.VoteContent voteContent) { - this.voteContent = voteContent; + public void setVoteContent(VoteContent voteContent) { + this.voteContent = voteContent; } + /** * @return Returns the voteQueUsers. */ public Set getVoteQueUsers() { - return voteQueUsers; + return voteQueUsers; } + /** - * @param voteQueUsers The voteQueUsers to set. + * @param voteQueUsers + * The voteQueUsers to set. */ public void setVoteQueUsers(Set voteQueUsers) { - this.voteQueUsers = voteQueUsers; + this.voteQueUsers = voteQueUsers; } + + /** + * @return Returns the groupLeader. + */ + public VoteQueUsr getGroupLeader() { + return this.groupLeader; + } + + /** + * @param groupLeader + * The groupLeader to set. + */ + public void setGroupLeader(VoteQueUsr groupLeader) { + this.groupLeader = groupLeader; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java (.../VoteUsrAttempt.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java (.../VoteUsrAttempt.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -27,11 +27,10 @@ import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

Persistent object/bean that defines the user attempt for the MCQ tool. - * Provides accessors and mutators to get/set attributes - * It maps to database table: tl_lavote11_usr_attempt + *

+ * Persistent object/bean that defines the user attempt for the MCQ tool. Provides accessors and mutators to get/set + * attributes It maps to database table: tl_lavote11_usr_attempt *

* * @author Ozgur Demirtas @@ -49,222 +48,178 @@ /** nullable persistent field */ private String timeZone; - + private String userEntry; - + private Long queUsrId; - + private boolean visible; - + private boolean singleUserEntry; - + private Long voteQueContentId; /** persistent field */ - private org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent; + private VoteQueContent voteQueContent; /** persistent field */ - private org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr; + private VoteQueUsr voteQueUsr; - - /** full constructor */ - public VoteUsrAttempt(Long attemptId, Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) { - this.attemptId = attemptId; - this.attemptTime = attemptTime; - this.timeZone = timeZone; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; + public VoteUsrAttempt(Date attemptTime, String timeZone, VoteQueContent voteQueContent, VoteQueUsr voteQueUsr, + String userEntry, boolean visible) { + this.attemptTime = attemptTime; + this.timeZone = timeZone; + this.voteQueContent = voteQueContent; + this.voteQueContentId = voteQueContent.getVoteQueContentId(); + this.voteQueUsr = voteQueUsr; + this.userEntry = userEntry; + this.visible = visible; } - public VoteUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) { - this.attemptTime = attemptTime; - this.timeZone = timeZone; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; - } - - public VoteUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr, String userEntry) { - this.attemptTime = attemptTime; - this.timeZone = timeZone; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; - this.userEntry=userEntry; - } - - - public VoteUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr, String userEntry, boolean singleUserEntry) { - this.attemptTime = attemptTime; - this.timeZone = timeZone; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; - this.userEntry=userEntry; - this.singleUserEntry=singleUserEntry; - } - - public VoteUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr, String userEntry, boolean singleUserEntry, boolean visible) { - this.attemptTime = attemptTime; - this.timeZone = timeZone; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; - this.userEntry=userEntry; - this.visible=visible; - } - - public VoteUsrAttempt(String userEntry, Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) { - this.userEntry=userEntry; - this.attemptTime = attemptTime; - this.timeZone = timeZone; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; - } - - /** default constructor */ public VoteUsrAttempt() { } - /** minimal constructor */ - public VoteUsrAttempt(Long attemptId, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) { - this.attemptId = attemptId; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; - } - public Long getUid() { - return this.uid; + return this.uid; } public void setUid(Long uid) { - this.uid = uid; + this.uid = uid; } public Long getAttemptId() { - return this.attemptId; + return this.attemptId; } public void setAttemptId(Long attemptId) { - this.attemptId = attemptId; + this.attemptId = attemptId; } public Date getAttemptTime() { - return this.attemptTime; + return this.attemptTime; } public void setAttemptTime(Date attemptTime) { - this.attemptTime = attemptTime; + this.attemptTime = attemptTime; } public String getTimeZone() { - return this.timeZone; + return this.timeZone; } public void setTimeZone(String timeZone) { - this.timeZone = timeZone; + this.timeZone = timeZone; } - public String toString() { - return new ToStringBuilder(this) - .append("nomination:", voteQueContent.getQuestion()) - .append("userEntry:", userEntry) - .toString(); + return new ToStringBuilder(this).append("nomination:", voteQueContent.getQuestion()) + .append("userEntry:", userEntry).toString(); } - /** - * @return Returns the queUsrId. - */ - public Long getQueUsrId() { - return queUsrId; - } - /** - * @param queUsrId The queUsrId to set. - */ - public void setQueUsrId(Long queUsrId) { - this.queUsrId = queUsrId; - } /** + * @return Returns the queUsrId. + */ + public Long getQueUsrId() { + return queUsrId; + } + + /** + * @param queUsrId + * The queUsrId to set. + */ + public void setQueUsrId(Long queUsrId) { + this.queUsrId = queUsrId; + } + + /** * @return Returns the voteQueContentId. */ public Long getVoteQueContentId() { - return voteQueContentId; + return voteQueContentId; } + /** - * @param voteQueContentId The voteQueContentId to set. + * @param voteQueContentId + * The voteQueContentId to set. */ public void setVoteQueContentId(Long voteQueContentId) { - this.voteQueContentId = voteQueContentId; + this.voteQueContentId = voteQueContentId; } + /** * @return Returns the voteQueContent. */ - public org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent getVoteQueContent() { - return voteQueContent; + public VoteQueContent getVoteQueContent() { + return voteQueContent; } + /** - * @param voteQueContent The voteQueContent to set. + * @param voteQueContent + * The voteQueContent to set. */ - public void setVoteQueContent( - org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent) { - this.voteQueContent = voteQueContent; + public void setVoteQueContent(VoteQueContent voteQueContent) { + this.voteQueContent = voteQueContent; } + /** * @return Returns the voteQueUsr. */ - public org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr getVoteQueUsr() { - return voteQueUsr; + public VoteQueUsr getVoteQueUsr() { + return voteQueUsr; } + /** - * @param voteQueUsr The voteQueUsr to set. + * @param voteQueUsr + * The voteQueUsr to set. */ - public void setVoteQueUsr( - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) { - this.voteQueUsr = voteQueUsr; + public void setVoteQueUsr(VoteQueUsr voteQueUsr) { + this.voteQueUsr = voteQueUsr; } - + /** * @return Returns the userEntry. */ public String getUserEntry() { - return userEntry; + return userEntry; } + /** - * @param userEntry The userEntry to set. + * @param userEntry + * The userEntry to set. */ public void setUserEntry(String userEntry) { - this.userEntry = userEntry; + this.userEntry = userEntry; } /** * @return Returns the singleUserEntry. */ public boolean isSingleUserEntry() { - return singleUserEntry; + return singleUserEntry; } + /** - * @param singleUserEntry The singleUserEntry to set. + * @param singleUserEntry + * The singleUserEntry to set. */ public void setSingleUserEntry(boolean singleUserEntry) { - this.singleUserEntry = singleUserEntry; + this.singleUserEntry = singleUserEntry; } - + /** * @return Returns the visible. */ public boolean isVisible() { - return visible; + return visible; } + /** - * @param visible The visible to set. + * @param visible + * The visible to set. */ public void setVisible(boolean visible) { - this.visible = visible; - } - + this.visible = visible; + } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -re7c872d97ed5a450f72cfa57325f7d37280efcde -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision e7c872d97ed5a450f72cfa57325f7d37280efcde) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -53,141 +53,148 @@ * Interface that defines the contract Voting service provider must follow. */ public interface IVoteService { - public void configureContentRepository() throws VoteApplicationException; + + /** + * @param user + * @param toolSessionId + * @return + */ + boolean isUserGroupLeader(VoteQueUsr user, Long toolSessionId); + + /** + * Set specified user as a leader. Also the previous leader (if any) is marked as non-leader. + * + * @param userId + * @param toolSessionID + */ + VoteQueUsr checkLeaderSelectToolForSessionLeader(VoteQueUsr user, Long toolSessionID); + + /** + * Check user has the same answers logs as group leader. If not - creates missing ones. + * + * @param user + * @param leader + */ + void copyAnswersFromLeader(VoteQueUsr user, VoteQueUsr leader); - public void createVote(VoteContent voteContent) throws VoteApplicationException; + void configureContentRepository() throws VoteApplicationException; - public VoteContent retrieveVote(Long toolContentID) throws VoteApplicationException; + void createVote(VoteContent voteContent) throws VoteApplicationException; - public VoteUsrAttempt getAttemptByUID(Long uid) throws VoteApplicationException; + VoteContent retrieveVote(Long toolContentID) throws VoteApplicationException; - public void createVoteQue(VoteQueContent voteQueContent) throws VoteApplicationException; + VoteUsrAttempt getAttemptByUID(Long uid) throws VoteApplicationException; - public void createVoteSession(VoteSession voteSession) throws VoteApplicationException; + void createVoteQue(VoteQueContent voteQueContent) throws VoteApplicationException; - public void createVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException; + void createVoteSession(VoteSession voteSession) throws VoteApplicationException; - public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid); + void createVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException; - public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid); + List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid); - public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId) + VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long sessionUid) throws VoteApplicationException; - public VoteQueUsr retrieveVoteQueUsr(Long userId) throws VoteApplicationException; + VoteQueUsr retrieveVoteQueUsr(Long userId) throws VoteApplicationException; - public List getVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException; + List getVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException; - public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException; + int getCompletedVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException; - public VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid) + VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid) throws VoteApplicationException; - public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) - throws VoteApplicationException; + Set getAttemptsForUserAndSessionUseOpenAnswer(final Long userUid, final Long sessionUid); - public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId); + Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException; - public int getLastNominationCount(Long userId) throws VoteApplicationException; + void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; - public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException; + void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; - public void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; + List getUserRecords(final String userEntry) throws VoteApplicationException; - public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; + List getUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException; - public List getUserRecords(final String userEntry) throws VoteApplicationException; + void hideOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; - public List getUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException; + void showOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; - public void hideOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; + void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException; - public void showOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException; + int getAttemptsForQuestionContent(final Long voteQueContentId) throws VoteApplicationException; - public void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException; + boolean studentActivityOccurredStandardAndOpen(VoteContent voteContent) throws VoteApplicationException; - public int getAttemptsForQuestionContent(final Long voteQueContentId) throws VoteApplicationException; + int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException; - public boolean studentActivityOccurredStandardAndOpen(VoteContent voteContent) throws VoteApplicationException; - - public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException; - - public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, + List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid); - public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionId) + int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionId) throws VoteApplicationException; - public int getSessionEntriesCount(final Long voteSessionId) throws VoteApplicationException; + int getSessionEntriesCount(final Long voteSessionId) throws VoteApplicationException; - public int getCompletedSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException; + int getCompletedSessionEntriesCount(final Long voteSessionUid) throws VoteApplicationException; - public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException; - - // public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) - // throws VoteApplicationException; - - public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId) + List getAttemptsForUserAndQuestionContent(final Long userUid, final Long questionUid) throws VoteApplicationException; - public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, + VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException; - public List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException; + List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException; - public VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException; + VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException; - public void removeVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException; + void removeVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException; - public VoteQueContent getVoteQueContentByUID(Long uid) throws VoteApplicationException; + VoteQueContent getVoteQueContentByUID(Long uid) throws VoteApplicationException; - public void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException; + void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException; - public void removeQuestionContentByVoteUid(final Long voteContentUid) throws VoteApplicationException; + void removeQuestionContentByVoteUid(final Long voteContentUid) throws VoteApplicationException; - public void cleanAllQuestionsSimple(final Long voteContentUid) throws VoteApplicationException; + void cleanAllQuestionsSimple(final Long voteContentUid) throws VoteApplicationException; - public void resetAllQuestions(final Long voteContentUid) throws VoteApplicationException; + void resetAllQuestions(final Long voteContentUid) throws VoteApplicationException; - public void cleanAllQuestions(final Long voteContentUid) throws VoteApplicationException; + void cleanAllQuestions(final Long voteContentUid) throws VoteApplicationException; - public Set getUserEntries() throws VoteApplicationException; + Set getUserEntries() throws VoteApplicationException; - public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid); + int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid); - public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, - IVoteService voteService) throws VoteApplicationException; + List getSessionUserEntries(final Long voteSessionId) throws VoteApplicationException; - public List getSessionUserEntries(final Long voteSessionId) throws VoteApplicationException; + VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentUid); - public VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentUid); + void removeVoteQueContentByUID(Long uid) throws VoteApplicationException; - public void removeVoteQueContentByUID(Long uid) throws VoteApplicationException; + VoteQueUsr getVoteUserByUID(Long uid) throws VoteApplicationException; - public VoteQueUsr getVoteUserByUID(Long uid) throws VoteApplicationException; + void updateVoteUser(VoteQueUsr voteUser) throws VoteApplicationException; - public void updateVoteUser(VoteQueUsr voteUser) throws VoteApplicationException; - - public void removeAttemptsForUser(final Long queUsrId) throws VoteApplicationException; - - public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) + void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException; - public List getAllQuestionEntries(final Long voteContentId) throws VoteApplicationException; + List getAllQuestionEntries(final Long voteContentId) throws VoteApplicationException; - public VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException; + VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException; - public VoteSession retrieveVoteSession(Long voteSessionId) throws VoteApplicationException; + VoteSession retrieveVoteSession(Long voteSessionId) throws VoteApplicationException; - public VoteContent retrieveVoteBySessionId(Long voteSessionId) throws VoteApplicationException; + VoteContent retrieveVoteBySessionId(Long voteSessionId) throws VoteApplicationException; - public void updateVote(VoteContent vote) throws VoteApplicationException; + void updateVote(VoteContent vote) throws VoteApplicationException; - public void updateVoteSession(VoteSession voteSession) throws VoteApplicationException; + void updateVoteSession(VoteSession voteSession) throws VoteApplicationException; - public List getVoteUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException; + List getVoteUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException; - public VoteSession getVoteSessionByUID(Long uid) throws VoteApplicationException; + VoteSession getVoteSessionByUID(Long uid) throws VoteApplicationException; /** * Get the count of all the potential learners for the vote session. This will include the people that have never @@ -197,119 +204,112 @@ * @param voteSessionId * The tool session id */ - public int getVoteSessionPotentialLearnersCount(Long voteSessionId) throws VoteApplicationException; + int getVoteSessionPotentialLearnersCount(Long voteSessionId) throws VoteApplicationException; - public void deleteVote(VoteContent vote) throws VoteApplicationException; + void deleteVote(VoteContent vote) throws VoteApplicationException; - public void deleteVoteById(Long voteId) throws VoteApplicationException; + void deleteVoteById(Long voteId) throws VoteApplicationException; - public void deleteVoteSession(VoteSession voteSession) throws VoteApplicationException; + void deleteVoteSession(VoteSession voteSession) throws VoteApplicationException; - public List getSessionNamesFromContent(VoteContent voteContent) throws VoteApplicationException; + List getSessionNamesFromContent(VoteContent voteContent) throws VoteApplicationException; - public void removeAttempt(VoteUsrAttempt attempt) throws VoteApplicationException; + void removeAttempt(VoteUsrAttempt attempt) throws VoteApplicationException; - public void deleteVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException; + void deleteVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException; - public User getCurrentUserData(String username) throws VoteApplicationException; + User getCurrentUserData(String username) throws VoteApplicationException; - public int getTotalNumberOfUsers() throws VoteApplicationException; + int getTotalNumberOfUsers() throws VoteApplicationException; - public Lesson getCurrentLesson(long lessonId) throws VoteApplicationException; + Lesson getCurrentLesson(long lessonId) throws VoteApplicationException; - public void saveVoteContent(VoteContent vote) throws VoteApplicationException; + void saveVoteContent(VoteContent vote) throws VoteApplicationException; - public boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException; + boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException; - public int countIncompleteSession(VoteContent vote) throws VoteApplicationException; + int countIncompleteSession(VoteContent vote) throws VoteApplicationException; - public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException; + boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException; - public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException; + void copyToolContent(Long fromContentId, Long toContentId) throws ToolException; - public void setAsDefineLater(Long toolContentID, boolean value) throws DataMissingException, ToolException; + void setAsDefineLater(Long toolContentID, boolean value) throws DataMissingException, ToolException; - public void setAsRunOffline(Long toolContentID, boolean value) throws DataMissingException, ToolException; + void setAsRunOffline(Long toolContentID, boolean value) throws DataMissingException, ToolException; - public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, + void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException; - public boolean existsSession(Long toolSessionId); + boolean existsSession(Long toolSessionId); - public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentID) throws ToolException; + void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentID) throws ToolException; - public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException; + void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException; - public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException; + String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException; - public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException; + ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException; - public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, + ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, ToolException; - public IToolVO getToolBySignature(String toolSignature) throws VoteApplicationException; + IToolVO getToolBySignature(String toolSignature) throws VoteApplicationException; - public long getToolDefaultContentIdBySignature(String toolSignature) throws VoteApplicationException; + long getToolDefaultContentIdBySignature(String toolSignature) throws VoteApplicationException; - public VoteQueContent getToolDefaultQuestionContent(long contentId) throws VoteApplicationException; + VoteQueContent getToolDefaultQuestionContent(long contentId) throws VoteApplicationException; - public List getToolSessionsForContent(VoteContent vote); + List getToolSessionsForContent(VoteContent vote); - public ITicket getRepositoryLoginTicket() throws VoteApplicationException; + ITicket getRepositoryLoginTicket() throws VoteApplicationException; - public void deleteFromRepository(Long uuid, Long versionID); + void deleteFromRepository(Long uuid, Long versionID); - public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws VoteApplicationException; + NodeKey uploadFileToRepository(InputStream stream, String fileName) throws VoteApplicationException; - public InputStream downloadFile(Long uuid, Long versionID) throws VoteApplicationException; + InputStream downloadFile(Long uuid, Long versionID) throws VoteApplicationException; - public void cleanUploadedFilesMetaData() throws VoteApplicationException; + void cleanUploadedFilesMetaData() throws VoteApplicationException; - public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent) + void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent) throws VoteApplicationException; - public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) - throws VoteApplicationException; + List getAttemptsForUser(final Long userUid) throws VoteApplicationException; - public List getAttemptsForUser(final Long queUsrId) throws VoteApplicationException; + int countSessionComplete() throws VoteApplicationException; - public int countSessionComplete() throws VoteApplicationException; - - public VoteSession findVoteSessionById(Long voteSessionId) throws VoteApplicationException; - - public int countSessionIncomplete() throws VoteApplicationException; - - public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType) + NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType) throws RepositoryCheckedException; - public NodeKey copyFile(Long uuid) throws RepositoryCheckedException; + NodeKey copyFile(Long uuid) throws RepositoryCheckedException; - public List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException; + List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException; - public List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException; + List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException; - public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) + Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionUid) throws VoteApplicationException; - public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); + Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); - public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); + NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); - public void removeFile(Long submissionId) throws VoteApplicationException; + void removeFile(Long submissionId) throws VoteApplicationException; - public void persistFile(VoteContent content, VoteUploadedFile file) throws VoteApplicationException; + void persistFile(VoteContent content, VoteUploadedFile file) throws VoteApplicationException; - public List retrieveVoteUploadedFiles(VoteContent Vote) throws VoteApplicationException; + List retrieveVoteUploadedFiles(VoteContent Vote) throws VoteApplicationException; - public void removeNominationsFromCache(VoteContent voteContent); + void removeNominationsFromCache(VoteContent voteContent); - public ToolOutput getToolInput(Long requestingToolContentId, Integer learnerId); + ToolOutput getToolInput(Long requestingToolContentId, Integer learnerId); - public List getDataFlowObjects(Long toolContentId); + List getDataFlowObjects(Long toolContentId); - public void saveDataFlowObjectAssigment(DataFlowObject assignedDataFlowObject); + void saveDataFlowObjectAssigment(DataFlowObject assignedDataFlowObject); - public DataFlowObject getAssignedDataFlowObject(Long toolContentId); + DataFlowObject getAssignedDataFlowObject(Long toolContentId); /** * Returns whether activity is grouped and therefore it is expected more than one tool session. Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteOutputFactory.java =================================================================== diff -u -r37b49e5e78d2b57936d98e68f6057539472b7725 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteOutputFactory.java (.../VoteOutputFactory.java) (revision 37b49e5e78d2b57936d98e68f6057539472b7725) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteOutputFactory.java (.../VoteOutputFactory.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -124,7 +124,7 @@ public ToolOutput getToolOutput(String name, IVoteService voteService, Long toolSessionId, Long learnerId) { if (name != null && name.startsWith(VoteOutputFactory.OUTPUT_NAME_NOMINATION_SELECTION)) { - VoteSession session = voteService.findVoteSessionById(toolSessionId); + VoteSession session = voteService.retrieveVoteSession(toolSessionId); VoteQueUsr queUser = voteService.getVoteUserBySession(learnerId, session.getUid()); return new ToolOutput(name, getI18NText(VoteOutputFactory.OUTPUT_NAME_NOMINATION_SELECTION, true), @@ -169,8 +169,8 @@ Iterator iter = voteAttempts.iterator(); while (iter.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) iter.next(); - if (attempt.getVoteQueContentId().longValue() == 1 - && displayOrder == VoteOutputFactory.FREE_TEXT_NOM_SELECTION) { + Long questionUid = attempt.getVoteQueContent().getUid(); + if (questionUid.longValue() == 1 && displayOrder == VoteOutputFactory.FREE_TEXT_NOM_SELECTION) { // VoteQueContentId == 1 indicates that it is a free text entry return true; } else { @@ -194,7 +194,7 @@ TreeMap output = null; - VoteSession session = voteService.findVoteSessionById(toolSessionId); + VoteSession session = voteService.retrieveVoteSession(toolSessionId); VoteContent content = session.getVoteContent(); VoteQueUsr queUser = voteService.getVoteUserBySession(learnerId, session.getUid()); String i18nDescription = getI18NText(VoteOutputFactory.OUTPUT_NAME_NOMINATION_SELECTION, true); @@ -207,7 +207,8 @@ Iterator iter = voteAttempts.iterator(); while (iter.hasNext() && !found) { VoteUsrAttempt attempt = (VoteUsrAttempt) iter.next(); - found = attempt.getVoteQueContentId().longValue() == 1; + Long questionUid = attempt.getVoteQueContent().getUid(); + found = questionUid.longValue() == 1; } } String name = buildConditionName(VoteOutputFactory.OUTPUT_NAME_NOMINATION_SELECTION, Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -r33da76d05725a84e191a5f6dca50b394cca3c1ee -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 33da76d05725a84e191a5f6dca50b394cca3c1ee) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -33,6 +33,8 @@ import java.util.Vector; import org.apache.log4j.Logger; +import org.hibernate.Hibernate; +import org.hibernate.proxy.HibernateProxy; import org.lamsfoundation.lams.contentrepository.AccessDeniedException; import org.lamsfoundation.lams.contentrepository.FileException; import org.lamsfoundation.lams.contentrepository.ICredentials; @@ -48,7 +50,10 @@ import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; import org.lamsfoundation.lams.learning.service.ILearnerService; +import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.DataFlowObject; +import org.lamsfoundation.lams.learningdesign.ToolActivity; +import org.lamsfoundation.lams.learningdesign.Transition; import org.lamsfoundation.lams.learningdesign.dao.IDataFlowDAO; import org.lamsfoundation.lams.learningdesign.service.ExportToolContentException; import org.lamsfoundation.lams.learningdesign.service.IExportToolContentService; @@ -61,15 +66,18 @@ import org.lamsfoundation.lams.tool.ToolContentManager; import org.lamsfoundation.lams.tool.ToolOutput; import org.lamsfoundation.lams.tool.ToolOutputDefinition; +import org.lamsfoundation.lams.tool.ToolSession; import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.ToolSessionManager; 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.ILamsCoreToolService; import org.lamsfoundation.lams.tool.service.ILamsToolService; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteApplicationException; +import org.lamsfoundation.lams.tool.vote.VoteUtils; import org.lamsfoundation.lams.tool.vote.dao.IVoteContentDAO; import org.lamsfoundation.lams.tool.vote.dao.IVoteQueContentDAO; import org.lamsfoundation.lams.tool.vote.dao.IVoteSessionDAO; @@ -133,10 +141,161 @@ private IDataFlowDAO dataFlowDAO; private MessageService messageService; + private ILamsCoreToolService lamsCoreToolService; public VoteServicePOJO() { } + + @Override + public boolean isUserGroupLeader(VoteQueUsr user, Long toolSessionId) { + VoteSession session = retrieveVoteSession(toolSessionId); + VoteQueUsr groupLeader = session.getGroupLeader(); + + boolean isUserLeader = (groupLeader != null) && user.getUid().equals(groupLeader.getUid()); + return isUserLeader; + } + + @Override + public VoteQueUsr checkLeaderSelectToolForSessionLeader(VoteQueUsr user, Long toolSessionId) { + if (user == null || toolSessionId == null) { + return null; + } + + VoteSession session = retrieveVoteSession(toolSessionId); + VoteQueUsr leader = session.getGroupLeader(); + // check leader select tool for a leader only in case QA tool doesn't know it. As otherwise it will screw + // up previous scratches done + if (leader == null) { + + ToolSession toolSession = toolService.getToolSession(toolSessionId); + ToolActivity voteActivity = toolSession.getToolActivity(); + Activity leaderSelectionActivity = getNearestLeaderSelectionActivity(voteActivity); + + // check if there is leaderSelectionTool available + if (leaderSelectionActivity != null) { + User learner = (User) getUserManagementService().findById(User.class, user.getQueUsrId().intValue()); + String outputName = VoteAppConstants.LEADER_SELECTION_TOOL_OUTPUT_NAME_LEADER_USERID; + ToolSession leaderSelectionSession = lamsCoreToolService.getToolSessionByLearner(learner, + leaderSelectionActivity); + ToolOutput output = lamsCoreToolService.getOutputFromTool(outputName, leaderSelectionSession, null); + + // check if tool produced output + if (output != null && output.getValue() != null) { + Long userId = output.getValue().getLong(); + leader = this.getVoteUserBySession(userId, session.getUid()); + + // create new user in a DB + if (leader == null) { + logger.debug("creating new user with userId: " + userId); + User leaderDto = (User) getUserManagementService().findById(User.class, userId.intValue()); + String userName = leaderDto.getLogin(); + String fullName = leaderDto.getFirstName() + " " + leaderDto.getLastName(); + leader = new VoteQueUsr(userId, userName, fullName, session, new TreeSet()); + voteUserDAO.saveVoteUser(user); + } + + // set group leader + session.setGroupLeader(leader); + this.updateVoteSession(session); + } + } + } + + return leader; + } + + /** + * Finds the nearest Leader Select activity. Works recursively. Tries to find Leader Select activity in the previous activities set first, + * and then inside the parent set. + */ + private static Activity getNearestLeaderSelectionActivity(Activity activity) { + + //check if current activity is Leader Select one. if so - stop searching and return it. + Class activityClass = Hibernate.getClass(activity); + if (activityClass.equals(ToolActivity.class)) { + ToolActivity toolActivity; + + // activity is loaded as proxy due to lazy loading and in order to prevent quering DB we just re-initialize + // it here again + Hibernate.initialize(activity); + if (activity instanceof HibernateProxy) { + toolActivity = (ToolActivity) ((HibernateProxy) activity).getHibernateLazyInitializer() + .getImplementation(); + } else { + toolActivity = (ToolActivity) activity; + } + + if (VoteAppConstants.LEADER_SELECTION_TOOL_SIGNATURE.equals(toolActivity.getTool().getToolSignature())) { + return activity; + } + } + + //check previous activity + Transition transitionTo = activity.getTransitionTo(); + if (transitionTo != null) { + Activity fromActivity = transitionTo.getFromActivity(); + return getNearestLeaderSelectionActivity(fromActivity); + } + + //check parent activity + Activity parent = activity.getParentActivity(); + if (parent != null) { + return getNearestLeaderSelectionActivity(parent); + } + + return null; + } + + @Override + public void copyAnswersFromLeader(VoteQueUsr user, VoteQueUsr leader) { + + if ((user == null) || (leader == null) || user.getUid().equals(leader.getUid())) { + return; + } + + List leaderAttempts = this.getAttemptsForUser(leader.getUid()); + List userAttempts = this.getAttemptsForUser(user.getUid()); + + for (VoteUsrAttempt leaderAttempt : leaderAttempts) { + + VoteQueContent question = leaderAttempt.getVoteQueContent(); + Date attempTime = leaderAttempt.getAttemptTime(); + String timeZone = leaderAttempt.getTimeZone(); + String userEntry = leaderAttempt.getUserEntry(); + + VoteUsrAttempt userAttempt = null; + for (VoteUsrAttempt userAttemptDb : userAttempts) { + if (userAttemptDb.getUid().equals(leaderAttempt.getUid())) { + userAttempt = userAttemptDb; + } + } + + // if response doesn't exist - create VoteUsrAttempt in the db + if (userAttempt == null) { + VoteUsrAttempt voteUsrAttempt = new VoteUsrAttempt(attempTime, timeZone, question, user, userEntry, + true); + this.createVoteUsrAttempt(voteUsrAttempt); + + // if it's been changed by the leader + } else if (leaderAttempt.getAttemptTime().compareTo(userAttempt.getAttemptTime()) != 0) { + userAttempt.setUserEntry(userEntry); + userAttempt.setAttemptTime(attempTime); + userAttempt.setTimeZone(timeZone); + this.updateVoteUsrAttempt(userAttempt); + + // remove userAttempt from the list so we can know which one is redundant(presumably, leader has removed + // this one) + userAttempts.remove(userAttempt); + } + } + + //remove redundant ones + for (VoteUsrAttempt redundantUserAttempt : userAttempts) { + this.removeAttempt(redundantUserAttempt); + } + } + public void configureContentRepository() throws VoteApplicationException { cred = new SimpleCredentials(repositoryUser, repositoryId); try { @@ -238,9 +397,9 @@ } } - public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId) { + public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long userUid, final Long sessionUid) { try { - return voteUsrAttemptDAO.getAttemptsForUserAndSessionUseOpenAnswer(queUsrId, voteSessionId); + return voteUsrAttemptDAO.getAttemptsForUserAndSessionUseOpenAnswer(userUid, sessionUid); } catch (DataAccessException e) { throw new VoteApplicationException( "Exception occured when lams is getting all user entries, standard plus open text" + e.getMessage(), @@ -258,16 +417,6 @@ } } - public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid) - throws VoteApplicationException { - try { - return voteUsrAttemptDAO.isVoteVisibleForSession(userEntry, voteSessionUid); - } catch (DataAccessException e) { - throw new VoteApplicationException("Exception occured when lams is finding if the open vote is hidden: " - + e.getMessage(), e); - } - } - public List getSessionUserEntries(final Long voteSessionUid) throws VoteApplicationException { try { return voteUsrAttemptDAO.getSessionUserEntries(voteSessionUid); @@ -396,10 +545,10 @@ } } - public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId) + public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long sessionUid) throws VoteApplicationException { try { - return voteUserDAO.getVoteUserBySession(queUsrId, voteSessionId); + return voteUserDAO.getVoteUserBySession(queUsrId, sessionUid); } catch (DataAccessException e) { throw new VoteApplicationException("Exception occured when lams is getting vote QueUsr: " + e.getMessage(), e); @@ -443,15 +592,6 @@ } } - public void removeAttemptsForUser(final Long queUsrId) throws VoteApplicationException { - try { - voteUsrAttemptDAO.removeAttemptsForUser(queUsrId); - } catch (DataAccessException e) { - throw new VoteApplicationException("Exception occured when lams is removing voteUsrAttempts: " - + e.getMessage(), e); - } - } - public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid) { try { return voteUsrAttemptDAO.getStandardAttemptsForQuestionContentAndContentUid(voteQueContentId, @@ -481,27 +621,6 @@ } } - public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException { - try { - return voteUsrAttemptDAO.getUserRecordsEntryCount(userEntry); - } catch (DataAccessException e) { - throw new VoteApplicationException("Exception occured when lams is getting userrecords entry count: " - + e.getMessage(), e); - } - - } - - public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, - IVoteService voteService) throws VoteApplicationException { - try { - return voteUsrAttemptDAO.getSessionUserRecordsEntryCount(userEntry, voteSessionUid, voteService); - } catch (DataAccessException e) { - throw new VoteApplicationException( - "Exception occured when lams is getting session userrecords entry count: " + e.getMessage(), e); - } - - } - public int getAttemptsForQuestionContent(final Long voteQueContentId) throws VoteApplicationException { try { return voteUsrAttemptDAO.getAttemptsForQuestionContent(voteQueContentId); @@ -533,22 +652,10 @@ } } - public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) - throws VoteApplicationException { - try { - return voteUsrAttemptDAO.getAttemptsListForUserAndQuestionContent(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 VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, + public VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException { try { - return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContentAndSession(queUsrId, voteQueContentId, + return voteUsrAttemptDAO.getAttemptForUserAndQuestionContentAndSession(queUsrId, voteQueContentId, toolSessionUid); } catch (DataAccessException e) { throw new VoteApplicationException("Exception occured when lams is updating vote UsrAttempt: " @@ -575,9 +682,9 @@ } } - public List getAttemptsForUser(final Long queUsrId) throws VoteApplicationException { + public List getAttemptsForUser(final Long userUid) throws VoteApplicationException { try { - return voteUsrAttemptDAO.getAttemptsForUser(queUsrId); + return voteUsrAttemptDAO.getAttemptsForUser(userUid); } catch (DataAccessException e) { throw new VoteApplicationException("Exception occured when lams is getting the attempts by user id: " + e.getMessage(), e); @@ -595,17 +702,6 @@ } - public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) - throws VoteApplicationException { - try { - return voteUsrAttemptDAO.getAttemptForQueContent(queUsrId, voteQueContentId); - } catch (DataAccessException e) { - throw new VoteApplicationException( - "Exception occured when lams is getting the learner's attempts by user id and que content id: " - + e.getMessage(), e); - } - } - public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException { try { return voteUsrAttemptDAO.getUserEnteredVotesCountForContent(voteContentUid); @@ -691,16 +787,6 @@ } } - public VoteSession findVoteSessionById(Long voteSessionId) throws VoteApplicationException { - try { - return voteSessionDAO.findVoteSessionById(voteSessionId); - } catch (DataAccessException e) { - throw new VoteApplicationException("Exception occured when lams is retrieving by id vote session : " - + e.getMessage(), e); - } - - } - public int getCompletedVoteUserBySessionUid(final Long voteSessionUid) throws VoteApplicationException { try { return voteUserDAO.getCompletedVoteUserBySessionUid(voteSessionUid); @@ -791,15 +877,6 @@ } } - public int countSessionIncomplete() throws VoteApplicationException { - try { - return voteSessionDAO.countSessionIncomplete(); - } catch (DataAccessException e) { - throw new VoteApplicationException("Exception occured when lams is counting incomplete sessions" - + e.getMessage(), e); - } - } - public void deleteVoteSession(VoteSession voteSession) throws VoteApplicationException { try { voteSessionDAO.removeVoteSession(voteSession); @@ -818,16 +895,6 @@ } } - public int getLastNominationCount(Long userID) throws VoteApplicationException { - try { - int lastNomCount = voteUsrAttemptDAO.getLastNominationCount(userID); - return lastNomCount; - } catch (DataAccessException e) { - throw new VoteApplicationException("Exception occured when lams is retrieving lastNominationount: " - + e.getMessage(), e); - } - } - /** * logs hiding of a user entered vote */ @@ -919,10 +986,10 @@ } } - public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) + public List getAttemptsForUserAndQuestionContent(final Long userUid, final Long questionUid) throws VoteApplicationException { try { - return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(queUsrId, voteQueContentId); + return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(userUid, questionUid); } catch (DataAccessException e) { throw new VoteApplicationException( "Exception occured when lams is getting vote voteUsrRespDAO by user id and que content id: " @@ -1636,6 +1703,7 @@ toolContentObj.setOnlineInstructions(null); toolContentObj.setReflectionSubject(null); toolContentObj.setReflect(false); + toolContentObj.setUseSelectLeaderToolOuput(false); toolContentObj.setRunOffline(false); toolContentObj.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); @@ -2088,6 +2156,10 @@ public void setMessageService(MessageService messageService) { this.messageService = messageService; } + + public void setLamsCoreToolService(ILamsCoreToolService lamsCoreToolService) { + this.lamsCoreToolService = lamsCoreToolService; + } public void removeNominationsFromCache(VoteContent voteContent) { voteContentDAO.removeNominationsFromCache(voteContent); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml =================================================================== diff -u -r61e7bbf20d65e2ecb5e50f3154e52264003defa1 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision 61e7bbf20d65e2ecb5e50f3154e52264003defa1) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -79,6 +79,8 @@ + +
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -539,6 +539,8 @@ String showResults = request.getParameter("showResults"); String maxInputs = request.getParameter("maxInputs"); + + String useSelectLeaderToolOuput = request.getParameter("useSelectLeaderToolOuput"); String reflect = request.getParameter(VoteAppConstants.REFLECT); @@ -558,6 +560,7 @@ boolean allowTextBoolean = false; boolean reflectBoolean = false; boolean showResultsBoolean = false; + boolean useSelectLeaderToolOuputBoolean = false; short maxInputsShort = 0; if (lockOnFinish != null && lockOnFinish.equalsIgnoreCase("1")) { @@ -575,6 +578,10 @@ if (showResults != null && showResults.equalsIgnoreCase("1")) { showResultsBoolean = true; } + + if (useSelectLeaderToolOuput != null && useSelectLeaderToolOuput.equalsIgnoreCase("1")) { + useSelectLeaderToolOuputBoolean = true; + } if (maxInputs != null && !"0".equals(maxInputs)) { maxInputsShort = Short.parseShort(maxInputs); @@ -615,6 +622,7 @@ voteContent.setLockOnFinish(lockedOnFinishBoolean); voteContent.setAllowText(allowTextBoolean); voteContent.setShowResults(showResultsBoolean); + voteContent.setUseSelectLeaderToolOuput(useSelectLeaderToolOuputBoolean); voteContent.setReflect(reflectBoolean); voteContent.setReflectionSubject(reflectionSubject); voteContent.setMaxNominationCount(maxNomcount); @@ -970,6 +978,8 @@ String showResults = request.getParameter("showResults"); String maxInputs = request.getParameter("maxInputs"); + + String useSelectLeaderToolOuput = request.getParameter("useSelectLeaderToolOuput"); String reflect = request.getParameter(VoteAppConstants.REFLECT); @@ -994,6 +1004,7 @@ boolean lockOnFinishBoolean = false; boolean allowTextEntryBoolean = false; + boolean useSelectLeaderToolOuputBoolean = false; boolean reflectBoolean = false; boolean showResultsBoolean = false; short maxInputsShort = 0; @@ -1005,6 +1016,10 @@ if (allowTextEntry != null && allowTextEntry.equalsIgnoreCase("1")) { allowTextEntryBoolean = true; } + + if (useSelectLeaderToolOuput != null && useSelectLeaderToolOuput.equalsIgnoreCase("1")) { + useSelectLeaderToolOuputBoolean = true; + } if (reflect != null && reflect.equalsIgnoreCase("1")) { reflectBoolean = true; @@ -1049,6 +1064,7 @@ voteContent.setLockOnFinish(lockOnFinishBoolean); voteContent.setAllowText(allowTextEntryBoolean); voteContent.setShowResults(showResultsBoolean); + voteContent.setUseSelectLeaderToolOuput(useSelectLeaderToolOuputBoolean); voteContent.setReflect(reflectBoolean); voteContent.setMaxNominationCount(maxNomcount); voteContent.setMinNominationCount(minNomcount); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java (.../LearningUtil.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java (.../LearningUtil.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -30,6 +30,7 @@ import java.util.TreeSet; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; import org.apache.commons.lang.StringUtils; import org.lamsfoundation.lams.learningdesign.DataFlowObject; @@ -44,6 +45,9 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.tool.vote.service.IVoteService; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; /** * @@ -97,67 +101,34 @@ return mapQuestionsContent; } - /** - * determines if a user is already in the tool's tables - * - * @param request - * @return - */ - public static boolean doesUserExists(HttpServletRequest request, IVoteService voteService) { - Long queUsrId = VoteUtils.getUserId(); - VoteQueUsr voteQueUsr = voteService.retrieveVoteQueUsr(queUsrId); - - if (voteQueUsr != null) { - return true; - } - - return false; - } - - /** - * creates a new user for the tool - * - * @param request - * @return - */ - public static VoteQueUsr createUser(HttpServletRequest request, IVoteService voteService, Long toolSessionID) { - - Long queUsrId = VoteUtils.getUserId(); - String username = VoteUtils.getUserName(); - String fullname = VoteUtils.getUserFullName(); - VoteSession voteSession = voteService.retrieveVoteSession(toolSessionID); - VoteQueUsr voteQueUsr = new VoteQueUsr(queUsrId, username, fullname, voteSession, new TreeSet()); - voteService.createVoteQueUsr(voteQueUsr); + public static VoteQueUsr getUser(IVoteService voteService) { + /* get back login user DTO */ + HttpSession ss = SessionManager.getSession(); + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + long userId = toolUser.getUserID().longValue(); + VoteQueUsr voteQueUsr = voteService.retrieveVoteQueUsr(userId); return voteQueUsr; } - public static VoteQueUsr getUser(HttpServletRequest request, IVoteService voteService) { - Long queUsrId = VoteUtils.getUserId(); - VoteQueUsr voteQueUsr = voteService.retrieveVoteQueUsr(queUsrId); - return voteQueUsr; - } - /** * creates a new vote record in the database * * @param request * @param voteQueUsr * @param mapGeneralCheckedOptionsContent * @param userEntry - * @param singleUserEntry * @param voteSession */ - public static void createAttempt(HttpServletRequest request, IVoteService voteService, VoteQueUsr voteQueUsr, - Map mapGeneralCheckedOptionsContent, String userEntry, boolean singleUserEntry, VoteSession voteSession, - Long toolContentUID) { + public static void createAttempt(IVoteService voteService, VoteQueUsr voteQueUsr, + Map mapGeneralCheckedOptionsContent, String userEntry, VoteSession voteSession, Long toolContentUID) { Date attempTime = VoteUtils.getGMTDateTime(); String timeZone = VoteUtils.getCurrentTimeZone(); if (mapGeneralCheckedOptionsContent.size() == 0) { VoteQueContent localVoteQueContent = voteService.getToolDefaultQuestionContent(1); - createIndividualOptions(request, voteService, localVoteQueContent, voteQueUsr, attempTime, timeZone, - userEntry, singleUserEntry, voteSession); + createIndividualOptions(voteService, localVoteQueContent, voteQueUsr, attempTime, timeZone, userEntry, + voteSession); } else { if (toolContentUID != null) { @@ -169,21 +140,20 @@ VoteQueContent voteQueContent = voteService.getQuestionContentByDisplayOrder(questionDisplayOrder, toolContentUID); if (voteQueContent != null) { - createIndividualOptions(request, voteService, voteQueContent, voteQueUsr, attempTime, timeZone, - userEntry, false, voteSession); + createIndividualOptions(voteService, voteQueContent, voteQueUsr, attempTime, timeZone, + userEntry, voteSession); } } } } } - public static void createIndividualOptions(HttpServletRequest request, IVoteService voteService, - VoteQueContent voteQueContent, VoteQueUsr voteQueUsr, Date attempTime, String timeZone, String userEntry, - boolean singleUserEntry, VoteSession voteSession) { + public static void createIndividualOptions(IVoteService voteService, VoteQueContent voteQueContent, + VoteQueUsr voteQueUsr, Date attempTime, String timeZone, String userEntry, VoteSession voteSession) { if (voteQueContent != null) { - VoteUsrAttempt existingVoteUsrAttempt = voteService.getAttemptsForUserAndQuestionContentAndSession( + VoteUsrAttempt existingVoteUsrAttempt = voteService.getAttemptForUserAndQuestionContentAndSession( voteQueUsr.getQueUsrId(), voteQueContent.getVoteContentId(), voteSession.getUid()); if (existingVoteUsrAttempt != null) { @@ -193,7 +163,7 @@ voteService.updateVoteUsrAttempt(existingVoteUsrAttempt); } else { VoteUsrAttempt voteUsrAttempt = new VoteUsrAttempt(attempTime, timeZone, voteQueContent, voteQueUsr, - userEntry, singleUserEntry, true); + userEntry, true); voteService.createVoteUsrAttempt(voteUsrAttempt); } } @@ -272,10 +242,14 @@ } private static void createQuestionsFromToolInput(VoteContent voteContent, IVoteService voteService) { + + /* get back login user DTO */ + HttpSession ss = SessionManager.getSession(); + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + long userId = toolUser.getUserID().longValue(); + // We get whatever the source tool provides us with and try to create questions out of it - DataFlowObject dataFlowObject = voteService.getAssignedDataFlowObject(voteContent.getVoteContentId()); - ToolOutput toolInput = voteService.getToolInput(voteContent.getVoteContentId(), VoteUtils.getUserId() - .intValue()); + ToolOutput toolInput = voteService.getToolInput(voteContent.getVoteContentId(), new Long(userId).intValue()); Object value = toolInput.getValue().getComplex(); short inputsAdded = voteContent.getExternalInputsAdded() == null ? 0 : voteContent.getExternalInputsAdded(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -206,7 +206,7 @@ VoteQueUsr voteQueUsr = (VoteQueUsr) itUsers.next(); if (voteQueUsr != null) { - List listUserAttempts = voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr + List listUserAttempts = voteService.getAttemptsForUserAndQuestionContent(voteQueUsr .getUid(), new Long(questionUid)); Iterator itAttempts = listUserAttempts.iterator(); @@ -227,7 +227,8 @@ VoteQueContent voteQueContent = voteUsrResp.getVoteQueContent(); String entry = voteQueContent.getQuestion(); - String voteQueContentId = voteUsrResp.getVoteQueContentId().toString(); + Long voteQuestionUid = voteUsrResp.getVoteQueContent().getUid(); + String voteQueContentId = voteQuestionUid.toString(); VoteSession localUserSession = voteUsrResp.getVoteQueUsr().getVoteSession(); if (voteContent.getVoteContentId().toString().equals( @@ -256,7 +257,7 @@ voteQueUsr = (VoteQueUsr) itUsers.next(); if (voteQueUsr != null) { - List listUserAttempts = voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr + List listUserAttempts = voteService.getAttemptsForUserAndQuestionContent(voteQueUsr .getUid(), new Long(questionUid)); Iterator itAttempts = listUserAttempts.iterator(); @@ -304,7 +305,7 @@ VoteQueUsr voteQueUsr = (VoteQueUsr) itUsers.next(); if (voteQueUsr != null) { - List listUserAttempts = voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr + List listUserAttempts = voteService.getAttemptsForUserAndQuestionContent(voteQueUsr .getUid(), new Long(questionUid)); Iterator itAttempts = listUserAttempts.iterator(); @@ -360,7 +361,7 @@ VoteQueUsr voteQueUsr = (VoteQueUsr) itUsers.next(); if (voteQueUsr != null) { - List listUserAttempts = voteService.getAttemptsListForUserAndQuestionContent(voteQueUsr.getUid(), + List listUserAttempts = voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid)); Iterator itAttempts = listUserAttempts.iterator(); @@ -835,6 +836,7 @@ request.setAttribute(VOTE_STATS_DTO, voteStatsDTO); // setting up the advanced summary for LDEV-1662 + request.setAttribute("useSelectLeaderToolOuput", voteContent.isUseSelectLeaderToolOuput()); request.setAttribute("lockOnFinish", voteContent.isLockOnFinish()); request.setAttribute("allowText", voteContent.isAllowText()); request.setAttribute("maxNominationCount", voteContent.getMaxNominationCount()); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -508,6 +508,10 @@ String lockOnFinish = request.getParameter(VoteAppConstants.LOCK_ON_FINISH); voteAuthoringForm.setLockOnFinish(lockOnFinish); voteGeneralAuthoringDTO.setLockOnFinish(lockOnFinish); + + String useSelectLeaderToolOuput = request.getParameter(VoteAppConstants.USE_SELECT_LEADER_TOOL_OUTPUT); + voteAuthoringForm.setUseSelectLeaderToolOuput(useSelectLeaderToolOuput); + voteGeneralAuthoringDTO.setUseSelectLeaderToolOuput(useSelectLeaderToolOuput); String allowText = request.getParameter(VoteAppConstants.ALLOW_TEXT); voteAuthoringForm.setAllowText(allowText); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java =================================================================== diff -u -r618abc7cca98f08ef288878ab371a3693492d835 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java (.../VoteAuthoringForm.java) (revision 618abc7cca98f08ef288878ab371a3693492d835) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java (.../VoteAuthoringForm.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -52,6 +52,7 @@ protected String lockOnFinish; protected String allowText; protected String showResults; + protected String useSelectLeaderToolOuput; protected String reflect; protected String reflectionSubject; @@ -197,6 +198,7 @@ richTextOfflineInstructions = null; richTextOnlineInstructions = null; + useSelectLeaderToolOuput = null; reflect = null; lockOnFinish = null; allowText = null; @@ -221,6 +223,7 @@ allowText = "0"; showResults = "0"; reflect = "0"; + useSelectLeaderToolOuput = "0"; } /** @@ -1058,8 +1061,23 @@ .append("richTextOnlineInstructions: ", richTextOnlineInstructions).append("onlineInstructions: ", onlineInstructions).append("offlineInstructions: ", offlineInstructions).toString(); } + + /** + * @return Returns the useSelectLeaderToolOuput. + */ + public String getUseSelectLeaderToolOuput() { + return useSelectLeaderToolOuput; + } /** + * @param useSelectLeaderToolOuput + * The useSelectLeaderToolOuput to set. + */ + public void setUseSelectLeaderToolOuput(String useSelectLeaderToolOuput) { + this.useSelectLeaderToolOuput = useSelectLeaderToolOuput; + } + + /** * @return Returns the reflect. */ public String getReflect() { Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -43,12 +43,15 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.apache.tomcat.util.json.JSONException; +import org.apache.tomcat.util.json.JSONObject; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; +import org.lamsfoundation.lams.tool.vote.VoteApplicationException; import org.lamsfoundation.lams.tool.vote.VoteComparator; import org.lamsfoundation.lams.tool.vote.VoteGeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.vote.VoteGeneralMonitoringDTO; @@ -62,6 +65,7 @@ import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.MessageService; +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; @@ -135,8 +139,6 @@ Set userAttempts = voteService.getAttemptsForUserAndSession(existingVoteQueUsr.getUid(), toolSessionUid); request.setAttribute(LIST_GENERAL_CHECKED_OPTIONS_CONTENT, userAttempts); - request.setAttribute(LIST_GENERAL_CHECKED_OPTIONS_CONTENT, userAttempts); - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); MonitoringUtil.prepareChartData(request, voteService, null, voteContent.getVoteContentId().toString(), voteSession.getUid().toString(), voteGeneralLearnerFlowDTO, voteGeneralMonitoringDTO, @@ -195,7 +197,7 @@ setContentInUse(request, voteService, toolContentID); if (revisitingUser.equals("true")) { - VoteQueUsr voteQueUsr = LearningUtil.getUser(request, voteService); + VoteQueUsr voteQueUsr = LearningUtil.getUser(voteService); List attempts = voteService.getAttemptsForUser(voteQueUsr.getUid()); @@ -294,21 +296,7 @@ voteLearningForm.setUserID(userID); VoteQueUsr voteQueUsr = voteService.getVoteUserBySession(new Long(userID), voteSession.getUid()); - /* it is possible that voteQueUsr can be null if the content is set as runoffline and reflection is on*/ - if (voteQueUsr == null) { - //attempt creating user record since it must exist for the runOffline + reflection screens - HttpSession ss = SessionManager.getSession(); - UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); - - String userName = toolUser.getLogin(); - String fullName = toolUser.getFirstName() + " " + toolUser.getLastName(); - - Long userId = new Long(toolUser.getUserID().longValue()); - voteQueUsr = new VoteQueUsr(new Long(userID), userName, fullName, voteSession, new TreeSet()); - voteService.createVoteQueUsr(voteQueUsr); - } - voteQueUsr.setResponseFinalised(true); if (!voteSession.getVoteContent().isShowResults()) { // if not isShowResults then we will have skipped the final screen. @@ -385,7 +373,7 @@ String userEntry = request.getParameter(USER_ENTRY); voteLearningForm.setUserEntry(userEntry); - VoteSession voteSession = voteService.retrieveVoteSession(new Long(toolSessionID)); + VoteSession session = voteService.retrieveVoteSession(new Long(toolSessionID)); voteLearningForm.setNominationsSubmited(new Boolean(false).toString()); voteLearningForm.setMaxNominationCountReached(new Boolean(false).toString()); voteLearningForm.setMinNominationCountReached(new Boolean(false).toString()); @@ -413,7 +401,7 @@ return (mapping.findForward(LOAD_LEARNER)); } - VoteContent voteContent = voteSession.getVoteContent(); + VoteContent voteContent = session.getVoteContent(); voteGeneralLearnerFlowDTO.setActivityTitle(voteContent.getTitle()); voteGeneralLearnerFlowDTO.setActivityInstructions(voteContent.getInstructions()); @@ -429,49 +417,40 @@ userEntryAvailable = true; } - Long toolSessionUid = voteSession.getUid(); + Long toolSessionUid = session.getUid(); - boolean isUserDefined = false; - VoteQueUsr existingVoteQueUsr = voteService.getVoteUserBySession(new Long(userID), voteSession.getUid()); - - if (existingVoteQueUsr != null) - isUserDefined = true; - - VoteQueUsr voteQueUsr = null; - if (isUserDefined == false) { - voteQueUsr = LearningUtil.createUser(request, voteService, new Long(toolSessionID)); - } else { - voteQueUsr = existingVoteQueUsr; + VoteQueUsr user = voteService.getVoteUserBySession(new Long(userID), session.getUid()); + if (user == null) { + throw new VoteApplicationException("User with userId= " + userID + " and sessionUid= " + + session.getUid() + " doesn't exist."); } + + voteService.removeAttemptsForUserandSession(user.getUid(), session.getUid()); - if (existingVoteQueUsr != null) { - voteService.removeAttemptsForUserandSession(existingVoteQueUsr.getUid(), voteSession.getUid()); - } - - /* to mimize changes to working code, convert the String[] array to the mapGeneralCheckedOptionsContent structure */ + /* to minimize changes to working code, convert the String[] array to the mapGeneralCheckedOptionsContent structure */ Map mapGeneralCheckedOptionsContent = LearningUtil.buildQuestionContentMap(request, voteService, voteContent, voteDisplayOrderIds); if (mapGeneralCheckedOptionsContent.size() > 0) { - LearningUtil.createAttempt(request, voteService, voteQueUsr, mapGeneralCheckedOptionsContent, "", - false, voteSession, toolContentUID); + LearningUtil.createAttempt(voteService, user, mapGeneralCheckedOptionsContent, "", session, + toolContentUID); } if ((mapGeneralCheckedOptionsContent.size() == 0 && (userEntryAvailable == true))) { Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); if (userEntry.length() > 0) { - LearningUtil.createAttempt(request, voteService, voteQueUsr, mapLeanerCheckedOptionsContent, userEntry, - true, voteSession, toolContentUID); + LearningUtil.createAttempt(voteService, user, mapLeanerCheckedOptionsContent, userEntry, + session, toolContentUID); } } if ((mapGeneralCheckedOptionsContent.size() > 0) && (userEntryAvailable == true)) { Map mapLeanerCheckedOptionsContent = new TreeMap(new VoteComparator()); if (userEntry.length() > 0) { - LearningUtil.createAttempt(request, voteService, voteQueUsr, mapLeanerCheckedOptionsContent, userEntry, - false, voteSession, toolContentUID); + LearningUtil.createAttempt(voteService, user, mapLeanerCheckedOptionsContent, userEntry, + session, toolContentUID); } } @@ -565,7 +544,28 @@ errors.add(Globals.ERROR_KEY, new ActionMessage(message)); saveErrors(request, errors); } + + /** + * checks Leader Progress + */ + public ActionForward checkLeaderProgress(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws JSONException, IOException { + + IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + Long toolSessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + VoteSession session = voteService.retrieveVoteSession(toolSessionId); + VoteQueUsr leader = session.getGroupLeader(); + + boolean isLeaderResponseFinalized = leader.isResponseFinalised(); + + JSONObject JSONObject = new JSONObject(); + JSONObject.put("isLeaderResponseFinalized", isLeaderResponseFinalized); + response.setContentType("application/x-json;charset=utf-8"); + response.getWriter().print(JSONObject); + return null; + } + public ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ToolException { VoteLearningForm voteLearningForm = (VoteLearningForm) form; @@ -580,23 +580,7 @@ voteLearningForm.setUserID(userID); String reflectionEntry = request.getParameter(ENTRY_TEXT); - VoteSession voteSession = voteService.retrieveVoteSession(new Long(toolSessionID)); - VoteQueUsr voteQueUsr = voteService.getVoteUserBySession(new Long(userID), voteSession.getUid()); - /* it is possible that voteQueUsr can be null if the content is set as runoffline and reflection is on*/ - if (voteQueUsr == null) { - HttpSession ss = SessionManager.getSession(); - - UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); - String userName = toolUser.getLogin(); - String fullName = toolUser.getFirstName() + " " + toolUser.getLastName(); - - Long userId = new Long(toolUser.getUserID().longValue()); - - voteQueUsr = new VoteQueUsr(new Long(userID), userName, fullName, voteSession, new TreeSet()); - voteService.createVoteQueUsr(voteQueUsr); - } - voteService.createNotebookEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(userID), reflectionEntry); @@ -661,6 +645,9 @@ String minNominationCount = request.getParameter(MIN_NOMINATION_COUNT); voteLearningForm.setMinNominationCount(minNominationCount); + + String useSelectLeaderToolOuput = request.getParameter(USE_SELECT_LEADER_TOOL_OUTPUT); + voteLearningForm.setUseSelectLeaderToolOuput(useSelectLeaderToolOuput); String allowTextEntry = request.getParameter(ALLOW_TEXT_ENTRY); voteLearningForm.setAllowTextEntry(allowTextEntry); @@ -676,6 +663,12 @@ String userEntry = request.getParameter(USER_ENTRY); voteLearningForm.setUserEntry(userEntry); + + String groupLeaderName = request.getParameter(ATTR_GROUP_LEADER_NAME); + voteLearningForm.setGroupLeaderName(groupLeaderName); + + boolean isUserLeader = WebUtil.readBooleanParam(request, "userLeader"); + voteLearningForm.setIsUserLeader(isUserLeader); } /** Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java =================================================================== diff -u -r618abc7cca98f08ef288878ab371a3693492d835 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java (.../VoteLearningForm.java) (revision 618abc7cca98f08ef288878ab371a3693492d835) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java (.../VoteLearningForm.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -34,824 +34,983 @@ import org.lamsfoundation.lams.tool.vote.VoteAppConstants; /** - *

ActionForm for the Learning environment

+ *

+ * ActionForm for the Learning environment + *

* * @author Ozgur Demirtas */ public class VoteLearningForm extends ActionForm implements VoteAppConstants { - protected String optionCheckBoxSelected; - protected String questionIndex; - protected String optionIndex; - protected String optionValue; - protected String checked; - + protected String optionCheckBoxSelected; + protected String questionIndex; + protected String optionIndex; + protected String optionValue; + protected String checked; + protected String sbmtSuccess; - - protected String userEntry; - protected String dispatch; - protected String toolContentID; - - protected String maxNominationCount; - protected String minNominationCount; - protected String allowTextEntry; - protected String showResults; - protected String lockOnFinish; - protected String activityRunOffline; - protected String activityRetries; - protected String activityTitle; - protected String activityInstructions; - - protected String continueOptions; - protected String nextOptions; - protected String castVotes; - - protected String continueOptionsCombined; - protected String redoQuestions; - protected String viewSummary; - protected String viewAnswers; - protected String learnerFinished; - protected String redoQuestionsOk; - protected String donePreview; - protected String doneLearnerProgress; - protected String viewAllResults; - - protected String responseId; - protected String method; - protected String answer; - protected String submitAnswersContent; - protected String getNextQuestion; - protected String getPreviousQuestion; - protected String endLearning; - protected String refreshVotes; - protected String submitReflection; - protected String forwardtoReflection; - - protected String reflection; - - protected String nominationsSubmited; - protected String revisitingUser; - protected String maxNominationCountReached; - protected String minNominationCountReached; - protected int castVoteCount; - - protected Map mapGeneralCheckedOptionsContent; - - protected String entryText; - protected String userID; - protected String toolSessionID; - protected String learningMode; - protected String toolContentUID; - protected String previewOnly; - protected String reportViewOnly; - + protected String userEntry; + protected String dispatch; + protected String toolContentID; + + protected String useSelectLeaderToolOuput; + protected String maxNominationCount; + protected String minNominationCount; + protected String allowTextEntry; + protected String showResults; + protected String lockOnFinish; + protected String activityRunOffline; + protected String activityRetries; + protected String activityTitle; + protected String activityInstructions; + + protected String continueOptions; + protected String nextOptions; + protected String castVotes; + + protected String continueOptionsCombined; + protected String redoQuestions; + protected String viewSummary; + protected String viewAnswers; + protected String learnerFinished; + protected String redoQuestionsOk; + protected String donePreview; + protected String doneLearnerProgress; + protected String viewAllResults; + + protected String responseId; + protected String method; + protected String answer; + protected String submitAnswersContent; + protected String getNextQuestion; + protected String getPreviousQuestion; + protected String endLearning; + protected String refreshVotes; + protected String submitReflection; + protected String forwardtoReflection; + + protected String reflection; + + protected String nominationsSubmited; + protected String revisitingUser; + protected String maxNominationCountReached; + protected String minNominationCountReached; + protected int castVoteCount; + + protected Map mapGeneralCheckedOptionsContent; + + protected String entryText; + protected String userID; + protected String toolSessionID; + protected String learningMode; + protected String toolContentUID; + protected String previewOnly; + protected String reportViewOnly; + + protected boolean isUserLeader; + protected String groupLeaderName; + /** * @return Returns the learningMode. */ public String getLearningMode() { - return learningMode; + return learningMode; } + /** - * @param learningMode The learningMode to set. + * @param learningMode + * The learningMode to set. */ public void setLearningMode(String learningMode) { - this.learningMode = learningMode; + this.learningMode = learningMode; } -/** The check boxes selected on the first voting screen */ - protected String[] checkedVotes; - - public void reset(ActionMapping mapping, HttpServletRequest request) { - checkedVotes = new String[0]; - } - - protected void resetUserActions() - { - this.getNextQuestion=null; - this.getPreviousQuestion=null; - this.endLearning=null; - this.viewAllResults=null; + + /** The check boxes selected on the first voting screen */ + protected String[] checkedVotes; + + public void reset(ActionMapping mapping, HttpServletRequest request) { + checkedVotes = new String[0]; } - + protected void resetUserActions() { + this.getNextQuestion = null; + this.getPreviousQuestion = null; + this.endLearning = null; + this.viewAllResults = null; + } + /** * @return Returns the answer. */ public String getAnswer() { - return answer; + return answer; } + /** - * @param answer The answer to set. + * @param answer + * The answer to set. */ public void setAnswer(String answer) { - this.answer = answer; + this.answer = answer; } + /** * @return Returns the endLearning. */ public String getEndLearning() { - return endLearning; + return endLearning; } + /** - * @param endLearning The endLearning to set. + * @param endLearning + * The endLearning to set. */ public void setEndLearning(String endLearning) { - this.endLearning = endLearning; + this.endLearning = endLearning; } + /** * @return Returns the getNextQuestion. */ public String getGetNextQuestion() { - return getNextQuestion; + return getNextQuestion; } + /** - * @param getNextQuestion The getNextQuestion to set. + * @param getNextQuestion + * The getNextQuestion to set. */ public void setGetNextQuestion(String getNextQuestion) { - this.getNextQuestion = getNextQuestion; + this.getNextQuestion = getNextQuestion; } + /** * @return Returns the getPreviousQuestion. */ public String getGetPreviousQuestion() { - return getPreviousQuestion; + return getPreviousQuestion; } + /** - * @param getPreviousQuestion The getPreviousQuestion to set. + * @param getPreviousQuestion + * The getPreviousQuestion to set. */ public void setGetPreviousQuestion(String getPreviousQuestion) { - this.getPreviousQuestion = getPreviousQuestion; + this.getPreviousQuestion = getPreviousQuestion; } + /** * @return Returns the method. */ public String getMethod() { - return method; + return method; } + /** - * @param method The method to set. + * @param method + * The method to set. */ public void setMethod(String method) { - this.method = method; + this.method = method; } + /** * @return Returns the responseId. */ public String getResponseId() { - return responseId; + return responseId; } + /** - * @param responseId The responseId to set. + * @param responseId + * The responseId to set. */ public void setResponseId(String responseId) { - this.responseId = responseId; + this.responseId = responseId; } + /** * @return Returns the submitAnswersContent. */ public String getSubmitAnswersContent() { - return submitAnswersContent; + return submitAnswersContent; } + /** - * @param submitAnswersContent The submitAnswersContent to set. + * @param submitAnswersContent + * The submitAnswersContent to set. */ public void setSubmitAnswersContent(String submitAnswersContent) { - this.submitAnswersContent = submitAnswersContent; + this.submitAnswersContent = submitAnswersContent; } - - - public void resetCommands() - { - this.setContinueOptions(null); - this.setNextOptions(null); - this.setContinueOptionsCombined(null); - this.setRedoQuestions( null); - this.setViewSummary(null); - this.setViewAnswers(null); - this.setRedoQuestionsOk(null); - this.setLearnerFinished(null); - this.setDonePreview(null); - this.setDoneLearnerProgress(null); - this.setRefreshVotes(null); - this.setSubmitReflection(null); - this.setForwardtoReflection(null); - } - public void resetParameters() - { - this.setOptionCheckBoxSelected(null); - this.setQuestionIndex(null); - this.setOptionIndex(null); - this.setChecked(null); - this.setOptionValue(null); - } + public void resetCommands() { + this.setContinueOptions(null); + this.setNextOptions(null); + this.setContinueOptionsCombined(null); + this.setRedoQuestions(null); + this.setViewSummary(null); + this.setViewAnswers(null); + this.setRedoQuestionsOk(null); + this.setLearnerFinished(null); + this.setDonePreview(null); + this.setDoneLearnerProgress(null); + this.setRefreshVotes(null); + this.setSubmitReflection(null); + this.setForwardtoReflection(null); + } + public void resetParameters() { + this.setOptionCheckBoxSelected(null); + this.setQuestionIndex(null); + this.setOptionIndex(null); + this.setChecked(null); + this.setOptionValue(null); + } - /** - * @return Returns the continueOptions. - */ - public String getContinueOptions() { - return continueOptions; - } - /** - * @param continueOptions The continueOptions to set. - */ - public void setContinueOptions(String continueOptions) { - this.continueOptions = continueOptions; - } - /** - * @return Returns the checked. - */ - public String getChecked() { - return checked; - } - /** - * @param checked The checked to set. - */ - public void setChecked(String checked) { - this.checked = checked; - } - /** - * @return Returns the optionCheckBoxSelected. - */ - public String getOptionCheckBoxSelected() { - return optionCheckBoxSelected; - } - /** - * @param optionCheckBoxSelected The optionCheckBoxSelected to set. - */ - public void setOptionCheckBoxSelected(String optionCheckBoxSelected) { - this.optionCheckBoxSelected = optionCheckBoxSelected; - } - /** + /** + * @return Returns the continueOptions. + */ + public String getContinueOptions() { + return continueOptions; + } + + /** + * @param continueOptions + * The continueOptions to set. + */ + public void setContinueOptions(String continueOptions) { + this.continueOptions = continueOptions; + } + + /** + * @return Returns the checked. + */ + public String getChecked() { + return checked; + } + + /** + * @param checked + * The checked to set. + */ + public void setChecked(String checked) { + this.checked = checked; + } + + /** + * @return Returns the optionCheckBoxSelected. + */ + public String getOptionCheckBoxSelected() { + return optionCheckBoxSelected; + } + + /** + * @param optionCheckBoxSelected + * The optionCheckBoxSelected to set. + */ + public void setOptionCheckBoxSelected(String optionCheckBoxSelected) { + this.optionCheckBoxSelected = optionCheckBoxSelected; + } + + /** * @return Returns the refreshVotes. */ public String getRefreshVotes() { - return refreshVotes; + return refreshVotes; } + /** - * @param refreshVotes The refreshVotes to set. + * @param refreshVotes + * The refreshVotes to set. */ public void setRefreshVotes(String refreshVotes) { - this.refreshVotes = refreshVotes; + this.refreshVotes = refreshVotes; } -/** - * @return Returns the optionIndex. - */ - public String getOptionIndex() { - return optionIndex; - } - /** - * @param optionIndex The optionIndex to set. - */ - public void setOptionIndex(String optionIndex) { - this.optionIndex = optionIndex; - } - /** - * @return Returns the questionIndex. - */ - public String getQuestionIndex() { - return questionIndex; - } - /** - * @param questionIndex The questionIndex to set. - */ - public void setQuestionIndex(String questionIndex) { - this.questionIndex = questionIndex; - } - - /** - * @return Returns the viewSummary. - */ - public String getViewSummary() { - return viewSummary; - } - /** - * @param viewSummary The viewSummary to set. - */ - public void setViewSummary(String viewSummary) { - this.viewSummary = viewSummary; - } - /** - * @return Returns the continueOptionsCombined. - */ - public String getContinueOptionsCombined() { - return continueOptionsCombined; - } - /** - * @param continueOptionsCombined The continueOptionsCombined to set. - */ - public void setContinueOptionsCombined(String continueOptionsCombined) { - this.continueOptionsCombined = continueOptionsCombined; - } - /** - * @return Returns the redoQuestions. - */ - public String getRedoQuestions() { - return redoQuestions; - } - /** - * @param redoQuestions The redoQuestions to set. - */ - public void setRedoQuestions(String redoQuestions) { - this.redoQuestions = redoQuestions; - } - /** - * @return Returns the optionValue. - */ - public String getOptionValue() { - return optionValue; - } - /** - * @param optionValue The optionValue to set. - */ - public void setOptionValue(String optionValue) { - this.optionValue = optionValue; - } - /** - * @return Returns the viewAnswers. - */ - public String getViewAnswers() { - return viewAnswers; - } - /** - * @param viewAnswers The viewAnswers to set. - */ - public void setViewAnswers(String viewAnswers) { - this.viewAnswers = viewAnswers; - } - /** - * @return Returns the redoQuestionsOk. - */ - public String getRedoQuestionsOk() { - return redoQuestionsOk; - } - /** - * @param redoQuestionsOk The redoQuestionsOk to set. - */ - public void setRedoQuestionsOk(String redoQuestionsOk) { - this.redoQuestionsOk = redoQuestionsOk; - } - /** - * @return Returns the nextOptions. - */ - public String getNextOptions() { - return nextOptions; - } - /** - * @param nextOptions The nextOptions to set. - */ - public void setNextOptions(String nextOptions) { - this.nextOptions = nextOptions; - } - /** - * @return Returns the learnerFinished. - */ - public String getLearnerFinished() { - return learnerFinished; - } - /** - * @param learnerFinished The learnerFinished to set. - */ - public void setLearnerFinished(String learnerFinished) { - this.learnerFinished = learnerFinished; - } - /** - * @return Returns the donePreview. - */ - public String getDonePreview() { - return donePreview; - } - /** - * @param donePreview The donePreview to set. - */ - public void setDonePreview(String donePreview) { - this.donePreview = donePreview; - } - /** - * @return Returns the doneLearnerProgress. - */ - public String getDoneLearnerProgress() { - return doneLearnerProgress; - } - /** - * @param doneLearnerProgress The doneLearnerProgress to set. - */ - public void setDoneLearnerProgress(String doneLearnerProgress) { - this.doneLearnerProgress = doneLearnerProgress; - } - + /** + * @return Returns the optionIndex. + */ + public String getOptionIndex() { + return optionIndex; + } + + /** + * @param optionIndex + * The optionIndex to set. + */ + public void setOptionIndex(String optionIndex) { + this.optionIndex = optionIndex; + } + + /** + * @return Returns the questionIndex. + */ + public String getQuestionIndex() { + return questionIndex; + } + + /** + * @param questionIndex + * The questionIndex to set. + */ + public void setQuestionIndex(String questionIndex) { + this.questionIndex = questionIndex; + } + + /** + * @return Returns the viewSummary. + */ + public String getViewSummary() { + return viewSummary; + } + + /** + * @param viewSummary + * The viewSummary to set. + */ + public void setViewSummary(String viewSummary) { + this.viewSummary = viewSummary; + } + + /** + * @return Returns the continueOptionsCombined. + */ + public String getContinueOptionsCombined() { + return continueOptionsCombined; + } + + /** + * @param continueOptionsCombined + * The continueOptionsCombined to set. + */ + public void setContinueOptionsCombined(String continueOptionsCombined) { + this.continueOptionsCombined = continueOptionsCombined; + } + + /** + * @return Returns the redoQuestions. + */ + public String getRedoQuestions() { + return redoQuestions; + } + + /** + * @param redoQuestions + * The redoQuestions to set. + */ + public void setRedoQuestions(String redoQuestions) { + this.redoQuestions = redoQuestions; + } + + /** + * @return Returns the optionValue. + */ + public String getOptionValue() { + return optionValue; + } + + /** + * @param optionValue + * The optionValue to set. + */ + public void setOptionValue(String optionValue) { + this.optionValue = optionValue; + } + + /** + * @return Returns the viewAnswers. + */ + public String getViewAnswers() { + return viewAnswers; + } + + /** + * @param viewAnswers + * The viewAnswers to set. + */ + public void setViewAnswers(String viewAnswers) { + this.viewAnswers = viewAnswers; + } + + /** + * @return Returns the redoQuestionsOk. + */ + public String getRedoQuestionsOk() { + return redoQuestionsOk; + } + + /** + * @param redoQuestionsOk + * The redoQuestionsOk to set. + */ + public void setRedoQuestionsOk(String redoQuestionsOk) { + this.redoQuestionsOk = redoQuestionsOk; + } + + /** + * @return Returns the nextOptions. + */ + public String getNextOptions() { + return nextOptions; + } + + /** + * @param nextOptions + * The nextOptions to set. + */ + public void setNextOptions(String nextOptions) { + this.nextOptions = nextOptions; + } + + /** + * @return Returns the learnerFinished. + */ + public String getLearnerFinished() { + return learnerFinished; + } + + /** + * @param learnerFinished + * The learnerFinished to set. + */ + public void setLearnerFinished(String learnerFinished) { + this.learnerFinished = learnerFinished; + } + + /** + * @return Returns the donePreview. + */ + public String getDonePreview() { + return donePreview; + } + + /** + * @param donePreview + * The donePreview to set. + */ + public void setDonePreview(String donePreview) { + this.donePreview = donePreview; + } + + /** + * @return Returns the doneLearnerProgress. + */ + public String getDoneLearnerProgress() { + return doneLearnerProgress; + } + + /** + * @param doneLearnerProgress + * The doneLearnerProgress to set. + */ + public void setDoneLearnerProgress(String doneLearnerProgress) { + this.doneLearnerProgress = doneLearnerProgress; + } + + /** * @return Returns the userEntry. */ public String getUserEntry() { - return userEntry; + return userEntry; } + /** - * @param userEntry The userEntry to set. + * @param userEntry + * The userEntry to set. */ public void setUserEntry(String userEntry) { - this.userEntry = userEntry; + this.userEntry = userEntry; } - + /** * @return Returns the dispatch. */ public String getDispatch() { - return dispatch; + return dispatch; } + /** - * @param dispatch The dispatch to set. + * @param dispatch + * The dispatch to set. */ public void setDispatch(String dispatch) { - this.dispatch = dispatch; + this.dispatch = dispatch; } /** * @return Returns the toolContentID. */ public String getToolContentID() { - return toolContentID; + return toolContentID; } + /** - * @param toolContentID The toolContentID to set. + * @param toolContentID + * The toolContentID to set. */ public void setToolContentID(String toolContentID) { - this.toolContentID = toolContentID; + this.toolContentID = toolContentID; } - /** * @return Returns the viewAllResults. */ public String getViewAllResults() { - return viewAllResults; + return viewAllResults; } + /** - * @param viewAllResults The viewAllResults to set. + * @param viewAllResults + * The viewAllResults to set. */ public void setViewAllResults(String viewAllResults) { - this.viewAllResults = viewAllResults; + this.viewAllResults = viewAllResults; } - + /** * @return Returns the activityInstructions. */ public String getActivityInstructions() { - return activityInstructions; + return activityInstructions; } + /** - * @param activityInstructions The activityInstructions to set. + * @param activityInstructions + * The activityInstructions to set. */ public void setActivityInstructions(String activityInstructions) { - this.activityInstructions = activityInstructions; + this.activityInstructions = activityInstructions; } + /** * @return Returns the activityTitle. */ public String getActivityTitle() { - return activityTitle; + return activityTitle; } + /** - * @param activityTitle The activityTitle to set. + * @param activityTitle + * The activityTitle to set. */ public void setActivityTitle(String activityTitle) { - this.activityTitle = activityTitle; - } + this.activityTitle = activityTitle; + } /** * @return Returns the activityRetries. */ public String getActivityRetries() { - return activityRetries; + return activityRetries; } + /** - * @param activityRetries The activityRetries to set. + * @param activityRetries + * The activityRetries to set. */ public void setActivityRetries(String activityRetries) { - this.activityRetries = activityRetries; + this.activityRetries = activityRetries; } + /** * @return Returns the activityRunOffline. */ public String getActivityRunOffline() { - return activityRunOffline; + return activityRunOffline; } + /** - * @param activityRunOffline The activityRunOffline to set. + * @param activityRunOffline + * The activityRunOffline to set. */ public void setActivityRunOffline(String activityRunOffline) { - this.activityRunOffline = activityRunOffline; + this.activityRunOffline = activityRunOffline; } /** * @return Returns the lockOnFinish. */ public String getLockOnFinish() { - return lockOnFinish; + return lockOnFinish; } + /** - * @param lockOnFinish The lockOnFinish to set. + * @param lockOnFinish + * The lockOnFinish to set. */ public void setLockOnFinish(String lockOnFinish) { - this.lockOnFinish = lockOnFinish; + this.lockOnFinish = lockOnFinish; } + /** + * @return Returns the useSelectLeaderToolOuput. + */ + public String getUseSelectLeaderToolOuput() { + return useSelectLeaderToolOuput; + } + + /** + * @param allowTextEntry + * The useSelectLeaderToolOuput to set. + */ + public void setUseSelectLeaderToolOuput(String useSelectLeaderToolOuput) { + this.useSelectLeaderToolOuput = useSelectLeaderToolOuput; + } + + /** * @return Returns the allowTextEntry. */ public String getAllowTextEntry() { - return allowTextEntry; + return allowTextEntry; } + /** - * @param allowTextEntry The allowTextEntry to set. + * @param allowTextEntry + * The allowTextEntry to set. */ public void setAllowTextEntry(String allowTextEntry) { - this.allowTextEntry = allowTextEntry; + this.allowTextEntry = allowTextEntry; } + /** * @return Returns the maxNominationCount. */ public String getMaxNominationCount() { - return maxNominationCount; + return maxNominationCount; } + /** - * @param maxNominationCount The maxNominationCount to set. + * @param maxNominationCount + * The maxNominationCount to set. */ public void setMaxNominationCount(String maxNominationCount) { - this.maxNominationCount = maxNominationCount; + this.maxNominationCount = maxNominationCount; } + /** * @return Returns the minNominationCount. */ public String getMinNominationCount() { - return minNominationCount; + return minNominationCount; } + /** - * @param minNominationCount The minNominationCount to set. + * @param minNominationCount + * The minNominationCount to set. */ public void setMinNominationCount(String minNominationCount) { - this.minNominationCount = minNominationCount; - } + this.minNominationCount = minNominationCount; + } /** * @return Returns the nominationsSubmited. */ public String getNominationsSubmited() { - return nominationsSubmited; + return nominationsSubmited; } + /** - * @param nominationsSubmited The nominationsSubmited to set. + * @param nominationsSubmited + * The nominationsSubmited to set. */ public void setNominationsSubmited(String nominationsSubmited) { - this.nominationsSubmited = nominationsSubmited; + this.nominationsSubmited = nominationsSubmited; } /** * @return Returns the revisitingUser. */ public String getRevisitingUser() { - return revisitingUser; + return revisitingUser; } + /** - * @param revisitingUser The revisitingUser to set. + * @param revisitingUser + * The revisitingUser to set. */ public void setRevisitingUser(String revisitingUser) { - this.revisitingUser = revisitingUser; + this.revisitingUser = revisitingUser; } /** * @return Returns the castVoteCount. */ public int getCastVoteCount() { - return castVoteCount; + return castVoteCount; } + /** - * @param castVoteCount The castVoteCount to set. + * @param castVoteCount + * The castVoteCount to set. */ public void setCastVoteCount(int castVoteCount) { - this.castVoteCount = castVoteCount; + this.castVoteCount = castVoteCount; } - + /** * @return Returns the castVotes. */ public String getCastVotes() { - return castVotes; + return castVotes; } + /** - * @param castVotes The castVotes to set. + * @param castVotes + * The castVotes to set. */ public void setCastVotes(String castVotes) { - this.castVotes = castVotes; + this.castVotes = castVotes; } + /** * @return Returns the maxNominationCountReached. */ public String getMaxNominationCountReached() { - return maxNominationCountReached; + return maxNominationCountReached; } + /** - * @param maxNominationCountReached The maxNominationCountReached to set. + * @param maxNominationCountReached + * The maxNominationCountReached to set. */ public void setMaxNominationCountReached(String maxNominationCountReached) { - this.maxNominationCountReached = maxNominationCountReached; + this.maxNominationCountReached = maxNominationCountReached; } + /** * @return Returns the minNominationCountReached. */ public String getMinNominationCountReached() { - return minNominationCountReached; + return minNominationCountReached; } + /** - * @param minNominationCountReached The minNominationCountReached to set. + * @param minNominationCountReached + * The minNominationCountReached to set. */ public void setMinNominationCountReached(String minNominationCountReached) { - this.minNominationCountReached = minNominationCountReached; - } - + this.minNominationCountReached = minNominationCountReached; + } + /** * @return Returns the sbmtSuccess. */ public String getSbmtSuccess() { - return sbmtSuccess; + return sbmtSuccess; } + /** - * @param sbmtSuccess The sbmtSuccess to set. + * @param sbmtSuccess + * The sbmtSuccess to set. */ public void setSbmtSuccess(String sbmtSuccess) { - this.sbmtSuccess = sbmtSuccess; + this.sbmtSuccess = sbmtSuccess; } - /** Get the votes based on the checkboxes */ - public String[] getCheckedVotes() { - return checkedVotes; - } + public String[] getCheckedVotes() { + return checkedVotes; + } /** Get the votes based on the checkboxes as a collection */ - public Collection votesAsCollection() { - ArrayList votes = new ArrayList(); - for ( String vote: checkedVotes) { - votes.add(vote); - } - return votes; + public Collection votesAsCollection() { + ArrayList votes = new ArrayList(); + for (String vote : checkedVotes) { + votes.add(vote); } + return votes; + } - /** Set the votes based on the checkboxes */ - public void setCheckedVotes(String[] checkedVotes) { - this.checkedVotes = checkedVotes; - } - + /** Set the votes based on the checkboxes */ + public void setCheckedVotes(String[] checkedVotes) { + this.checkedVotes = checkedVotes; + } /** * @return Returns the mapGeneralCheckedOptionsContent. */ public Map getMapGeneralCheckedOptionsContent() { - return mapGeneralCheckedOptionsContent; + return mapGeneralCheckedOptionsContent; } + /** - * @param mapGeneralCheckedOptionsContent The mapGeneralCheckedOptionsContent to set. + * @param mapGeneralCheckedOptionsContent + * The mapGeneralCheckedOptionsContent to set. */ - public void setMapGeneralCheckedOptionsContent( - Map mapGeneralCheckedOptionsContent) { - this.mapGeneralCheckedOptionsContent = mapGeneralCheckedOptionsContent; + public void setMapGeneralCheckedOptionsContent(Map mapGeneralCheckedOptionsContent) { + this.mapGeneralCheckedOptionsContent = mapGeneralCheckedOptionsContent; } + /** * @return Returns the userID. */ public String getUserID() { - return userID; + return userID; } + /** - * @param userID The userID to set. + * @param userID + * The userID to set. */ public void setUserID(String userID) { - this.userID = userID; + this.userID = userID; } - - /** + + /** * @return Returns the reportViewOnly. */ public String getReportViewOnly() { - return reportViewOnly; + return reportViewOnly; } + /** - * @param reportViewOnly The reportViewOnly to set. + * @param reportViewOnly + * The reportViewOnly to set. */ public void setReportViewOnly(String reportViewOnly) { - this.reportViewOnly = reportViewOnly; + this.reportViewOnly = reportViewOnly; } -/** + + /** * @return Returns the toolSessionID. */ public String getToolSessionID() { - return toolSessionID; + return toolSessionID; } + /** - * @param toolSessionID The toolSessionID to set. + * @param toolSessionID + * The toolSessionID to set. */ public void setToolSessionID(String toolSessionID) { - this.toolSessionID = toolSessionID; + this.toolSessionID = toolSessionID; } + /** * @return Returns the toolContentUID. */ public String getToolContentUID() { - return toolContentUID; + return toolContentUID; } + /** - * @param toolContentUID The toolContentUID to set. + * @param toolContentUID + * The toolContentUID to set. */ public void setToolContentUID(String toolContentUID) { - this.toolContentUID = toolContentUID; + this.toolContentUID = toolContentUID; } - + /** * @return Returns the previewOnly. */ public String getPreviewOnly() { - return previewOnly; + return previewOnly; } + /** - * @param previewOnly The previewOnly to set. + * @param previewOnly + * The previewOnly to set. */ public void setPreviewOnly(String previewOnly) { - this.previewOnly = previewOnly; + this.previewOnly = previewOnly; } - + /** * @return Returns the forwardtoReflection. */ public String getForwardtoReflection() { - return forwardtoReflection; + return forwardtoReflection; } + /** - * @param forwardtoReflection The forwardtoReflection to set. + * @param forwardtoReflection + * The forwardtoReflection to set. */ public void setForwardtoReflection(String forwardtoReflection) { - this.forwardtoReflection = forwardtoReflection; + this.forwardtoReflection = forwardtoReflection; } + /** * @return Returns the submitReflection. */ public String getSubmitReflection() { - return submitReflection; + return submitReflection; } + /** - * @param submitReflection The submitReflection to set. + * @param submitReflection + * The submitReflection to set. */ public void setSubmitReflection(String submitReflection) { - this.submitReflection = submitReflection; + this.submitReflection = submitReflection; } - - + public String toString() { - return new ToStringBuilder(this) - .append("activityInstructions: ", activityInstructions) - .append("activityTitle: ", activityTitle) - .append("revisitingUser: ", revisitingUser) - .append("userEntry: ", userEntry) - .append("castVoteCount: ", castVoteCount) - .append("maxNominationCountReached: ", maxNominationCountReached) - .append("activityRunOffline: ", activityRunOffline) - .append("toolSessionID: ", toolSessionID) - .append("learningMode: ", learningMode) - .append("toolContentID: ", toolContentID) - .append("nominationsSubmited: ", nominationsSubmited) - .append("toolContentUID: ", toolContentUID) - .append("previewOnly: ", previewOnly) - .append("reportViewOnly: ", reportViewOnly) - .append("mapGeneralCheckedOptionsContent: ", mapGeneralCheckedOptionsContent) - .toString(); + return new ToStringBuilder(this).append("activityInstructions: ", activityInstructions) + .append("activityTitle: ", activityTitle).append("revisitingUser: ", revisitingUser) + .append("userEntry: ", userEntry).append("castVoteCount: ", castVoteCount) + .append("maxNominationCountReached: ", maxNominationCountReached) + .append("activityRunOffline: ", activityRunOffline).append("toolSessionID: ", toolSessionID) + .append("learningMode: ", learningMode).append("toolContentID: ", toolContentID) + .append("nominationsSubmited: ", nominationsSubmited).append("toolContentUID: ", toolContentUID) + .append("previewOnly: ", previewOnly).append("reportViewOnly: ", reportViewOnly) + .append("mapGeneralCheckedOptionsContent: ", mapGeneralCheckedOptionsContent).toString(); } - + /** * @return Returns the entryText. */ public String getEntryText() { - return entryText; + return entryText; } + /** - * @param entryText The entryText to set. + * @param entryText + * The entryText to set. */ public void setEntryText(String entryText) { - this.entryText = entryText; + this.entryText = entryText; } + /** * @return Returns the reflection. */ public String getReflection() { - return reflection; + return reflection; } + /** - * @param reflection The reflection to set. + * @param reflection + * The reflection to set. */ public void setReflection(String reflection) { - this.reflection = reflection; + this.reflection = reflection; } - public String getShowResults() { - return showResults; - } - public void setShowResults(String showResults) { - this.showResults = showResults; - } + + public String getShowResults() { + return showResults; + } + + public void setShowResults(String showResults) { + this.showResults = showResults; + } + + public String getGroupLeaderName() { + return groupLeaderName; + } + + public void setGroupLeaderName(String groupLeaderName) { + this.groupLeaderName = groupLeaderName; + } + + public boolean isUserLeader() { + return isUserLeader; + } + + public void setIsUserLeader(boolean isUserLeader) { + this.isUserLeader = isUserLeader; + } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java =================================================================== diff -u -r601fd92095193321a6b2286ef55108fbe5f9dfc4 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java (.../VoteLearningStarterAction.java) (revision 601fd92095193321a6b2286ef55108fbe5f9dfc4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java (.../VoteLearningStarterAction.java) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -161,6 +161,7 @@ import java.util.Set; import java.util.TimeZone; import java.util.TreeMap; +import java.util.TreeSet; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -178,6 +179,7 @@ import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteApplicationException; import org.lamsfoundation.lams.tool.vote.VoteComparator; @@ -194,11 +196,14 @@ import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.MessageService; +import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; public class VoteLearningStarterAction extends Action implements VoteAppConstants { - static Logger logger = Logger.getLogger(VoteLearningStarterAction.class.getName()); + private static Logger logger = Logger.getLogger(VoteLearningStarterAction.class.getName()); + + private static IVoteService voteService; /* * By now, the passed tool session id MUST exist in the db through the calling of: public void @@ -212,11 +217,13 @@ HttpServletResponse response) throws IOException, ServletException, VoteApplicationException { VoteUtils.cleanUpSessionAbsolute(request); + + if (voteService == null) { + voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + } Map mapQuestionsContent = new TreeMap(new VoteComparator()); - Map mapAnswers = new TreeMap(new VoteComparator()); - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); VoteGeneralLearnerFlowDTO voteGeneralLearnerFlowDTO = new VoteGeneralLearnerFlowDTO(); VoteLearningForm voteLearningForm = (VoteLearningForm) form; @@ -280,86 +287,69 @@ voteLearningForm.setToolContentUID(voteContent.getUid().toString()); voteGeneralLearnerFlowDTO.setToolContentUID(voteContent.getUid().toString()); - String userID = voteLearningForm.getUserID(); voteGeneralLearnerFlowDTO.setReflection(new Boolean(voteContent.isReflect()).toString()); String reflectionSubject = VoteUtils.replaceNewLines(voteContent.getReflectionSubject()); voteGeneralLearnerFlowDTO.setReflectionSubject(reflectionSubject); - /* - * Is the request for a preview by the author? Preview The tool must be able to show the specified content as if - * it was running in a lesson. It will be the learner url with tool access mode set to ToolAccessMode.AUTHOR 3 - * modes are: author teacher learner - */ - /* ? CHECK THIS: how do we determine whether preview is requested? Mode is not enough on its own. */ + String mode = voteLearningForm.getLearningMode(); + voteGeneralLearnerFlowDTO.setLearningMode(mode); + + String userId = voteLearningForm.getUserID(); + NotebookEntry notebookEntry = voteService.getEntry(new Long(toolSessionID), + CoreNotebookConstants.NOTEBOOK_TOOL, VoteAppConstants.MY_SIGNATURE, new Integer(userId)); + if (notebookEntry != null) { + String notebookEntryPresentable = VoteUtils.replaceNewLines(notebookEntry.getEntry()); + voteGeneralLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); + } request.setAttribute(VoteAppConstants.VOTE_GENERAL_LEARNER_FLOW_DTO, voteGeneralLearnerFlowDTO); /* handle PREVIEW mode */ - String mode = voteLearningForm.getLearningMode(); if (mode != null && mode.equals("author")) { commonContentSetup(request, voteService, voteContent, voteGeneralLearnerFlowDTO); request.setAttribute(VoteAppConstants.VOTE_GENERAL_LEARNER_FLOW_DTO, voteGeneralLearnerFlowDTO); } + + VoteQueUsr user = null; + if ((mode != null) && mode.equals(ToolAccessMode.TEACHER.toString())) { + // monitoring mode - user is specified in URL + // user may be null if the user was force completed. + user = getSpecifiedUser(toolSessionID, WebUtil.readIntParam(request, AttributeNames.PARAM_USER_ID, false)); + } else { + user = getCurrentUser(toolSessionID); + } + + // check if there is submission deadline + Date submissionDeadline = voteContent.getSubmissionDeadline(); - /* - * by now, we know that the mode is either teacher or learner check if the mode is teacher and request is for - * Learner Progress - */ + if (submissionDeadline != null) { - String learnerProgressUserId = request.getParameter(VoteAppConstants.USER_ID); + request.setAttribute(VoteAppConstants.ATTR_SUBMISSION_DEADLINE, submissionDeadline); + HttpSession ss = SessionManager.getSession(); + UserDTO learnerDto = (UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone learnerTimeZone = learnerDto.getTimeZone(); + Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, submissionDeadline); + Date currentLearnerDate = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, new Date()); + voteGeneralLearnerFlowDTO.setSubmissionDeadline(tzSubmissionDeadline); - if (learnerProgressUserId != null && mode.equals("teacher")) { - VoteQueUsr voteQueUsr = voteService.getVoteUserBySession(new Long(learnerProgressUserId), voteSession - .getUid()); + // calculate whether deadline has passed, and if so forward to "runOffline" + if (currentLearnerDate.after(tzSubmissionDeadline)) { + return mapping.findForward(RUN_OFFLINE); - if (voteQueUsr != null) { - - Long sessionUid = voteQueUsr.getVoteSessionId(); - - String toolContentId = voteLearningForm.getToolContentID(); - putMapQuestionsContentIntoRequest(request, voteService, voteQueUsr); - Set userAttempts = voteService.getAttemptsForUserAndSessionUseOpenAnswer(voteQueUsr.getUid(), - sessionUid); - request.setAttribute(VoteAppConstants.LIST_GENERAL_CHECKED_OPTIONS_CONTENT, userAttempts); - - } else { - request.setAttribute(VoteAppConstants.MAP_GENERAL_CHECKED_OPTIONS_CONTENT, new TreeMap( - new VoteComparator())); - request.setAttribute(VoteAppConstants.LIST_GENERAL_CHECKED_OPTIONS_CONTENT, new HashSet()); } - - //since this is progress view, present a screen which can not be edited - voteLearningForm.setReportViewOnly(new Boolean(true).toString()); - voteGeneralLearnerFlowDTO.setReportViewOnly(new Boolean(true).toString()); - voteGeneralLearnerFlowDTO.setLearningMode(mode); - putNotebookEntryIntoVoteGeneralLearnerFlowDTO(voteService, voteGeneralLearnerFlowDTO, toolSessionID, - learnerProgressUserId); - - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - MonitoringUtil.prepareChartData(request, voteService, null, voteContent.getVoteContentId().toString(), - voteSession.getUid().toString(), voteGeneralLearnerFlowDTO, voteGeneralMonitoringDTO, - getMessageService()); - - boolean isGroupedActivity = voteService.isGroupedActivity(new Long(voteLearningForm.getToolContentID())); - request.setAttribute("isGroupedActivity", isGroupedActivity); - - return mapping.findForward(VoteAppConstants.EXIT_PAGE); } - /* by now, we know that the mode is learner */ - putNotebookEntryIntoVoteGeneralLearnerFlowDTO(voteService, voteGeneralLearnerFlowDTO, toolSessionID, userID); - LearningWebUtil.putActivityPositionInRequestByToolSessionId(new Long(toolSessionID), request, getServlet() .getServletContext()); - + /* * find out if the content is set to run offline or online. If it is set to run offline , the learners are * informed about that. */ boolean isRunOffline = VoteUtils.isRunOffline(voteContent); if (isRunOffline == true) { VoteUtils.cleanUpSessionAbsolute(request); - //warning to learner: the activity is offline + // warning to learner: the activity is offline voteLearningForm.setActivityRunOffline(new Boolean(true).toString()); voteGeneralLearnerFlowDTO.setActivityRunOffline(new Boolean(true).toString()); @@ -374,29 +364,63 @@ VoteUtils.cleanUpSessionAbsolute(request); return mapping.findForward(VoteAppConstants.DEFINE_LATER); } + + //process group leader + VoteQueUsr groupLeader = null; + if (voteContent.isUseSelectLeaderToolOuput()) { + groupLeader = voteService.checkLeaderSelectToolForSessionLeader(user, new Long(toolSessionID)); + + // forwards to the leaderSelection page + if (groupLeader == null && !mode.equals(ToolAccessMode.TEACHER.toString())) { - // check if there is submission deadline - Date submissionDeadline = voteContent.getSubmissionDeadline(); - - if (submissionDeadline != null) { - - request.setAttribute(VoteAppConstants.ATTR_SUBMISSION_DEADLINE, submissionDeadline); - HttpSession ss = SessionManager.getSession(); - UserDTO learnerDto = (UserDTO) ss.getAttribute(AttributeNames.USER); - TimeZone learnerTimeZone = learnerDto.getTimeZone(); - Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, submissionDeadline); - Date currentLearnerDate = DateUtil.convertToTimeZoneFromDefault(learnerTimeZone, new Date()); - voteGeneralLearnerFlowDTO.setSubmissionDeadline(tzSubmissionDeadline); - - //calculate whether deadline has passed, and if so forward to "runOffline" - if (currentLearnerDate.after(tzSubmissionDeadline)) { - return mapping.findForward(RUN_OFFLINE); - - } - - } - + Set groupUsers = voteSession.getVoteQueUsers(); + request.setAttribute(ATTR_GROUP_USERS, groupUsers); + request.setAttribute(TOOL_SESSION_ID, toolSessionID); + request.setAttribute(ATTR_CONTENT, voteContent); + return mapping.findForward(WAIT_FOR_LEADER); + } + + // check if leader has submitted all answers + if (groupLeader.isResponseFinalised() && !mode.equals(ToolAccessMode.TEACHER.toString())) { + + // in case user joins the lesson after leader has answers some answers already - we need to make sure + // he has the same scratches as leader + voteService.copyAnswersFromLeader(user, groupLeader); + + user.setFinalScreenRequested(true); + user.setResponseFinalised(true); + voteService.updateVoteUser(user); + } + + // store group leader information + voteLearningForm.setGroupLeaderName(groupLeader.getFullname()); + boolean isUserLeader = voteService.isUserGroupLeader(user, new Long(toolSessionID)); + voteLearningForm.setIsUserLeader(isUserLeader); + } + + if (mode.equals("teacher")) { + + Long sessionUid = user.getVoteSessionId(); + putMapQuestionsContentIntoRequest(request, voteService, user); + Set userAttempts = voteService.getAttemptsForUserAndSessionUseOpenAnswer(user.getUid(), sessionUid); + request.setAttribute(VoteAppConstants.LIST_GENERAL_CHECKED_OPTIONS_CONTENT, userAttempts); + + // since this is progress view, present a screen which can not be edited + voteLearningForm.setReportViewOnly(new Boolean(true).toString()); + voteGeneralLearnerFlowDTO.setReportViewOnly(new Boolean(true).toString()); + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); + MonitoringUtil.prepareChartData(request, voteService, null, voteContent.getVoteContentId().toString(), + voteSession.getUid().toString(), voteGeneralLearnerFlowDTO, voteGeneralMonitoringDTO, + getMessageService()); + + boolean isGroupedActivity = voteService.isGroupedActivity(new Long(voteLearningForm.getToolContentID())); + request.setAttribute("isGroupedActivity", isGroupedActivity); + + return mapping.findForward(VoteAppConstants.EXIT_PAGE); + } + /* * fetch question content from content */ @@ -405,41 +429,27 @@ request.setAttribute(VoteAppConstants.MAP_OPTIONS_CONTENT, mapQuestionsContent); /* - * verify that userId does not already exist in the db. If it does exist, that means, that user already - * responded to the content and his answers must be displayed read-only - * - */ - VoteQueUsr voteQueUsr = voteService.getVoteUserBySession(new Long(userID), voteSession.getUid()); - if (voteQueUsr != null) { - Long queUsrId = voteQueUsr.getUid(); - } else { - //voteQueUsr is not available in the db - } - - String learningMode = voteLearningForm.getLearningMode(); - - /* * the user's session id AND user id exists in the tool tables goto this screen if the OverAll Results scren has * been already called up by this user */ - if (voteQueUsr != null && voteQueUsr.isFinalScreenRequested()) { - Long sessionUid = voteQueUsr.getVoteSessionId(); + if (user.isFinalScreenRequested()) { + Long sessionUid = user.getVoteSessionId(); VoteSession voteUserSession = voteService.getVoteSessionByUID(sessionUid); String userSessionId = voteUserSession.getVoteSessionId().toString(); if (toolSessionID.toString().equals(userSessionId)) { - //the learner has already responsed to this content, just generate a read-only report. Use redo questions for this - String toolContentId = voteLearningForm.getToolContentID(); - putMapQuestionsContentIntoRequest(request, voteService, voteQueUsr); + // the learner has already responsed to this content, just generate a read-only report. Use redo + // questions for this + putMapQuestionsContentIntoRequest(request, voteService, user); - boolean isResponseFinalised = voteQueUsr.isResponseFinalised(); + boolean isResponseFinalised = user.isResponseFinalised(); if (isResponseFinalised) { - //since the response is finalised present a screen which can not be edited + // since the response is finalised present a screen which can not be edited voteLearningForm.setReportViewOnly(new Boolean(true).toString()); voteGeneralLearnerFlowDTO.setReportViewOnly(new Boolean(true).toString()); } - Set userAttempts = voteService.getAttemptsForUserAndSessionUseOpenAnswer(voteQueUsr.getUid(), + Set userAttempts = voteService.getAttemptsForUserAndSessionUseOpenAnswer(user.getUid(), sessionUid); request.setAttribute(VoteAppConstants.LIST_GENERAL_CHECKED_OPTIONS_CONTENT, userAttempts); @@ -450,7 +460,7 @@ String isContentLockOnFinish = voteLearningForm.getLockOnFinish(); if (isContentLockOnFinish.equals(new Boolean(true).toString()) && isResponseFinalised == true) { - //user with session id: userSessionId should not redo votes. session is locked + // user with session id: userSessionId should not redo votes. session is locked return mapping.findForward(VoteAppConstants.EXIT_PAGE); } @@ -459,37 +469,26 @@ request.setAttribute(VoteAppConstants.VOTE_GENERAL_LEARNER_FLOW_DTO, voteGeneralLearnerFlowDTO); if (isContentLockOnFinish.equals(new Boolean(false).toString()) && isResponseFinalised == true) { - //isContentLockOnFinish is false, enable redo of votes + // isContentLockOnFinish is false, enable redo of votes return mapping.findForward(VoteAppConstants.REVISITED_ALL_NOMINATIONS); } return mapping.findForward(VoteAppConstants.ALL_NOMINATIONS); } } - //presenting standard learner screen.. + // presenting standard learner screen.. return mapping.findForward(VoteAppConstants.LOAD_LEARNER); } - private void putNotebookEntryIntoVoteGeneralLearnerFlowDTO(IVoteService voteService, - VoteGeneralLearnerFlowDTO voteGeneralLearnerFlowDTO, String toolSessionID, String userID) { - NotebookEntry notebookEntry = voteService.getEntry(new Long(toolSessionID), - CoreNotebookConstants.NOTEBOOK_TOOL, VoteAppConstants.MY_SIGNATURE, new Integer(userID)); - - if (notebookEntry != null) { - String notebookEntryPresentable = VoteUtils.replaceNewLines(notebookEntry.getEntry()); - voteGeneralLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); - } - } - /** * Build the attempts map and put it in the request, based on the supplied user. If the user is null then the map * will be set but it will be empty TODO This shouldn't go in the request, it should go in our special session map. */ private void putMapQuestionsContentIntoRequest(HttpServletRequest request, IVoteService voteService, - VoteQueUsr voteQueUsr) { + VoteQueUsr user) { List attempts = null; - if (voteQueUsr != null) { - attempts = voteService.getAttemptsForUser(voteQueUsr.getUid()); + if (user != null) { + attempts = voteService.getAttemptsForUser(user.getUid()); } Map localMapQuestionsContent = new TreeMap(new VoteComparator()); @@ -504,7 +503,7 @@ if (voteQueContent != null) { String entry = voteQueContent.getQuestion(); - String voteQueContentId = attempt.getVoteQueContentId().toString(); + String voteQueContentId = attempt.getVoteQueContent().getUid().toString(); if (entry != null) { if (entry.equals("sample nomination") && voteQueContentId.equals("1")) { localMapQuestionsContent.put(new Integer(order).toString(), attempt.getUserEntry()); @@ -554,7 +553,8 @@ voteLearningForm.setActivityInstructions(voteContent.getInstructions()); voteLearningForm.setActivityRunOffline(new Boolean(voteContent.isRunOffline()).toString()); voteLearningForm.setMaxNominationCount(voteContent.getMaxNominationCount()); - voteLearningForm.setMinNominationCount(voteContent.getMinNominationCount()); + voteLearningForm.setMinNominationCount(voteContent.getMinNominationCount()); + voteLearningForm.setUseSelectLeaderToolOuput(new Boolean(voteContent.isUseSelectLeaderToolOuput()).toString()); voteLearningForm.setAllowTextEntry(new Boolean(voteContent.isAllowText()).toString()); voteLearningForm.setShowResults(new Boolean(voteContent.isShowResults()).toString()); voteLearningForm.setLockOnFinish(new Boolean(voteContent.isLockOnFinish()).toString()); @@ -563,7 +563,9 @@ voteGeneralLearnerFlowDTO.setActivityInstructions(voteContent.getInstructions()); voteGeneralLearnerFlowDTO.setActivityRunOffline(new Boolean(voteContent.isRunOffline()).toString()); voteGeneralLearnerFlowDTO.setMaxNominationCount(voteContent.getMaxNominationCount()); - voteGeneralLearnerFlowDTO.setMinNominationCount(voteContent.getMinNominationCount()); + voteGeneralLearnerFlowDTO.setMinNominationCount(voteContent.getMinNominationCount()); + voteGeneralLearnerFlowDTO.setUseSelectLeaderToolOuput(new Boolean(voteContent.isUseSelectLeaderToolOuput()) + .toString()); voteGeneralLearnerFlowDTO.setAllowTextEntry(new Boolean(voteContent.isAllowText()).toString()); voteGeneralLearnerFlowDTO.setLockOnFinish(new Boolean(voteContent.isLockOnFinish()).toString()); voteGeneralLearnerFlowDTO.setActivityTitle(voteContent.getTitle()); @@ -646,7 +648,37 @@ errors.add(Globals.ERROR_KEY, new ActionMessage(message)); saveErrors(request, errors); } + + private VoteQueUsr getCurrentUser(String toolSessionId) { + // get back login user DTO + HttpSession ss = SessionManager.getSession(); + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + Long userId = new Long(toolUser.getUserID().longValue()); + + VoteSession session = voteService.retrieveVoteSession(new Long(toolSessionId)); + VoteQueUsr user = voteService.getVoteUserBySession(userId, session.getUid()); + if (user == null) { + String userName = toolUser.getLogin(); + String fullName = toolUser.getFirstName() + " " + toolUser.getLastName(); + + user = new VoteQueUsr(userId, userName, fullName, session, new TreeSet()); + voteService.createVoteQueUsr(user); + } + + return user; + } + + private VoteQueUsr getSpecifiedUser(String toolSessionId, Integer userId) { + VoteSession session = voteService.retrieveVoteSession(new Long(toolSessionId)); + VoteQueUsr user = voteService.getVoteUserBySession(new Long(userId.intValue()), session.getUid()); + if (user == null) { + logger.error("Unable to find specified user for Vote activity. Screens are likely to fail. SessionId=" + + new Long(toolSessionId) + " UserId=" + userId); + } + return user; + } + /** * Return ResourceService bean. */ Index: lams_tool_vote/web/WEB-INF/struts-config.xml =================================================================== diff -u -rded6335c9a04246994586bba62b43b577d2e6fb2 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision ded6335c9a04246994586bba62b43b577d2e6fb2) +++ lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -258,6 +258,12 @@ path="/VoteErrorBox.jsp" redirect="false" /> + + Index: lams_tool_vote/web/authoring/AdvancedContent.jsp =================================================================== diff -u -r0ae39cf15a61cdf0b820b699cc581ee81c76335e -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 0ae39cf15a61cdf0b820b699cc581ee81c76335e) +++ lams_tool_vote/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -1,24 +1,3 @@ -<%-- -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"%> @@ -29,6 +8,14 @@

+ + + +

+ +

- +

- + + + + + + @@ -79,6 +82,17 @@ + + + + + +

+ + ${formBean.groupLeaderName} + +

+

@@ -96,20 +110,16 @@ - - + + - - + + @@ -216,16 +226,14 @@

- +

- +

@@ -239,14 +247,14 @@ - + - + @@ -263,7 +271,7 @@ - + Index: lams_tool_vote/web/learning/AnswersContent.jsp =================================================================== diff -u -r57a242c8553eeec5781c2106493aa9f34efa5489 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 57a242c8553eeec5781c2106493aa9f34efa5489) +++ lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -37,6 +37,7 @@ <fmt:message key="activity.title" /> + - -

- +

- + + @@ -125,8 +155,18 @@ + + + + + +

+ + ${formBean.groupLeaderName} + +

+
-
@@ -168,23 +208,19 @@ + - - + +
- - - -
@@ -196,9 +232,9 @@
- - - + + +
Index: lams_tool_vote/web/learning/ExitLearning.jsp =================================================================== diff -u -r8aded0b18a5a7712622ae56f38923fa297449977 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/web/learning/ExitLearning.jsp (.../ExitLearning.jsp) (revision 8aded0b18a5a7712622ae56f38923fa297449977) +++ lams_tool_vote/web/learning/ExitLearning.jsp (.../ExitLearning.jsp) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -68,16 +68,19 @@ -
- + + + + + + @@ -90,6 +93,17 @@ + + + + + +

+ + ${formBean.groupLeaderName} + +

+
@@ -109,7 +123,7 @@
- + Index: lams_tool_vote/web/learning/IndividualLearnerResults.jsp =================================================================== diff -u -r8aded0b18a5a7712622ae56f38923fa297449977 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision 8aded0b18a5a7712622ae56f38923fa297449977) +++ lams_tool_vote/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -19,8 +19,7 @@ http://www.gnu.org/licenses/gpl.txt --%> - + <%@ include file="/common/taglibs.jsp"%> @@ -35,12 +34,10 @@ - <fmt:message key="activity.title" /> - + <fmt:message key="activity.title" /> + + + +
+

+ ${content.title} +

+ +

+ +

+ +
+ +
+ +
+ +
+ ${user.fullname} +
+
+
+ +
+ + + +
+ +
+ + + + + \ No newline at end of file Index: lams_tool_vote/web/learning/mobile/AllNominations.jsp =================================================================== diff -u -r6ce2602aa5f7692243cbbac9bdb2297b641ab250 -r96866054a8598fbe1b6719c40ea9a5ed898f5daf --- lams_tool_vote/web/learning/mobile/AllNominations.jsp (.../AllNominations.jsp) (revision 6ce2602aa5f7692243cbbac9bdb2297b641ab250) +++ lams_tool_vote/web/learning/mobile/AllNominations.jsp (.../AllNominations.jsp) (revision 96866054a8598fbe1b6719c40ea9a5ed898f5daf) @@ -72,8 +72,12 @@
- + + + + + + @@ -86,7 +90,18 @@ + + + + +

+ + ${formBean.groupLeaderName} + +

+
+

@@ -103,20 +118,16 @@ - - + + - - + + @@ -246,7 +257,7 @@ - +