Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/EditActivityDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/EditActivityDTO.java,v diff -u -r1.3 -r1.4 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/EditActivityDTO.java 20 Sep 2006 15:15:44 -0000 1.3 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/EditActivityDTO.java 19 Feb 2009 04:25:01 -0000 1.4 @@ -26,44 +26,42 @@ import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

DTO that holds question and user attempts data for jsp purposes + *

+ * DTO that holds question and user attempts data for jsp purposes *

* * @author Ozgur Demirtas */ -public class EditActivityDTO implements Comparable -{ +public class EditActivityDTO implements Comparable { private String monitoredContentInUse; - - + /** * @return Returns the monitoredContentInUse. */ public String getMonitoredContentInUse() { - return monitoredContentInUse; + return monitoredContentInUse; } + /** - * @param monitoredContentInUse The monitoredContentInUse to set. + * @param monitoredContentInUse + * The monitoredContentInUse to set. */ public void setMonitoredContentInUse(String monitoredContentInUse) { - this.monitoredContentInUse = monitoredContentInUse; + this.monitoredContentInUse = monitoredContentInUse; } - public String toString() { - return new ToStringBuilder(this) - .append("monitoredContentInUse", monitoredContentInUse) - .toString(); + + public String toString() { + return new ToStringBuilder(this).append("monitoredContentInUse", monitoredContentInUse).toString(); } - - public int compareTo(Object o) - { - EditActivityDTO editActivityDTO = (EditActivityDTO) o; - - if (editActivityDTO == null) - return 1; - else - return 0; + + public int compareTo(Object o) { + EditActivityDTO editActivityDTO = (EditActivityDTO) o; + + if (editActivityDTO == null) + return 1; + else + return 0; } - + } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/GeneralLearnerFlowDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/GeneralLearnerFlowDTO.java,v diff -u -r1.16 -r1.17 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/GeneralLearnerFlowDTO.java 15 Nov 2006 00:38:13 -0000 1.16 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/GeneralLearnerFlowDTO.java 19 Feb 2009 04:25:01 -0000 1.17 @@ -28,601 +28,684 @@ 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 GeneralLearnerFlowDTO implements Comparable -{ +public class GeneralLearnerFlowDTO implements Comparable { protected String activityOffline; - + protected Integer totalQuestionCount; - + protected String activityInstructions; - + protected String activityTitle; - + protected String countSessionComplete; - + protected String userName; - + protected String toolSessionID; - + protected String httpSessionID; - + protected String toolContentID; - + protected Integer currentQuestionIndex; - + protected String questionListingMode; - + protected String currentAnswer; - + protected String remainingQuestionCount; - + protected String teacherViewOnly; - + protected String notebookEntriesVisible; - + protected String reflection; - + protected String reflectionSubject; - + protected String notebookEntry; - + protected String reportTitleLearner; - + protected String endLearningMessage; - + protected String userNameVisible; - + protected String showOtherAnswers; - - protected String requestLearningReport; - protected String requestLearningReportProgress; - - protected String requestLearningReportViewOnly; + protected String requestLearningReport; + protected String requestLearningReportProgress; + + protected String requestLearningReportViewOnly; + protected Map mapAnswers; - + protected Map mapAnswersPresentable; - + protected Map mapQuestions; - + protected Map mapFeedback; - + protected Map mapQuestionContentLearner; - + protected List listMonitoredAnswersContainerDTO; - + protected String currentMonitoredToolSession; - + protected String initialScreen; - + protected String lockWhenFinished; - + protected String userUid; - + protected String existMultipleUserResponses; - + protected String usernameVisible; - - + /** * @return Returns the usernameVisible. */ public String getUsernameVisible() { - return usernameVisible; + return usernameVisible; } + /** - * @param usernameVisible The usernameVisible to set. + * @param usernameVisible + * The usernameVisible to set. */ public void setUsernameVisible(String usernameVisible) { - this.usernameVisible = usernameVisible; + this.usernameVisible = usernameVisible; } + /** * @return Returns the currentMonitoredToolSession. */ public String getCurrentMonitoredToolSession() { - return currentMonitoredToolSession; + return currentMonitoredToolSession; } + /** - * @param currentMonitoredToolSession The currentMonitoredToolSession to set. + * @param currentMonitoredToolSession + * The currentMonitoredToolSession to set. */ - public void setCurrentMonitoredToolSession( - String currentMonitoredToolSession) { - this.currentMonitoredToolSession = currentMonitoredToolSession; + public void setCurrentMonitoredToolSession(String currentMonitoredToolSession) { + this.currentMonitoredToolSession = currentMonitoredToolSession; } + /** * @return Returns the currentAnswer. */ public String getCurrentAnswer() { - return currentAnswer; + return currentAnswer; } + /** - * @param currentAnswer The currentAnswer to set. + * @param currentAnswer + * The currentAnswer to set. */ public void setCurrentAnswer(String currentAnswer) { - this.currentAnswer = currentAnswer; + this.currentAnswer = currentAnswer; } + protected String userFeedback; - - - + /** * @return Returns the mapQuestionContentLearner. */ public Map getMapQuestionContentLearner() { - return mapQuestionContentLearner; + return mapQuestionContentLearner; } + /** - * @param mapQuestionContentLearner The mapQuestionContentLearner to set. + * @param mapQuestionContentLearner + * The mapQuestionContentLearner to set. */ public void setMapQuestionContentLearner(Map mapQuestionContentLearner) { - this.mapQuestionContentLearner = mapQuestionContentLearner; + this.mapQuestionContentLearner = mapQuestionContentLearner; } + /** * @return Returns the userFeedback. */ public String getUserFeedback() { - return userFeedback; + return userFeedback; } + /** - * @param userFeedback The userFeedback to set. + * @param userFeedback + * The userFeedback to set. */ public void setUserFeedback(String userFeedback) { - this.userFeedback = userFeedback; + this.userFeedback = userFeedback; } + /** * @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 activityOffline. */ public String getActivityOffline() { - return activityOffline; + return activityOffline; } + /** - * @param activityOffline The activityOffline to set. + * @param activityOffline + * The activityOffline to set. */ public void setActivityOffline(String activityOffline) { - this.activityOffline = activityOffline; + this.activityOffline = activityOffline; } + /** * @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 countSessionComplete. */ public String getCountSessionComplete() { - return countSessionComplete; + return countSessionComplete; } + /** - * @param countSessionComplete The countSessionComplete to set. + * @param countSessionComplete + * The countSessionComplete to set. */ public void setCountSessionComplete(String countSessionComplete) { - this.countSessionComplete = countSessionComplete; + this.countSessionComplete = countSessionComplete; } /** * @return Returns the questionListingMode. */ public String getQuestionListingMode() { - return questionListingMode; + return questionListingMode; } + /** - * @param questionListingMode The questionListingMode to set. + * @param questionListingMode + * The questionListingMode to set. */ public void setQuestionListingMode(String questionListingMode) { - this.questionListingMode = questionListingMode; + this.questionListingMode = questionListingMode; } - - public int compareTo(Object o) - { - GeneralLearnerFlowDTO gneralLearnerFlowDTO = (GeneralLearnerFlowDTO) o; - - if (gneralLearnerFlowDTO == null) - return 1; - else - return 0; + + public int compareTo(Object o) { + GeneralLearnerFlowDTO gneralLearnerFlowDTO = (GeneralLearnerFlowDTO) o; + + if (gneralLearnerFlowDTO == null) + return 1; + else + return 0; } - - public String toString() { - return new ToStringBuilder(this) - .append("activityOffline: ", activityOffline) - .append("remainingQuestionCount: ", remainingQuestionCount) - .append("totalQuestionCount : ", totalQuestionCount) - .append("activityInstructions: ", activityInstructions) - .append("teacherViewOnly: ", teacherViewOnly) - .append("lockWhenFinished: ", lockWhenFinished) - .append("activityTitle: ", activityTitle) - .append("countSessionComplete: ", countSessionComplete) - .append("toolSessionID: ", toolSessionID) - .append("currentQuestionIndex: ", currentQuestionIndex) - .append("questionListingMode: ", questionListingMode) - .append("reportTitleLearner: ", reportTitleLearner) - .append("userNameVisible: ", userNameVisible) - .append("requestLearningReport: ", requestLearningReport) - .append("requestLearningReportProgress: ", requestLearningReportProgress) - .append("requestLearningReportViewOnly: ", requestLearningReportViewOnly) - .append("mapAnswers: ", mapAnswers) - .append("mapQuestions: ", mapQuestions) - .append("mapQuestionContentLearner: ", mapQuestionContentLearner) - .append("listMonitoredAnswersContainerDTO: ", listMonitoredAnswersContainerDTO) - .append("currentMonitoredToolSession: ", currentMonitoredToolSession) - .append("mapFeedback: ", mapFeedback) - .toString(); + public String toString() { + return new ToStringBuilder(this).append("activityOffline: ", activityOffline).append( + "remainingQuestionCount: ", remainingQuestionCount).append("totalQuestionCount : ", totalQuestionCount) + .append("activityInstructions: ", activityInstructions).append("teacherViewOnly: ", teacherViewOnly) + .append("lockWhenFinished: ", lockWhenFinished).append("activityTitle: ", activityTitle).append( + "countSessionComplete: ", countSessionComplete).append("toolSessionID: ", toolSessionID) + .append("currentQuestionIndex: ", currentQuestionIndex).append("questionListingMode: ", + questionListingMode).append("reportTitleLearner: ", reportTitleLearner).append( + "userNameVisible: ", userNameVisible).append("requestLearningReport: ", requestLearningReport) + .append("requestLearningReportProgress: ", requestLearningReportProgress).append( + "requestLearningReportViewOnly: ", requestLearningReportViewOnly).append("mapAnswers: ", + mapAnswers).append("mapQuestions: ", mapQuestions).append("mapQuestionContentLearner: ", + mapQuestionContentLearner).append("listMonitoredAnswersContainerDTO: ", + listMonitoredAnswersContainerDTO).append("currentMonitoredToolSession: ", + currentMonitoredToolSession).append("mapFeedback: ", mapFeedback).toString(); } - /** - * @param currentQuestionIndex The currentQuestionIndex to set. + * @param currentQuestionIndex + * The currentQuestionIndex to set. */ public void setCurrentQuestionIndex(Integer currentQuestionIndex) { - this.currentQuestionIndex = currentQuestionIndex; + this.currentQuestionIndex = currentQuestionIndex; } + /** - * @param totalQuestionCount The totalQuestionCount to set. + * @param totalQuestionCount + * The totalQuestionCount to set. */ public void setTotalQuestionCount(Integer totalQuestionCount) { - this.totalQuestionCount = totalQuestionCount; + this.totalQuestionCount = totalQuestionCount; } + /** * @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 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 currentQuestionIndex. */ public Integer getCurrentQuestionIndex() { - return currentQuestionIndex; + return currentQuestionIndex; } + /** * @return Returns the totalQuestionCount. */ public Integer getTotalQuestionCount() { - return totalQuestionCount; + return totalQuestionCount; } + /** * @return Returns the endLearningMessage. */ public String getEndLearningMessage() { - return endLearningMessage; + return endLearningMessage; } + /** - * @param endLearningMessage The endLearningMessage to set. + * @param endLearningMessage + * The endLearningMessage to set. */ public void setEndLearningMessage(String endLearningMessage) { - this.endLearningMessage = endLearningMessage; + this.endLearningMessage = endLearningMessage; } + /** * @return Returns the reportTitleLearner. */ public String getReportTitleLearner() { - return reportTitleLearner; + return reportTitleLearner; } + /** - * @param reportTitleLearner The reportTitleLearner to set. + * @param reportTitleLearner + * The reportTitleLearner to set. */ public void setReportTitleLearner(String reportTitleLearner) { - this.reportTitleLearner = reportTitleLearner; + this.reportTitleLearner = reportTitleLearner; } + /** * @return Returns the userNameVisible. */ public String getUserNameVisible() { - return userNameVisible; + return userNameVisible; } + /** - * @param userNameVisible The userNameVisible to set. + * @param userNameVisible + * The userNameVisible to set. */ public void setUserNameVisible(String userNameVisible) { - this.userNameVisible = userNameVisible; + this.userNameVisible = userNameVisible; } + /** * @return Returns the mapAnswers. */ public Map getMapAnswers() { - return mapAnswers; + return mapAnswers; } + /** - * @param mapAnswers The mapAnswers to set. + * @param mapAnswers + * The mapAnswers to set. */ public void setMapAnswers(Map mapAnswers) { - this.mapAnswers = mapAnswers; + this.mapAnswers = mapAnswers; } + /** * @return Returns the mapQuestions. */ public Map getMapQuestions() { - return mapQuestions; + return mapQuestions; } + /** - * @param mapQuestions The mapQuestions to set. + * @param mapQuestions + * The mapQuestions to set. */ public void setMapQuestions(Map mapQuestions) { - this.mapQuestions = mapQuestions; + this.mapQuestions = mapQuestions; } - + /** * @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 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 requestLearningReportViewOnly. */ public String getRequestLearningReportViewOnly() { - return requestLearningReportViewOnly; + return requestLearningReportViewOnly; } + /** - * @param requestLearningReportViewOnly The requestLearningReportViewOnly to set. + * @param requestLearningReportViewOnly + * The requestLearningReportViewOnly to set. */ - public void setRequestLearningReportViewOnly( - String requestLearningReportViewOnly) { - this.requestLearningReportViewOnly = requestLearningReportViewOnly; + public void setRequestLearningReportViewOnly(String requestLearningReportViewOnly) { + this.requestLearningReportViewOnly = requestLearningReportViewOnly; } /** * @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 mapAnswersPresentable. */ public Map getMapAnswersPresentable() { - return mapAnswersPresentable; + return mapAnswersPresentable; } + /** - * @param mapAnswersPresentable The mapAnswersPresentable to set. + * @param mapAnswersPresentable + * The mapAnswersPresentable to set. */ public void setMapAnswersPresentable(Map mapAnswersPresentable) { - this.mapAnswersPresentable = mapAnswersPresentable; + this.mapAnswersPresentable = mapAnswersPresentable; } + /** * @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 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 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 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; } + /** * @return Returns the mapFeedback. */ public Map getMapFeedback() { - return mapFeedback; + return mapFeedback; } + /** - * @param mapFeedback The mapFeedback to set. + * @param mapFeedback + * The mapFeedback to set. */ public void setMapFeedback(Map mapFeedback) { - this.mapFeedback = mapFeedback; + this.mapFeedback = mapFeedback; } + /** * @return Returns the teacherViewOnly. */ public String getTeacherViewOnly() { - return teacherViewOnly; + return teacherViewOnly; } + /** - * @param teacherViewOnly The teacherViewOnly to set. + * @param teacherViewOnly + * The teacherViewOnly to set. */ public void setTeacherViewOnly(String teacherViewOnly) { - this.teacherViewOnly = teacherViewOnly; + this.teacherViewOnly = teacherViewOnly; } + /** * @return Returns the remainingQuestionCount. */ public String getRemainingQuestionCount() { - return remainingQuestionCount; + return remainingQuestionCount; } + /** - * @param remainingQuestionCount The remainingQuestionCount to set. + * @param remainingQuestionCount + * The remainingQuestionCount to set. */ public void setRemainingQuestionCount(String remainingQuestionCount) { - this.remainingQuestionCount = remainingQuestionCount; + this.remainingQuestionCount = remainingQuestionCount; } + /** * @return Returns the initialScreen. */ public String getInitialScreen() { - return initialScreen; + return initialScreen; } + /** - * @param initialScreen The initialScreen to set. + * @param initialScreen + * The initialScreen to set. */ public void setInitialScreen(String initialScreen) { - this.initialScreen = initialScreen; + this.initialScreen = initialScreen; } /** * @return Returns the lockWhenFinished. */ public String getLockWhenFinished() { - return lockWhenFinished; + return lockWhenFinished; } + /** - * @param lockWhenFinished The lockWhenFinished to set. + * @param lockWhenFinished + * The lockWhenFinished to set. */ public void setLockWhenFinished(String lockWhenFinished) { - this.lockWhenFinished = lockWhenFinished; + this.lockWhenFinished = lockWhenFinished; } + /** * @return Returns the showOtherAnswers. */ public String getShowOtherAnswers() { - return showOtherAnswers; + return showOtherAnswers; } + /** - * @param showOtherAnswers The showOtherAnswers to set. + * @param showOtherAnswers + * The showOtherAnswers to set. */ public void setShowOtherAnswers(String showOtherAnswers) { - this.showOtherAnswers = showOtherAnswers; + this.showOtherAnswers = showOtherAnswers; } + /** * @return Returns the userUid. */ public String getUserUid() { - return userUid; + return userUid; } + /** - * @param userUid The userUid to set. + * @param userUid + * The userUid to set. */ public void setUserUid(String userUid) { - this.userUid = userUid; + this.userUid = userUid; } + /** * @return Returns the existMultipleUserResponses. */ public String getExistMultipleUserResponses() { - return existMultipleUserResponses; + return existMultipleUserResponses; } + /** - * @param existMultipleUserResponses The existMultipleUserResponses to set. + * @param existMultipleUserResponses + * The existMultipleUserResponses to set. */ public void setExistMultipleUserResponses(String existMultipleUserResponses) { - this.existMultipleUserResponses = existMultipleUserResponses; + this.existMultipleUserResponses = existMultipleUserResponses; } - } +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Nullable.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Nullable.java,v diff -u -r1.6 -r1.7 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Nullable.java 20 Sep 2006 15:15:44 -0000 1.6 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Nullable.java 19 Feb 2009 04:25:01 -0000 1.7 @@ -24,19 +24,18 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; - /** - * Null Object pattern. This interface is defined to avoid the use of NULL. - * The domain object that allows NULL as return value should implement this + * Null Object pattern. This interface is defined to avoid the use of NULL. The + * domain object that allows NULL as return value should implement this * interface. * * @author Ozgur Demirtas * */ -public interface Nullable -{ +public interface Nullable { /** * contract to indicate whether current object is null. + * * @return */ public boolean isNull(); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAllGroupsDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaAllGroupsDTO.java,v diff -u -r1.1 -r1.2 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAllGroupsDTO.java 23 Sep 2006 15:11:03 -0000 1.1 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAllGroupsDTO.java 19 Feb 2009 04:25:01 -0000 1.2 @@ -28,77 +28,77 @@ import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

DTO that holds question and user attempts data for jsp purposes + *

+ * DTO that holds question and user attempts data for jsp purposes *

* * @author Ozgur Demirtas */ -public class QaAllGroupsDTO implements Comparable -{ +public class QaAllGroupsDTO implements Comparable { private String sessionId; - + private String sessionName; - - private List groupData; - - - - public String toString() { - return new ToStringBuilder(this) - .append("sessionId:", sessionId) - .append("sessionName:", sessionName) - .append("groupData: ", groupData) - .toString(); + + private List groupData; + + public String toString() { + return new ToStringBuilder(this).append("sessionId:", sessionId).append("sessionName:", sessionName).append( + "groupData: ", groupData).toString(); } - - public int compareTo(Object o) - { - QaAllGroupsDTO qaAllGroupsDTO = (QaAllGroupsDTO) o; - - if (qaAllGroupsDTO == null) - return 1; - else - return 0; + + public int compareTo(Object o) { + QaAllGroupsDTO qaAllGroupsDTO = (QaAllGroupsDTO) o; + + if (qaAllGroupsDTO == null) + return 1; + else + return 0; } - /** * @return Returns the groupData. */ public List getGroupData() { - return groupData; + return groupData; } + /** - * @param groupData The groupData to set. + * @param groupData + * The groupData to set. */ public void setGroupData(List groupData) { - this.groupData = groupData; + this.groupData = groupData; } + /** * @return Returns the sessionName. */ public String getSessionName() { - return sessionName; + return sessionName; } + /** - * @param sessionName The sessionName to set. + * @param sessionName + * The sessionName to set. */ public void setSessionName(String sessionName) { - this.sessionName = sessionName; + this.sessionName = sessionName; } + /** * @return Returns the sessionId. */ public String getSessionId() { - return sessionId; + return sessionId; } + /** - * @param sessionId The sessionId to set. + * @param sessionId + * The sessionId to set. */ public void setSessionId(String sessionId) { - this.sessionId = sessionId; + this.sessionId = sessionId; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaApplicationException.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaApplicationException.java,v diff -u -r1.6 -r1.7 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaApplicationException.java 20 Sep 2006 15:15:44 -0000 1.6 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaApplicationException.java 19 Feb 2009 04:25:01 -0000 1.7 @@ -24,52 +24,51 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; - /** - *

This exception wraps all basic exception occured in the q/a tool. It is - * not suppose to be try and catched in any level. The struts should be taking - * care of handling this exception.

+ *

+ * This exception wraps all basic exception occured in the q/a tool. It is not + * suppose to be try and catched in any level. The struts should be taking care + * of handling this exception. + *

* -* @author Ozgur Demirtas + * @author Ozgur Demirtas * */ -public class QaApplicationException extends RuntimeException -{ +public class QaApplicationException extends RuntimeException { /** * Default Constructor */ - public QaApplicationException() - { - super(); + public QaApplicationException() { + super(); } /** * Constructor for customized error message + * * @param message */ - public QaApplicationException(String message) - { - super(message); + public QaApplicationException(String message) { + super(message); } /** * Constructor for wrapping the throwable object + * * @param cause */ - public QaApplicationException(Throwable cause) - { - super(cause); + public QaApplicationException(Throwable cause) { + super(cause); } /** - * Constructor for wrapping both the customized error message and - * throwable exception object. + * Constructor for wrapping both the customized error message and throwable + * exception object. + * * @param message * @param cause */ - public QaApplicationException(String message, Throwable cause) - { - super(message, cause); + public QaApplicationException(String message, Throwable cause) { + super(message, cause); } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaComparator.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaComparator.java,v diff -u -r1.6 -r1.7 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaComparator.java 20 Sep 2006 15:15:44 -0000 1.6 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaComparator.java 19 Feb 2009 04:25:01 -0000 1.7 @@ -31,30 +31,30 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ /** - * A comparator implementation that can be used as a constructor to collections. - * The TreeMap in the web layer makes use of it. + * A comparator implementation that can be used as a constructor to collections. + * The TreeMap in the web layer makes use of it. * */ public class QaComparator implements Comparator, Serializable { - static Logger logger = Logger.getLogger(QaComparator.class.getName()); - - public int compare(Object o1, Object o2) { - String s1 = (String)o1; - String s2 = (String)o2; - - int key1=new Long(s1).intValue(); - int key2=new Long(s2).intValue(); - return key1 - key2; - } + static Logger logger = Logger.getLogger(QaComparator.class.getName()); - public boolean equals(Object o) { - String s = (String)o; - return compare(this, o)==0; - } + public int compare(Object o1, Object o2) { + String s1 = (String) o1; + String s2 = (String) o2; + + int key1 = new Long(s1).intValue(); + int key2 = new Long(s2).intValue(); + return key1 - key2; + } + + public boolean equals(Object o) { + String s = (String) o; + return compare(this, o) == 0; + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java,v diff -u -r1.6 -r1.7 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java 9 Dec 2008 05:38:14 -0000 1.6 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java 19 Feb 2009 04:25:01 -0000 1.7 @@ -40,15 +40,16 @@ import org.lamsfoundation.lams.util.WebUtil; /** - * A text search condition with a set of questions on answers to which the search should be performed. + * A text search condition with a set of questions on answers to which the + * search should be performed. * * @author Marcin Cieslak * */ public class QaCondition extends TextSearchCondition { /** - * Questions linked to this condition. Answers to them will be scanned for the words that make the condition's - * parameters. + * Questions linked to this condition. Answers to them will be scanned for + * the words that make the condition's parameters. */ private Set questions = new TreeSet(new QaQueContentComparator()); private static Logger log = Logger.getLogger(QaCondition.class); @@ -123,9 +124,10 @@ } /** - * Notice that questions are copied with very little information and then they are assigned to the cloned object. - * This method is used when assigning BranchActivityEntry needs, so only basic information (in fact, only order ID) - * is needed. Also, there should be no link to Q&A content. + * Notice that questions are copied with very little information and then + * they are assigned to the cloned object. This method is used when + * assigning BranchActivityEntry needs, so only basic information (in fact, + * only order ID) is needed. Also, there should be no link to Q&A content. */ @Override public QaCondition clone(int uiidOffset) { @@ -142,8 +144,9 @@ } /** - * Notice that questions from the cloned (and not the original) tool content are assigned to the cloned condition. - * This method is used for cloning tool content. + * Notice that questions from the cloned (and not the original) tool content + * are assigned to the cloned condition. This method is used for cloning + * tool content. */ public QaCondition clone(QaContent qaContent) { Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaContent.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaContent.java,v diff -u -r1.20 -r1.21 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaContent.java 21 Oct 2008 02:25:35 -0000 1.20 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaContent.java 19 Feb 2009 04:25:01 -0000 1.21 @@ -42,15 +42,17 @@ /** * @author Ozgur Demirtas * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code - * Templates + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ /** - * QaContent Value Object The value object that maps to our model database table: tl_laqa11_content The relevant - * hibernate mapping resides in: QaContent.hbm.xml + * QaContent Value Object The value object that maps to our model database + * table: tl_laqa11_content The relevant hibernate mapping resides in: + * QaContent.hbm.xml * - * Holds content representation for the tool. Default content is made available to the tool by the database. + * Holds content representation for the tool. Default content is made available + * to the tool by the database. */ public class QaContent implements Serializable { static Logger logger = Logger.getLogger(QaContent.class.getName()); @@ -166,8 +168,9 @@ } /** - * Copy Construtor to create a new qa content instance. Note that we don't copy the qa session data here because the - * qa session will be created after we copied tool content. + * Copy Construtor to create a new qa content instance. Note that we don't + * copy the qa session data here because the qa session will be created + * after we copied tool content. * * @param qa * the original qa content. Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaGeneralAuthoringDTO.java,v diff -u -r1.5 -r1.6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java 13 Nov 2006 19:38:45 -0000 1.5 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java 19 Feb 2009 04:25:01 -0000 1.6 @@ -29,16 +29,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 QaGeneralAuthoringDTO implements Comparable -{ +public class QaGeneralAuthoringDTO implements Comparable { protected String toolContentID; protected String currentTab; protected String activeModule; @@ -48,7 +46,7 @@ protected String targetMode; protected String defaultQuestionContent; protected String defaultContentIdStr; - + protected String activityTitle; protected String activityInstructions; protected String onlineInstructions; @@ -61,7 +59,7 @@ protected String lockWhenFinished; protected String editActivityEditMode; protected String reflectionSubject; - + protected String monitoredContentInUse; protected String httpSessionID; @@ -71,474 +69,535 @@ protected List attachmentList; protected List deletedAttachmentList; - + protected String sbmtSuccess; protected String userExceptionQuestionsDuplicate; - + protected String contentFolderID; protected String editableQuestionText; protected String editableQuestionFeedback; - - - public String toString() { - return new ToStringBuilder(this) - .append("toolContentID: ", toolContentID) - .append("contentFolderID: ", contentFolderID) - .append("httpSessionID: ", httpSessionID) - .append("currentTab: ", currentTab) - .append("activeModule: ", activeModule) - .append("defineLaterInEditMode: ", defineLaterInEditMode) - .append("showAuthoringTabs: ", showAuthoringTabs) - .append("monitoringOriginatedDefineLater: ", monitoringOriginatedDefineLater) - .append("targetMode: ", targetMode) - .append("defaultQuestionContent: ", defaultQuestionContent) - .append("defaultContentIdStr: ", defaultContentIdStr) - .append("activityTitle: ", activityTitle) - .append("activityInstructions: ", activityInstructions) - .append("reflect: ", reflect) - .append("onlineInstructions: ", onlineInstructions) - .append("offlineInstructions: ", offlineInstructions) - .append("usernameVisible: ", usernameVisible) - .append("showOtherAnswers: ", showOtherAnswers) - .append("synchInMonitor: ", synchInMonitor) - .append("questionsSequenced: ", questionsSequenced) - .append("lockWhenFinished: ", lockWhenFinished) - .append("editActivityEditMode: ", editActivityEditMode) - .append("reflectionSubject: ", reflectionSubject) - .append("requestedModule: ", requestedModule) - .append("isDefineLater: ", isDefineLater) - .append("monitoredContentInUse: ", monitoredContentInUse) - .append("mapQuestionContent: ", mapQuestionContent) - .append("attachmentList: ", attachmentList) - .append("deletedAttachmentList: ", deletedAttachmentList) - .append("sbmtSuccess: ", sbmtSuccess) - .append("userExceptionQuestionsDuplicate: ", userExceptionQuestionsDuplicate) - .toString(); + public String toString() { + return new ToStringBuilder(this).append("toolContentID: ", toolContentID).append("contentFolderID: ", + contentFolderID).append("httpSessionID: ", httpSessionID).append("currentTab: ", currentTab).append( + "activeModule: ", activeModule).append("defineLaterInEditMode: ", defineLaterInEditMode).append( + "showAuthoringTabs: ", showAuthoringTabs).append("monitoringOriginatedDefineLater: ", + monitoringOriginatedDefineLater).append("targetMode: ", targetMode).append("defaultQuestionContent: ", + defaultQuestionContent).append("defaultContentIdStr: ", defaultContentIdStr).append("activityTitle: ", + activityTitle).append("activityInstructions: ", activityInstructions).append("reflect: ", reflect) + .append("onlineInstructions: ", onlineInstructions) + .append("offlineInstructions: ", offlineInstructions).append("usernameVisible: ", usernameVisible) + .append("showOtherAnswers: ", showOtherAnswers).append("synchInMonitor: ", synchInMonitor).append( + "questionsSequenced: ", questionsSequenced).append("lockWhenFinished: ", lockWhenFinished) + .append("editActivityEditMode: ", editActivityEditMode) + .append("reflectionSubject: ", reflectionSubject).append("requestedModule: ", requestedModule).append( + "isDefineLater: ", isDefineLater).append("monitoredContentInUse: ", monitoredContentInUse) + .append("mapQuestionContent: ", mapQuestionContent).append("attachmentList: ", attachmentList).append( + "deletedAttachmentList: ", deletedAttachmentList).append("sbmtSuccess: ", sbmtSuccess).append( + "userExceptionQuestionsDuplicate: ", userExceptionQuestionsDuplicate).toString(); } - - - + /** * @return Returns the userExceptionQuestionsDuplicate. */ public String getUserExceptionQuestionsDuplicate() { - return userExceptionQuestionsDuplicate; + return userExceptionQuestionsDuplicate; } + /** - * @param userExceptionQuestionsDuplicate The userExceptionQuestionsDuplicate to set. + * @param userExceptionQuestionsDuplicate + * The userExceptionQuestionsDuplicate to set. */ - public void setUserExceptionQuestionsDuplicate( - String userExceptionQuestionsDuplicate) { - this.userExceptionQuestionsDuplicate = userExceptionQuestionsDuplicate; + public void setUserExceptionQuestionsDuplicate(String userExceptionQuestionsDuplicate) { + this.userExceptionQuestionsDuplicate = userExceptionQuestionsDuplicate; } + /** * @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 monitoredContentInUse. */ public String getMonitoredContentInUse() { - return monitoredContentInUse; + return monitoredContentInUse; } + /** - * @param monitoredContentInUse The monitoredContentInUse to set. + * @param monitoredContentInUse + * The monitoredContentInUse to set. */ public void setMonitoredContentInUse(String monitoredContentInUse) { - this.monitoredContentInUse = monitoredContentInUse; + this.monitoredContentInUse = monitoredContentInUse; } + /** * @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 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 mapQuestionContent. */ public Map getMapQuestionContent() { - return mapQuestionContent; + return mapQuestionContent; } + /** - * @param mapQuestionContent The mapQuestionContent to set. + * @param mapQuestionContent + * The mapQuestionContent to set. */ public void setMapQuestionContent(Map mapQuestionContent) { - this.mapQuestionContent = mapQuestionContent; + this.mapQuestionContent = mapQuestionContent; } + /** * @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 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 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 targetMode. */ public String getTargetMode() { - return targetMode; + return targetMode; } + /** - * @param targetMode The targetMode to set. + * @param targetMode + * The targetMode to set. */ public void setTargetMode(String targetMode) { - this.targetMode = targetMode; + this.targetMode = targetMode; } - + /** * @return Returns the monitoringOriginatedDefineLater. */ public String getMonitoringOriginatedDefineLater() { - return monitoringOriginatedDefineLater; + return monitoringOriginatedDefineLater; } + /** - * @param monitoringOriginatedDefineLater The monitoringOriginatedDefineLater to set. + * @param monitoringOriginatedDefineLater + * The monitoringOriginatedDefineLater to set. */ - public void setMonitoringOriginatedDefineLater( - String monitoringOriginatedDefineLater) { - this.monitoringOriginatedDefineLater = monitoringOriginatedDefineLater; + public void setMonitoringOriginatedDefineLater(String monitoringOriginatedDefineLater) { + this.monitoringOriginatedDefineLater = monitoringOriginatedDefineLater; } - /** * @return Returns the activeModule. */ public String getActiveModule() { - return activeModule; + return activeModule; } + /** - * @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 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 showAuthoringTabs. */ public String getShowAuthoringTabs() { - return showAuthoringTabs; + return showAuthoringTabs; } + /** - * @param showAuthoringTabs The showAuthoringTabs to set. + * @param showAuthoringTabs + * The showAuthoringTabs to set. */ public void setShowAuthoringTabs(String showAuthoringTabs) { - this.showAuthoringTabs = showAuthoringTabs; + this.showAuthoringTabs = showAuthoringTabs; } - - public int compareTo(Object o) - { - QaGeneralAuthoringDTO qaGeneralAuthoringDTO = (QaGeneralAuthoringDTO) o; - - if (qaGeneralAuthoringDTO == null) - return 1; - else - return 0; + + public int compareTo(Object o) { + QaGeneralAuthoringDTO qaGeneralAuthoringDTO = (QaGeneralAuthoringDTO) o; + + if (qaGeneralAuthoringDTO == null) + return 1; + else + return 0; } /** * @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 defaultQuestionContent. */ public String getDefaultQuestionContent() { - return defaultQuestionContent; + return defaultQuestionContent; } + /** - * @param defaultQuestionContent The defaultQuestionContent to set. + * @param defaultQuestionContent + * The defaultQuestionContent to set. */ public void setDefaultQuestionContent(String defaultQuestionContent) { - this.defaultQuestionContent = defaultQuestionContent; + this.defaultQuestionContent = defaultQuestionContent; } + /** * @return Returns the requestedModule. */ public String getRequestedModule() { - return requestedModule; + return requestedModule; } + /** - * @param requestedModule The requestedModule to set. + * @param requestedModule + * The requestedModule to set. */ public void setRequestedModule(String requestedModule) { - this.requestedModule = requestedModule; + this.requestedModule = requestedModule; } + /** * @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 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 questionsSequenced. */ public String getQuestionsSequenced() { - return questionsSequenced; + return questionsSequenced; } + /** - * @param questionsSequenced The questionsSequenced to set. + * @param questionsSequenced + * The questionsSequenced to set. */ public void setQuestionsSequenced(String questionsSequenced) { - this.questionsSequenced = questionsSequenced; + this.questionsSequenced = questionsSequenced; } - + /** * @return Returns the synchInMonitor. */ public String getSynchInMonitor() { - return synchInMonitor; + return synchInMonitor; } + /** - * @param synchInMonitor The synchInMonitor to set. + * @param synchInMonitor + * The synchInMonitor to set. */ public void setSynchInMonitor(String synchInMonitor) { - this.synchInMonitor = synchInMonitor; + this.synchInMonitor = synchInMonitor; } + /** * @return Returns the usernameVisible. */ public String getUsernameVisible() { - return usernameVisible; + return usernameVisible; } + /** - * @param usernameVisible The usernameVisible to set. + * @param usernameVisible + * The usernameVisible to set. */ public void setUsernameVisible(String usernameVisible) { - this.usernameVisible = usernameVisible; + this.usernameVisible = usernameVisible; } + /** * @return Returns the currentTab. */ public String getCurrentTab() { - return currentTab; + return currentTab; } + /** - * @param currentTab The currentTab to set. + * @param currentTab + * The currentTab to set. */ public void setCurrentTab(String currentTab) { - this.currentTab = currentTab; + this.currentTab = currentTab; } - + /** * @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 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 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 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 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 lockWhenFinished. */ public String getLockWhenFinished() { - return lockWhenFinished; + return lockWhenFinished; } + /** - * @param lockWhenFinished The lockWhenFinished to set. + * @param lockWhenFinished + * The lockWhenFinished to set. */ public void setLockWhenFinished(String lockWhenFinished) { - this.lockWhenFinished = lockWhenFinished; + this.lockWhenFinished = lockWhenFinished; } + /** * @return Returns the showOtherAnswers. */ public String getShowOtherAnswers() { - return showOtherAnswers; + return showOtherAnswers; } + /** - * @param showOtherAnswers The showOtherAnswers to set. + * @param showOtherAnswers + * The showOtherAnswers to set. */ public void setShowOtherAnswers(String showOtherAnswers) { - this.showOtherAnswers = showOtherAnswers; + this.showOtherAnswers = showOtherAnswers; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredAnswersDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaMonitoredAnswersDTO.java,v diff -u -r1.5 -r1.6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredAnswersDTO.java 23 Sep 2006 15:11:03 -0000 1.5 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredAnswersDTO.java 19 Feb 2009 04:25:01 -0000 1.6 @@ -28,108 +28,114 @@ import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

DTO that holds question and user attempts data for jsp purposes + *

+ * DTO that holds question and user attempts data for jsp purposes *

* * @author Ozgur Demirtas */ -public class QaMonitoredAnswersDTO implements Comparable -{ +public class QaMonitoredAnswersDTO implements Comparable { private String sessionId; - + private String sessionName; - - private String questionUid; - - private String question; - - private Map questionAttempts; - - - /** - - /** - * @return Returns the question. - */ - public String getQuestion() { - return question; - } - /** - * @param question The question to set. - */ - public void setQuestion(String question) { - this.question = question; - } - /** - * @return Returns the questionUid. - */ - public String getQuestionUid() { - return questionUid; - } - /** - * @param questionUid The questionUid to set. - */ - public void setQuestionUid(String questionUid) { - this.questionUid = questionUid; - } - - /** - * @return Returns the questionAttempts. - */ - public Map getQuestionAttempts() { - return questionAttempts; - } - /** - * @param questionAttempts The questionAttempts to set. - */ - public void setQuestionAttempts(Map questionAttempts) { - this.questionAttempts = questionAttempts; - } - - public String toString() { - return new ToStringBuilder(this) - .append("sessionName:", sessionName) - .append("sessionId:", sessionId) - .append("questionUid:", questionUid) - .append("question:", question) - .append("questionAttempts:", questionAttempts) - .toString(); + + private String questionUid; + + private String question; + + private Map questionAttempts; + + /** + * + * /** + * + * @return Returns the question. + */ + public String getQuestion() { + return question; } - - public int compareTo(Object o) - { - QaMonitoredAnswersDTO qaMonitoredAnswersDTO = (QaMonitoredAnswersDTO) o; - - if (qaMonitoredAnswersDTO == null) - return 1; - else - return (int) (new Long(questionUid).longValue() - new Long(qaMonitoredAnswersDTO.questionUid).longValue()); + + /** + * @param question + * The question to set. + */ + public void setQuestion(String question) { + this.question = question; } - + /** + * @return Returns the questionUid. + */ + public String getQuestionUid() { + return questionUid; + } + + /** + * @param questionUid + * The questionUid to set. + */ + public void setQuestionUid(String questionUid) { + this.questionUid = questionUid; + } + + /** + * @return Returns the questionAttempts. + */ + public Map getQuestionAttempts() { + return questionAttempts; + } + + /** + * @param questionAttempts + * The questionAttempts to set. + */ + public void setQuestionAttempts(Map questionAttempts) { + this.questionAttempts = questionAttempts; + } + + public String toString() { + return new ToStringBuilder(this).append("sessionName:", sessionName).append("sessionId:", sessionId).append( + "questionUid:", questionUid).append("question:", question) + .append("questionAttempts:", questionAttempts).toString(); + } + + public int compareTo(Object o) { + QaMonitoredAnswersDTO qaMonitoredAnswersDTO = (QaMonitoredAnswersDTO) o; + + if (qaMonitoredAnswersDTO == null) + return 1; + else + return (int) (new Long(questionUid).longValue() - new Long(qaMonitoredAnswersDTO.questionUid).longValue()); + } + + /** * @return Returns the sessionId. */ public String getSessionId() { - return sessionId; + return sessionId; } + /** - * @param sessionId The sessionId to set. + * @param sessionId + * The sessionId to set. */ public void setSessionId(String sessionId) { - this.sessionId = sessionId; + this.sessionId = sessionId; } + /** * @return Returns the sessionName. */ public String getSessionName() { - return sessionName; + return sessionName; } + /** - * @param sessionName The sessionName to set. + * @param sessionName + * The sessionName to set. */ public void setSessionName(String sessionName) { - this.sessionName = sessionName; + this.sessionName = sessionName; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredUserDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaMonitoredUserDTO.java,v diff -u -r1.8 -r1.9 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredUserDTO.java 23 Sep 2006 15:11:03 -0000 1.8 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredUserDTO.java 19 Feb 2009 04:25:01 -0000 1.9 @@ -28,206 +28,232 @@ import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

DTO that holds users attempt history data for jsp purposes + *

+ * DTO that holds users attempt history data for jsp purposes *

* * @author Ozgur Demirtas */ -public class QaMonitoredUserDTO implements Comparable -{ - private String queUsrId; +public class QaMonitoredUserDTO implements Comparable { + private String queUsrId; private String uid; - - //private String attemptTime; - + + //private String attemptTime; + private Date attemptTime; - - private String timeZone; - - private String userName; - - private String isCorrect; - - private String response; - - private String responsePresentable; - - private String sessionId; - - private String questionUid; - - private String visible; - + + private String timeZone; + + private String userName; + + private String isCorrect; + + private String response; + + private String responsePresentable; + + private String sessionId; + + private String questionUid; + + private String visible; + private Map usersAttempts; - - /** - * @return Returns the queUsrId. - */ - public String getQueUsrId() { - return queUsrId; - } - /** - * @param queUsrId The queUsrId to set. - */ - public void setQueUsrId(String queUsrId) { - this.queUsrId = queUsrId; - } - - public String toString() { - return new ToStringBuilder(this) - .append("sessionId:", sessionId) - .append("userName:", userName) - .append("queUsrId:", queUsrId) - .append("questionUid:", questionUid) - .append("response:", response) - .append("visible:", visible) - .append("usersAttempts:", usersAttempts) - .toString(); + + /** + * @return Returns the queUsrId. + */ + public String getQueUsrId() { + return queUsrId; } - /** - * @return Returns the usersAttempts. - */ - public Map getUsersAttempts() { - return usersAttempts; - } - /** - * @param usersAttempts The usersAttempts to set. - */ - public void setUsersAttempts(Map usersAttempts) { - this.usersAttempts = usersAttempts; - } - - public int compareTo(Object o) - { - QaMonitoredUserDTO qaMonitoredUserDTO = (QaMonitoredUserDTO) o; - - if (qaMonitoredUserDTO == null) - return 1; - else - return (int) (new Long(queUsrId).longValue() - new Long(qaMonitoredUserDTO.queUsrId).longValue()); + + /** + * @param queUsrId + * The queUsrId to set. + */ + public void setQueUsrId(String queUsrId) { + this.queUsrId = queUsrId; } - - /** - * @return Returns the isCorrect. - */ - public String getIsCorrect() { - return isCorrect; - } - /** - * @param isCorrect The isCorrect to set. - */ - public void setIsCorrect(String isCorrect) { - this.isCorrect = isCorrect; - } - /** - * @return Returns the response. - */ - public String getResponse() { - return response; - } - /** - * @param response The response to set. - */ - public void setResponse(String response) { - this.response = response; - } - /** - * @return Returns the timeZone. - */ - public String getTimeZone() { - return timeZone; - } - /** - * @param timeZone The timeZone to set. - */ - public void setTimeZone(String timeZone) { - this.timeZone = timeZone; - } - /** - * @return Returns the uid. - */ - public String getUid() { - return uid; - } - /** - * @param uid The uid to set. - */ - public void setUid(String uid) { - this.uid = uid; - } - /** - * @return Returns the userName. - */ - public String getUserName() { - return userName; - } - /** - * @param userName The userName to set. - */ - public void setUserName(String userName) { - this.userName = userName; - } - /** - * @return Returns the sessionId. - */ - public String getSessionId() { - return sessionId; - } - /** - * @param sessionId The sessionId to set. - */ - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - /** - * @return Returns the questionUid. - */ - public String getQuestionUid() { - return questionUid; - } - /** - * @param questionUid The questionUid to set. - */ - public void setQuestionUid(String questionUid) { - this.questionUid = questionUid; - } + + public String toString() { + return new ToStringBuilder(this).append("sessionId:", sessionId).append("userName:", userName).append( + "queUsrId:", queUsrId).append("questionUid:", questionUid).append("response:", response).append( + "visible:", visible).append("usersAttempts:", usersAttempts).toString(); + } + /** + * @return Returns the usersAttempts. + */ + public Map getUsersAttempts() { + return usersAttempts; + } + + /** + * @param usersAttempts + * The usersAttempts to set. + */ + public void setUsersAttempts(Map usersAttempts) { + this.usersAttempts = usersAttempts; + } + + public int compareTo(Object o) { + QaMonitoredUserDTO qaMonitoredUserDTO = (QaMonitoredUserDTO) o; + + if (qaMonitoredUserDTO == null) + return 1; + else + return (int) (new Long(queUsrId).longValue() - new Long(qaMonitoredUserDTO.queUsrId).longValue()); + } + + /** + * @return Returns the isCorrect. + */ + public String getIsCorrect() { + return isCorrect; + } + + /** + * @param isCorrect + * The isCorrect to set. + */ + public void setIsCorrect(String isCorrect) { + this.isCorrect = isCorrect; + } + + /** + * @return Returns the response. + */ + public String getResponse() { + return response; + } + + /** + * @param response + * The response to set. + */ + public void setResponse(String response) { + this.response = response; + } + + /** + * @return Returns the timeZone. + */ + public String getTimeZone() { + return timeZone; + } + + /** + * @param timeZone + * The timeZone to set. + */ + public void setTimeZone(String timeZone) { + this.timeZone = timeZone; + } + + /** + * @return Returns the uid. + */ + public String getUid() { + return uid; + } + + /** + * @param uid + * The uid to set. + */ + public void setUid(String uid) { + this.uid = uid; + } + + /** + * @return Returns the userName. + */ + public String getUserName() { + return userName; + } + + /** + * @param userName + * The userName to set. + */ + public void setUserName(String userName) { + this.userName = userName; + } + + /** + * @return Returns the sessionId. + */ + public String getSessionId() { + return sessionId; + } + + /** + * @param sessionId + * The sessionId to set. + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + /** + * @return Returns the questionUid. + */ + public String getQuestionUid() { + return questionUid; + } + + /** + * @param questionUid + * The questionUid to set. + */ + public void setQuestionUid(String questionUid) { + this.questionUid = questionUid; + } + + /** * @return Returns the visible. */ public String getVisible() { - return visible; + return visible; } + /** - * @param visible The visible to set. + * @param visible + * The visible to set. */ public void setVisible(String visible) { - this.visible = visible; + this.visible = visible; } + /** * @return Returns the attemptTime. */ public Date getAttemptTime() { - return attemptTime; + return attemptTime; } + /** - * @param attemptTime The attemptTime to set. + * @param attemptTime + * The attemptTime to set. */ public void setAttemptTime(Date attemptTime) { - this.attemptTime = attemptTime; + this.attemptTime = attemptTime; } + /** * @return Returns the responsePresentable. */ public String getResponsePresentable() { - return responsePresentable; + return responsePresentable; } + /** - * @param responsePresentable The responsePresentable to set. + * @param responsePresentable + * The responsePresentable to set. */ public void setResponsePresentable(String responsePresentable) { - this.responsePresentable = responsePresentable; + this.responsePresentable = responsePresentable; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java,v diff -u -r1.12 -r1.13 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java 4 Oct 2008 02:45:44 -0000 1.12 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java 19 Feb 2009 04:25:01 -0000 1.13 @@ -37,13 +37,14 @@ * * @author Ozgur Demirtas * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code - * Templates + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ /** - * QaQueContent Value Object The value object that maps to our model database table: tl_laqa11_que_content The relevant - * hibernate mapping resides in: QaQueContent.hbm.xml + * QaQueContent Value Object The value object that maps to our model database + * table: tl_laqa11_que_content The relevant hibernate mapping resides in: + * QaQueContent.hbm.xml * * Holds question content within a particular content */ @@ -276,8 +277,8 @@ } /** - * Validate whether there is a response available for current question. This method only validate struts convient - * field at the moment. + * Validate whether there is a response available for current question. This + * method only validate struts convient field at the moment. * * @return whether the resonse is available or not. */ @@ -302,7 +303,8 @@ /** * Convenient method to check out the response for other field. * - * @return true if other response field is not null and is not equals to empty String + * @return true if other response field is not null and is not equals to + * empty String */ public boolean isOtherResponseAvailable() { if (otherResponse != null && !otherResponse.equals("")) { Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.java,v diff -u -r1.11 -r1.12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.java 20 Sep 2006 15:15:44 -0000 1.11 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.java 19 Feb 2009 04:25:01 -0000 1.12 @@ -20,7 +20,7 @@ * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; import java.io.Serializable; @@ -35,464 +35,436 @@ import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.log4j.Logger; + /** * * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ /** * - * QaQueUsr Value Object - * The value object that maps to our model database table: tl_laqa11_que_usr - * The relevant hibernate mapping resides in: QaQueUsr.hbm.xml + * QaQueUsr Value Object The value object that maps to our model database table: + * tl_laqa11_que_usr The relevant hibernate mapping resides in: QaQueUsr.hbm.xml * - * Represents tool users. + * Represents tool users. */ -public class QaQueUsr implements Serializable, Comparable, Nullable -{ - static Logger logger = Logger.getLogger(QaQueUsr.class.getName()); - +public class QaQueUsr implements Serializable, Comparable, Nullable { + static Logger logger = Logger.getLogger(QaQueUsr.class.getName()); + /** identifier field */ private Long uid; - /** persistent field */ + /** persistent field */ private Long queUsrId; - + /** nullable persistent field */ private String username; - + /** nullable persistent field */ private String fullname; - + private boolean responseFinalized; - + private boolean learnerFinished; - + /** persistent field */ private QaSession qaSession; - + /** persistent field */ private Long qaSessionId; - + /** persistent field */ private QaQueContent qaQueContent; - + /** persistent field */ - private Set qaUsrResps; + private Set qaUsrResps; - public QaQueUsr(){}; - + public QaQueUsr() { + }; + /** full constructor */ - public QaQueUsr(Long queUsrId, - String username, - String fullname, - QaQueContent qaQueContent, - QaSession qaSession, - Set qaUsrResps) - + public QaQueUsr(Long queUsrId, String username, String fullname, QaQueContent qaQueContent, QaSession qaSession, + Set qaUsrResps) + { - this.queUsrId = queUsrId; - this.username = username; - this.fullname = fullname; - this.qaQueContent = qaQueContent; - this.qaSession = qaSession; - this.qaUsrResps =qaUsrResps; + this.queUsrId = queUsrId; + this.username = username; + this.fullname = fullname; + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + this.qaUsrResps = qaUsrResps; } /** minimal constructor */ - public QaQueUsr(QaQueContent qaQueContent, - QaSession qaSession, - Set qaUsrResps) - + public QaQueUsr(QaQueContent qaQueContent, QaSession qaSession, Set qaUsrResps) + { - this.qaQueContent = qaQueContent; - this.qaSession = qaSession; - this.qaUsrResps =qaUsrResps; + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + this.qaUsrResps = qaUsrResps; } - - - public QaQueUsr(Long queUsrId, - String username, - String fullname, - QaQueContent qaQueContent, - QaSession qaSession) - { - this.queUsrId = queUsrId; - this.username = username; - this.fullname = fullname; - this.qaQueContent = qaQueContent; - this.qaSession = qaSession; - } - - - public QaQueUsr(String username, - String fullname, - QaQueContent qaQueContent, - QaSession qaSession, - Set qaUsrResps) - + + public QaQueUsr(Long queUsrId, String username, String fullname, QaQueContent qaQueContent, QaSession qaSession) { + this.queUsrId = queUsrId; + this.username = username; + this.fullname = fullname; + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + } + + public QaQueUsr(String username, String fullname, QaQueContent qaQueContent, QaSession qaSession, Set qaUsrResps) + { - this.username = username; - this.fullname = fullname; - this.qaQueContent = qaQueContent; - this.qaSession = qaSession; - this.qaUsrResps =qaUsrResps; + this.username = username; + this.fullname = fullname; + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + this.qaUsrResps = qaUsrResps; } - /** * Copy construtor; We copy all data except the hibernate id field. - * @param queUsr the original survey question user object. + * + * @param queUsr + * the original survey question user object. * @return the survey question user object. */ - public QaQueUsr newInstance(QaQueUsr queUsr) - { - return new QaQueUsr(queUsr.getQueUsrId(), - queUsr.getUsername(), - queUsr.getFullname(), - queUsr.getQaQueContent(), - queUsr.getQaSession(), - queUsr.getQaUsrResps()); + public QaQueUsr newInstance(QaQueUsr queUsr) { + return new QaQueUsr(queUsr.getQueUsrId(), queUsr.getUsername(), queUsr.getFullname(), queUsr.getQaQueContent(), + queUsr.getQaSession(), queUsr.getQaUsrResps()); } - - - /** - * @return Returns the fullname. - */ - public String getFullname() { - return fullname; - } - /** - * @param fullName The fullName to set. - */ - public void setFullname(String fullname) { - this.fullname = fullname; - } - /** - * @return Returns the qaQueContent. - */ - public QaQueContent getQaQueContent() { - return qaQueContent; - } - /** - * @param qaQueContent The qaQueContent to set. - */ - public void setQaQueContent(QaQueContent qaQueContent) { - this.qaQueContent = qaQueContent; - } - /** - * @return Returns the qaSession. - */ - public QaSession getQaSession() { - return qaSession; - } - /** - * @param qaSession The qaSession to set. - */ - public void setQaSession(QaSession qaSession) { - this.qaSession = qaSession; - } - /** - * @return Returns the qaUsrResps. - */ - public Set getQaUsrResps() - { - if (this.qaUsrResps == null) - setQaUsrResps(new TreeSet()); - return this.qaUsrResps; - } - /** - * @param qaUsrResps The qaUsrResps to set. - */ - public void setQaUsrResps(Set qaUsrResps) { - this.qaUsrResps = qaUsrResps; - } - /** - * @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 username. - */ - public String getUsername() { - return username; - } - /** - * @param username The username to set. - */ - public void setUsername(String username) { - this.username = username; - } - - - public String toString() - { - return new ToStringBuilder(this).append("queUsrId", getQueUsrId()) - .append("username",getUsername()) - .append("full name",getFullname()) - .toString(); + + /** + * @return Returns the fullname. + */ + public String getFullname() { + return fullname; } - - - public boolean equals(Object other) - { - if (!(other instanceof QaQueUsr)) - return false; - QaQueUsr castOther = (QaQueUsr) other; - return new EqualsBuilder().append(this.getQueUsrId(),castOther.getQueUsrId()) - //.append(this.getUserId(),castOther.getUserId()) - //.append(this.getQaQueContent(),castOther.getQaQueContent()) - .isEquals(); + + /** + * @param fullName + * The fullName to set. + */ + public void setFullname(String fullname) { + this.fullname = fullname; } - public int hashCode() - { - return new HashCodeBuilder().append(getQueUsrId()) - //.append(getUserId()) - .toHashCode(); + /** + * @return Returns the qaQueContent. + */ + public QaQueContent getQaQueContent() { + return qaQueContent; } - + /** + * @param qaQueContent + * The qaQueContent to set. + */ + public void setQaQueContent(QaQueContent qaQueContent) { + this.qaQueContent = qaQueContent; + } + /** + * @return Returns the qaSession. + */ + public QaSession getQaSession() { + return qaSession; + } + + /** + * @param qaSession + * The qaSession to set. + */ + public void setQaSession(QaSession qaSession) { + this.qaSession = qaSession; + } + + /** + * @return Returns the qaUsrResps. + */ + public Set getQaUsrResps() { + if (this.qaUsrResps == null) + setQaUsrResps(new TreeSet()); + return this.qaUsrResps; + } + + /** + * @param qaUsrResps + * The qaUsrResps to set. + */ + public void setQaUsrResps(Set qaUsrResps) { + this.qaUsrResps = qaUsrResps; + } + + /** + * @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 username. + */ + public String getUsername() { + return username; + } + + /** + * @param username + * The username to set. + */ + public void setUsername(String username) { + this.username = username; + } + + public String toString() { + return new ToStringBuilder(this).append("queUsrId", getQueUsrId()).append("username", getUsername()).append( + "full name", getFullname()).toString(); + } + + public boolean equals(Object other) { + if (!(other instanceof QaQueUsr)) + return false; + QaQueUsr castOther = (QaQueUsr) other; + return new EqualsBuilder().append(this.getQueUsrId(), castOther.getQueUsrId()) + //.append(this.getUserId(),castOther.getUserId()) + //.append(this.getQaQueContent(),castOther.getQaQueContent()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder().append(getQueUsrId()) + //.append(getUserId()) + .toHashCode(); + } + //--------------------------------------------------------------------- // Convenient Service Methods //--------------------------------------------------------------------- /** - * Check up question responsed by current user against a list user responses. - * Return true if + * Check up question responsed by current user against a list user + * responses. Return true if + * * @param responses * @return the validation result */ - public boolean checkUpQueUsrHas(List responses) - { - if (responses == null) - throw new IllegalArgumentException("Invalid responses from " - + this.getFullname() + ": Can't validate null responses" - + "against current survey questions"); + public boolean checkUpQueUsrHas(List responses) { + if (responses == null) + throw new IllegalArgumentException("Invalid responses from " + this.getFullname() + + ": Can't validate null responses" + "against current survey questions"); - //make defensive copy to avoid list mutation outside this class. - ArrayList resps = new ArrayList(responses); + //make defensive copy to avoid list mutation outside this class. + ArrayList resps = new ArrayList(responses); - for (Iterator i = resps.iterator(); i.hasNext();) - { - QaUsrResp resp = (QaUsrResp) i.next(); - if (doesQueUserHas(resp)) - return true; - } - return false; + for (Iterator i = resps.iterator(); i.hasNext();) { + QaUsrResp resp = (QaUsrResp) i.next(); + if (doesQueUserHas(resp)) + return true; + } + return false; } - - /** * The helper function to validate the availability of a user response for - * this question user. - * The condition to return true is:
- *
  • the requested response has a reference to a question user object - * and reference id is the same as current question user object.
  • + * this question user. The condition to return true is:
    + *
  • the requested response has a reference to a question user object and + * reference id is the same as current question user object.
  • * - * @param response the user response + * @param response + * the user response * @return the validation result */ - public boolean doesQueUserHas(QaUsrResp response) - { - if (response.getQaQueUser() == null) - throw new IllegalArgumentException("Invalid response :" - + " Can't validate the availability" - + " of a response without the reference to a user"); - - if(response.getQaQueUser().getQueUsrId()==null||this.getQueUsrId()==null) - return false; - - if (this.getQueUsrId().equals(response.getQaQueUser().getQueUsrId())) - return true; - return false; - } - + public boolean doesQueUserHas(QaUsrResp response) { + if (response.getQaQueUser() == null) + throw new IllegalArgumentException("Invalid response :" + " Can't validate the availability" + + " of a response without the reference to a user"); + + if (response.getQaQueUser().getQueUsrId() == null || this.getQueUsrId() == null) + return false; + + if (this.getQueUsrId().equals(response.getQaQueUser().getQueUsrId())) + return true; + return false; + } + /** * @param responses * @param responseSet */ - public void removeResponseBy(ArrayList responses) - { - Set responseSet = new TreeSet(this.getQaUsrResps()); - //remove responses no longer exist. - for(Iterator i = responseSet.iterator();i.hasNext();) - { - QaUsrResp resp = (QaUsrResp) i.next(); - if(!resp.doesRespExistIn(responses)) - this.getQaUsrResps().remove(resp); - } + public void removeResponseBy(ArrayList responses) { + Set responseSet = new TreeSet(this.getQaUsrResps()); + //remove responses no longer exist. + for (Iterator i = responseSet.iterator(); i.hasNext();) { + QaUsrResp resp = (QaUsrResp) i.next(); + if (!resp.doesRespExistIn(responses)) + this.getQaUsrResps().remove(resp); + } } - /** * Update the user responses of this question user object against a list of * new user responses. + * * @param responses */ - public void updateQueUsr(List responses) - { - if (responses == null) - throw new IllegalArgumentException("Invalid responses from " - + this.getFullname() + ": Can't update null responses" - + "against current survey questions"); + public void updateQueUsr(List responses) { + if (responses == null) + throw new IllegalArgumentException("Invalid responses from " + this.getFullname() + + ": Can't update null responses" + "against current survey questions"); - //make defensive copy to avoid list mutation outside this class. - ArrayList resps = new ArrayList(responses); - //clean up all the existing reponses - removeResponseBy(resps); - addNewResponsesBy(resps); - updateExistingResp(resps); + //make defensive copy to avoid list mutation outside this class. + ArrayList resps = new ArrayList(responses); + //clean up all the existing reponses + removeResponseBy(resps); + addNewResponsesBy(resps); + updateExistingResp(resps); } /** * @param resps * @param responseList */ - public void addNewResponsesBy(ArrayList resps) - { - ArrayList responseList = new ArrayList(this.getQaUsrResps()); - //add all associated new responses into the current question user. - for (Iterator i = resps.iterator(); i.hasNext();) - { - QaUsrResp resp = (QaUsrResp) i.next(); - if (!resp.doesRespExistIn(responseList)&&doesQueUserHas(resp)) - addUserResponse(resp); - } + public void addNewResponsesBy(ArrayList resps) { + ArrayList responseList = new ArrayList(this.getQaUsrResps()); + //add all associated new responses into the current question user. + for (Iterator i = resps.iterator(); i.hasNext();) { + QaUsrResp resp = (QaUsrResp) i.next(); + if (!resp.doesRespExistIn(responseList) && doesQueUserHas(resp)) + addUserResponse(resp); + } } /** * @param responses * @param responseSet */ - public void updateExistingResp(ArrayList responses) - { - //update existing responses - for(Iterator i = this.getQaUsrResps().iterator();i.hasNext();) - { - QaUsrResp resp = (QaUsrResp) i.next(); - if(resp.doesRespExistIn(responses)) - resp.updateResponseBy(responses); - } + public void updateExistingResp(ArrayList responses) { + //update existing responses + for (Iterator i = this.getQaUsrResps().iterator(); i.hasNext();) { + QaUsrResp resp = (QaUsrResp) i.next(); + if (resp.doesRespExistIn(responses)) + resp.updateResponseBy(responses); + } } /** * @param resp */ - public void addUserResponse(QaUsrResp resp) - { - if (resp != null && !resp.isResponseValid()) - throw new IllegalArgumentException("Invalid response for update "); + public void addUserResponse(QaUsrResp resp) { + if (resp != null && !resp.isResponseValid()) + throw new IllegalArgumentException("Invalid response for update "); - this.getQaUsrResps().add(resp); + this.getQaUsrResps().add(resp); } - /** - * Get a list of user response Strings that are correspondent to the - * authored defined candidate answers. Currently, we include the free - * text answer to this category as well. + * Get a list of user response Strings that are correspondent to the + * authored defined candidate answers. Currently, we include the free text + * answer to this category as well. * * @return the list of String user responses */ - public List getPredefinedResponse() - { - LinkedList responses = new LinkedList(); - - for(Iterator i = this.getQaUsrResps().iterator();i.hasNext();) - { - QaUsrResp res = (QaUsrResp)i.next(); - if(res.isPredefinedResponse()) - { - responses.add(res.getAnswer()); - } - } - return responses; + public List getPredefinedResponse() { + LinkedList responses = new LinkedList(); + + for (Iterator i = this.getQaUsrResps().iterator(); i.hasNext();) { + QaUsrResp res = (QaUsrResp) i.next(); + if (res.isPredefinedResponse()) { + responses.add(res.getAnswer()); + } + } + return responses; } - - public String getOtherResponse() - { - for(Iterator i = this.getQaUsrResps().iterator();i.hasNext();) - { - QaUsrResp res = (QaUsrResp)i.next(); - if(!res.isPredefinedResponse()) - return res.getAnswer(); - } - - return ""; + public String getOtherResponse() { + for (Iterator i = this.getQaUsrResps().iterator(); i.hasNext();) { + QaUsrResp res = (QaUsrResp) i.next(); + if (!res.isPredefinedResponse()) + return res.getAnswer(); + } + + return ""; } - - public int compareTo(Object o) - { - - QaQueUsr qUser = (QaQueUsr) o; - return this.getQaQueContent().compareTo(qUser.getQaQueContent()); + + public int compareTo(Object o) { + + QaQueUsr qUser = (QaQueUsr) o; + return this.getQaQueContent().compareTo(qUser.getQaQueContent()); } - - public boolean isNull() - { - return false; + + public boolean isNull() { + return false; } - - /** - * @return Returns the qaSessionId. - */ - public Long getQaSessionId() { - return qaSessionId; - } - /** - * @param qaSessionId The qaSessionId to set. - */ - public void setQaSessionId(Long qaSessionId) { - this.qaSessionId = qaSessionId; - } - /** - * @return Returns the uid. - */ - public Long getUid() { - return uid; - } - /** - * @param uid The uid to set. - */ - public void setUid(Long uid) { - this.uid = uid; - } + /** + * @return Returns the qaSessionId. + */ + public Long getQaSessionId() { + return qaSessionId; + } + + /** + * @param qaSessionId + * The qaSessionId to set. + */ + public void setQaSessionId(Long qaSessionId) { + this.qaSessionId = qaSessionId; + } + + /** + * @return Returns the uid. + */ + public Long getUid() { + return uid; + } + + /** + * @param uid + * The uid to set. + */ + public void setUid(Long uid) { + this.uid = uid; + } + + /** * @return Returns the responseFinalized. */ public boolean isResponseFinalized() { - return responseFinalized; + return responseFinalized; } + /** - * @param responseFinalized The responseFinalized to set. + * @param responseFinalized + * The responseFinalized to set. */ public void setResponseFinalized(boolean responseFinalized) { - this.responseFinalized = responseFinalized; + this.responseFinalized = responseFinalized; } + /** * @return Returns the learnerFinished. */ public boolean isLearnerFinished() { - return learnerFinished; + return learnerFinished; } + /** - * @param learnerFinished The learnerFinished to set. + * @param learnerFinished + * The learnerFinished to set. */ public void setLearnerFinished(boolean learnerFinished) { - this.learnerFinished = learnerFinished; + this.learnerFinished = learnerFinished; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java,v diff -u -r1.11 -r1.12 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java 20 Sep 2006 15:15:44 -0000 1.11 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java 19 Feb 2009 04:25:01 -0000 1.12 @@ -20,7 +20,7 @@ * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; import java.io.Serializable; @@ -34,26 +34,24 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.log4j.Logger; - /** * - * @author Ozgur Demirtas - * - * QaSession Value Object - * The value object that maps to our model database table: tl_laqa11_session - * The relevant hibernate mapping resides in: QaSession.hbm.xml + * @author Ozgur Demirtas * - * Holds tool sessions + * QaSession Value Object The value object that maps to our model database + * table: tl_laqa11_session The relevant hibernate mapping resides in: + * QaSession.hbm.xml + * + * Holds tool sessions */ -public class QaSession implements Serializable,Comparable, Nullable -{ - static Logger logger = Logger.getLogger(QaSession.class.getName()); - +public class QaSession implements Serializable, Comparable, Nullable { + static Logger logger = Logger.getLogger(QaSession.class.getName()); + public final static String INCOMPLETE = "INCOMPLETE"; - + public static final String COMPLETED = "COMPLETED"; - /** identifier field */ + /** identifier field */ private Long uid; /** identifier field */ @@ -64,203 +62,157 @@ /** nullable persistent field */ private Date session_end_date; - + /** nullable persistent field */ private String session_status; - + /** nullable persistent field */ private String session_name; - + /** persistent field */ private QaContent qaContent; /** persistent field */ private Set qaQueUsers; - + /** persistent field */ private Long qaContentId; - - public QaSession(){}; - - public QaSession(Long qaSessionId, - Date session_start_date, - Date session_end_date, - String session_status, - QaContent qaContent, - Set qaQueUsers) - { - this.qaSessionId = qaSessionId; - this.session_start_date = session_start_date; - this.session_end_date = session_end_date; - this.session_status = session_status; - this.qaContent = qaContent; - this.qaQueUsers = qaQueUsers; + public QaSession() { + }; + + public QaSession(Long qaSessionId, Date session_start_date, Date session_end_date, String session_status, + QaContent qaContent, Set qaQueUsers) { + this.qaSessionId = qaSessionId; + this.session_start_date = session_start_date; + this.session_end_date = session_end_date; + this.session_status = session_status; + this.qaContent = qaContent; + this.qaQueUsers = qaQueUsers; } - - public QaSession(Long qaSessionId, - Date session_start_date, - String session_status, - String session_name, - QaContent qaContent, - Set qaQueUsers) - { - this.qaSessionId = qaSessionId; - this.session_start_date = session_start_date; - this.session_status = session_status; - this.session_name=session_name; - this.qaContent = qaContent; - this.qaQueUsers = qaQueUsers; - logger.debug(logger + " " + this.getClass().getName() + "in full constructor: QaSession()"); - } - + public QaSession(Long qaSessionId, Date session_start_date, String session_status, String session_name, + QaContent qaContent, Set qaQueUsers) { + this.qaSessionId = qaSessionId; + this.session_start_date = session_start_date; + this.session_status = session_status; + this.session_name = session_name; + this.qaContent = qaContent; + this.qaQueUsers = qaQueUsers; + logger.debug(logger + " " + this.getClass().getName() + "in full constructor: QaSession()"); + } - public Long getQaSessionId() - { - return this.qaSessionId; + public Long getQaSessionId() { + return this.qaSessionId; } - public void setQaSessionId(Long qaSessionId) - { - this.qaSessionId = qaSessionId; + public void setQaSessionId(Long qaSessionId) { + this.qaSessionId = qaSessionId; } - public Date getSession_start_date() - { - return this.session_start_date; + public Date getSession_start_date() { + return this.session_start_date; } - public void setSession_start_date(Date session_start_date) - { - this.session_start_date = session_start_date; + public void setSession_start_date(Date session_start_date) { + this.session_start_date = session_start_date; } - public Date getSession_end_date() - { - return this.session_end_date; + public Date getSession_end_date() { + return this.session_end_date; } - public void setSession_end_date(Date session_end_date) - { - this.session_end_date = session_end_date; + public void setSession_end_date(Date session_end_date) { + this.session_end_date = session_end_date; } + public String getSession_status() { + return session_status; + } - public String getSession_status() - { - return session_status; + public void setSession_status(String session_status) { + this.session_status = session_status; } + public QaContent getQaContent() { + return this.qaContent; + } - public void setSession_status(String session_status) - { - this.session_status = session_status; + public void setQaContent(QaContent qaContent) { + this.qaContent = qaContent; } - - public QaContent getQaContent() - { - return this.qaContent; + public Set getQaQueUsers() { + if (this.qaQueUsers == null) + setQaQueUsers(new TreeSet()); + return this.qaQueUsers; } - public void setQaContent(QaContent qaContent) - { - this.qaContent = qaContent; + public void setQaQueUsers(Set qaQueUsers) { + this.qaQueUsers = qaQueUsers; } + public void removeQueUsersBy(List responses) { + Set queUserSet = new TreeSet(this.getQaQueUsers()); + } - public Set getQaQueUsers() - { - if (this.qaQueUsers == null) - setQaQueUsers(new TreeSet()); - return this.qaQueUsers; + public String toString() { + return new ToStringBuilder(this).append("qaSessionId", getQaSessionId()).append("session start date", + getSession_start_date()).append("session end date", getSession_end_date()).append("session status", + getSession_status()).toString(); } - - public void setQaQueUsers(Set qaQueUsers) - { - this.qaQueUsers = qaQueUsers; + public boolean equals(Object other) { + if (!(other instanceof QaSession)) + return false; + + QaSession castOther = (QaSession) other; + return new EqualsBuilder().append(this.getQaSessionId(), castOther.getQaSessionId()).isEquals(); + } - - public void removeQueUsersBy(List responses) - { - Set queUserSet = new TreeSet(this.getQaQueUsers()); + public int hashCode() { + return new HashCodeBuilder().append(getQaSessionId()).toHashCode(); + } - - public String toString() - { - return new ToStringBuilder(this).append("qaSessionId",getQaSessionId()) - .append("session start date",getSession_start_date()) - .append("session end date",getSession_end_date()) - .append("session status",getSession_status()) - .toString(); + public int compareTo(Object o) { + QaSession qaSession = (QaSession) o; + return (int) (qaSessionId.longValue() - qaSession.qaSessionId.longValue()); } - - public boolean equals(Object other) - { - if (!(other instanceof QaSession)) - return false; - - QaSession castOther = (QaSession) other; - return new EqualsBuilder().append(this.getQaSessionId(), - castOther.getQaSessionId()) - .isEquals(); - + public boolean isNull() { + return false; } - public int hashCode() - { - return new HashCodeBuilder(). - append(getQaSessionId()). - toHashCode(); - + public Long getQaContentId() { + return qaContentId; } - - - public int compareTo(Object o) - { - QaSession qaSession = (QaSession) o; - return (int) (qaSessionId.longValue() - qaSession.qaSessionId.longValue()); + + public void setQaContentId(Long qaContentId) { + this.qaContentId = qaContentId; } + public Long getUid() { + return uid; + } - public boolean isNull() - { - return false; + public void setUid(Long uid) { + this.uid = uid; } + /** + * @return Returns the session_name. + */ + public String getSession_name() { + return session_name; + } - public Long getQaContentId() { - return qaContentId; - } - - - public void setQaContentId(Long qaContentId) { - this.qaContentId = qaContentId; - } - - - public Long getUid() { - return uid; - } - - public void setUid(Long uid) { - this.uid = uid; - } - /** - * @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; - } + /** + * @param session_name + * The session_name to set. + */ + public void setSession_name(String session_name) { + this.session_name = session_name; + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStatsDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaStatsDTO.java,v diff -u -r1.1 -r1.2 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStatsDTO.java 20 Sep 2006 15:08:31 -0000 1.1 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStatsDTO.java 19 Feb 2009 04:25:01 -0000 1.2 @@ -26,59 +26,59 @@ import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

    DTO that holds stats data + *

    + * DTO that holds stats data *

    * * @author Ozgur Demirtas */ -public class QaStatsDTO implements Comparable -{ - private String countAllUsers; - - private String countSessionComplete; - - public String toString() { - return new ToStringBuilder(this) - .append("question", countAllUsers) - .append("countSessionComplete", countSessionComplete) - .toString(); +public class QaStatsDTO implements Comparable { + private String countAllUsers; + + private String countSessionComplete; + + public String toString() { + return new ToStringBuilder(this).append("question", countAllUsers).append("countSessionComplete", + countSessionComplete).toString(); } - - public int compareTo(Object o) - { - QaStatsDTO qaStatsDTO = (QaStatsDTO) o; - - if (qaStatsDTO == null) - return 1; - else - return 0; + + public int compareTo(Object o) { + QaStatsDTO qaStatsDTO = (QaStatsDTO) o; + + if (qaStatsDTO == null) + return 1; + else + return 0; } - - + /** * @return Returns the countAllUsers. */ public String getCountAllUsers() { - return countAllUsers; + return countAllUsers; } + /** - * @param countAllUsers The countAllUsers to set. + * @param countAllUsers + * The countAllUsers to set. */ public void setCountAllUsers(String countAllUsers) { - this.countAllUsers = countAllUsers; + this.countAllUsers = countAllUsers; } + /** * @return Returns the countSessionComplete. */ public String getCountSessionComplete() { - return countSessionComplete; + return countSessionComplete; } + /** - * @param countSessionComplete The countSessionComplete to set. + * @param countSessionComplete + * The countSessionComplete to set. */ public void setCountSessionComplete(String countSessionComplete) { - this.countSessionComplete = countSessionComplete; + this.countSessionComplete = countSessionComplete; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStringComparator.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaStringComparator.java,v diff -u -r1.6 -r1.7 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStringComparator.java 20 Sep 2006 15:15:44 -0000 1.6 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStringComparator.java 19 Feb 2009 04:25:01 -0000 1.7 @@ -20,7 +20,7 @@ * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; import java.io.Serializable; @@ -30,28 +30,28 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ /** - * A comparator implementation that can be used as a constructor to collections. - * The TreeMap in the web layer makes use of it. + * A comparator implementation that can be used as a constructor to collections. + * The TreeMap in the web layer makes use of it. * */ public class QaStringComparator implements Comparator, Serializable { - static Logger logger = Logger.getLogger(QaStringComparator.class.getName()); - - public int compare(Object o1, Object o2) { - String s1 = (String)o1; - String s2 = (String)o2; + static Logger logger = Logger.getLogger(QaStringComparator.class.getName()); - return s1.compareTo(s2); - } + public int compare(Object o1, Object o2) { + String s1 = (String) o1; + String s2 = (String) o2; - public boolean equals(Object o) { - String s = (String)o; - return compare(this, o)==0; - } + return s1.compareTo(s2); + } + + public boolean equals(Object o) { + String s = (String) o; + return compare(this, o) == 0; + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUploadedFile.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaUploadedFile.java,v diff -u -r1.14 -r1.15 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUploadedFile.java 11 Oct 2006 07:19:26 -0000 1.14 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUploadedFile.java 19 Feb 2009 04:25:01 -0000 1.15 @@ -20,7 +20,7 @@ * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; import java.io.Serializable; @@ -38,190 +38,178 @@ /** * * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ /** - * QaQueContent Value Object - * The value object that maps to our model database table: tl_laqa11_que_content - * The relevant hibernate mapping resides in: QaQueContent.hbm.xml - * - * Holds question content within a particular content + * QaQueContent Value Object The value object that maps to our model database + * table: tl_laqa11_que_content The relevant hibernate mapping resides in: + * QaQueContent.hbm.xml + * + * Holds question content within a particular content */ -public class QaUploadedFile implements Serializable, Comparable -{ - static Logger logger = Logger.getLogger(QaUploadedFile.class.getName()); - /** identifier field */ +public class QaUploadedFile implements Serializable, Comparable { + static Logger logger = Logger.getLogger(QaUploadedFile.class.getName()); + /** identifier field */ private Long submissionId; - + /** persistent field */ private String uuid; /** persistent field */ private boolean fileOnline; - + /** persistent field */ private String fileName; - + /** persistent field */ private QaContent qaContent; - - public QaUploadedFile(){}; + public QaUploadedFile() { + }; + /** full constructor */ - public QaUploadedFile(Long submissionId, - String uuid, - boolean fileOnline, - String fileName, - QaContent qaContent) - { - this.submissionId=submissionId; - this.uuid = uuid; - this.fileOnline = fileOnline; - this.fileName = fileName; - this.qaContent=qaContent; + public QaUploadedFile(Long submissionId, String uuid, boolean fileOnline, String fileName, QaContent qaContent) { + this.submissionId = submissionId; + this.uuid = uuid; + this.fileOnline = fileOnline; + this.fileName = fileName; + this.qaContent = qaContent; } - - + public static QaUploadedFile newInstance(IToolContentHandler toolContentHandler, QaUploadedFile qaUploadedFile, - QaContent newMcContent) throws ItemNotFoundException, RepositoryCheckedException - - { - QaUploadedFile newMcUploadedFile=null; + QaContent newMcContent) throws ItemNotFoundException, RepositoryCheckedException - newMcUploadedFile = new QaUploadedFile(qaUploadedFile.getUuid(), - qaUploadedFile.isFileOnline(), - qaUploadedFile.getFileName(), - newMcContent); - - return newMcUploadedFile; - } - - - - public QaUploadedFile(String uuid, - boolean fileOnline, - String fileName, - QaContent qaContent) { - logger.debug("constructor gets called."); - this.uuid = uuid; - this.fileOnline = fileOnline; - this.fileName = fileName; - this.qaContent=qaContent; + QaUploadedFile newMcUploadedFile = null; + + newMcUploadedFile = new QaUploadedFile(qaUploadedFile.getUuid(), qaUploadedFile.isFileOnline(), qaUploadedFile + .getFileName(), newMcContent); + + return newMcUploadedFile; } - - + + public QaUploadedFile(String uuid, boolean fileOnline, String fileName, QaContent qaContent) { + logger.debug("constructor gets called."); + this.uuid = uuid; + this.fileOnline = fileOnline; + this.fileName = fileName; + this.qaContent = qaContent; + } + public String toString() { - return new ToStringBuilder(this) - .append("uuid: ", getUuid()) - .append("fileName: ", getFileName()) - .toString(); + return new ToStringBuilder(this).append("uuid: ", getUuid()).append("fileName: ", getFileName()).toString(); } public boolean equals(Object other) { - if ( !(other instanceof QaUploadedFile) ) return false; - QaUploadedFile castOther = (QaUploadedFile) other; - return new EqualsBuilder() - .append(this.getUuid(), castOther.getUuid()) - .isEquals(); + if (!(other instanceof QaUploadedFile)) + return false; + QaUploadedFile castOther = (QaUploadedFile) other; + return new EqualsBuilder().append(this.getUuid(), castOther.getUuid()).isEquals(); } public int hashCode() { - return new HashCodeBuilder() - .append(getUuid()) - .toHashCode(); + return new HashCodeBuilder().append(getUuid()).toHashCode(); } - - - /** - * @return Returns the fileName. - */ - public String getFileName() { - return fileName; - } - /** - * @param fileName The fileName to set. - */ - public void setFileName(String fileName) { - this.fileName = fileName; - } - - /** - * @return Returns the qaContent. - */ - public QaContent getQaContent() { - return qaContent; - } - /** - * @param qaContent The qaContent to set. - */ - public void setQaContent(QaContent qaContent) { - this.qaContent = qaContent; - } - /** - * @return Returns the submissionId. - */ - public Long getSubmissionId() { - return submissionId; - } - /** - * @param submissionId The submissionId to set. - */ - public void setSubmissionId(Long submissionId) { - this.submissionId = submissionId; - } - /** - * @return Returns the uuid. - */ - public String getUuid() { - return uuid; - } - /** - * @param uuid The uuid to set. - */ - public void setUuid(String uuid) { - this.uuid = uuid; - } - /** - * @return Returns the fileOnline. - */ - public boolean isFileOnline() { - return fileOnline; - } - /** - * @param fileOnline The fileOnline to set. - */ - public void setFileOnline(boolean fileOnline) { - this.fileOnline = fileOnline; - } - - public int compareTo(Object o) - { - QaUploadedFile file = (QaUploadedFile) o; - //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference. - if (submissionId == null) - return 1; - else - return (int) (submissionId.longValue() - file.submissionId.longValue()); + /** + * @return Returns the fileName. + */ + public String getFileName() { + return fileName; } - public String getFileProperty() { - if (isFileOnline()) - { - return IToolContentHandler.TYPE_ONLINE; - } - else - return IToolContentHandler.TYPE_OFFLINE; - } - public void setFileProperty(String fileProperty) { - if(StringUtils.equals(IToolContentHandler.TYPE_ONLINE,fileProperty)) - this.fileOnline = true; - else - this.fileOnline = false; - } + /** + * @param fileName + * The fileName to set. + */ + public void setFileName(String fileName) { + this.fileName = fileName; + } + + /** + * @return Returns the qaContent. + */ + public QaContent getQaContent() { + return qaContent; + } + + /** + * @param qaContent + * The qaContent to set. + */ + public void setQaContent(QaContent qaContent) { + this.qaContent = qaContent; + } + + /** + * @return Returns the submissionId. + */ + public Long getSubmissionId() { + return submissionId; + } + + /** + * @param submissionId + * The submissionId to set. + */ + public void setSubmissionId(Long submissionId) { + this.submissionId = submissionId; + } + + /** + * @return Returns the uuid. + */ + public String getUuid() { + return uuid; + } + + /** + * @param uuid + * The uuid to set. + */ + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * @return Returns the fileOnline. + */ + public boolean isFileOnline() { + return fileOnline; + } + + /** + * @param fileOnline + * The fileOnline to set. + */ + public void setFileOnline(boolean fileOnline) { + this.fileOnline = fileOnline; + } + + public int compareTo(Object o) { + QaUploadedFile file = (QaUploadedFile) o; + //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference. + if (submissionId == null) + return 1; + else + return (int) (submissionId.longValue() - file.submissionId.longValue()); + } + + public String getFileProperty() { + if (isFileOnline()) { + return IToolContentHandler.TYPE_ONLINE; + } else + return IToolContentHandler.TYPE_OFFLINE; + } + + public void setFileProperty(String fileProperty) { + if (StringUtils.equals(IToolContentHandler.TYPE_ONLINE, fileProperty)) + this.fileOnline = true; + else + this.fileOnline = false; + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUsrResp.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUsrResp.java,v diff -u -r1.9 -r1.10 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUsrResp.java 20 Sep 2006 15:15:44 -0000 1.9 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUsrResp.java 19 Feb 2009 04:25:01 -0000 1.10 @@ -20,7 +20,7 @@ * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; import java.io.Serializable; @@ -32,16 +32,15 @@ import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; - /** * * @author Ozgur Demirtas * - * QaUsrResp Value Object - * The value object that maps to our model database table: tl_laqa11_usr_resp - * The relevant hibernate mapping resides in: QaQueResp.hbm.xml + * QaUsrResp Value Object The value object that maps to our model database + * table: tl_laqa11_usr_resp The relevant hibernate mapping resides in: + * QaQueResp.hbm.xml * - * Holds user responses to questions + * Holds user responses to questions */ public class QaUsrResp implements Serializable, Comparable { @@ -51,7 +50,7 @@ /** nullable persistent field */ private String answer; - + /** nullable persistent field */ private boolean hidden; @@ -60,353 +59,330 @@ /** nullable persistent field */ private QaQueContent qaQueContent; - + private boolean visible; - + /** nullable persistent field */ private Long qaQueContentId; //added to enable deletion by the resp dao - + /** nullable persistent field */ - private Long queUsrId; //added to enable deletion by the resp dao + private Long queUsrId; //added to enable deletion by the resp dao /** nullable persistent field */ private QaQueUsr qaQueUser; /** nullable persistent field */ private String timezone; - - + /** full constructor */ - public QaUsrResp(Long responseId, - String answer, - boolean hidden, - Date attemptTime, - String timezone, - QaQueContent qaQueContent, - QaQueUsr qaQueUser) { - this.responseId =responseId; - this.answer = answer; - this.hidden = hidden; - this.attemptTime = attemptTime; - this.timezone = timezone; - this.qaQueContent = qaQueContent; - this.qaQueUser = qaQueUser; + public QaUsrResp(Long responseId, String answer, boolean hidden, Date attemptTime, String timezone, + QaQueContent qaQueContent, QaQueUsr qaQueUser) { + this.responseId = responseId; + this.answer = answer; + this.hidden = hidden; + this.attemptTime = attemptTime; + this.timezone = timezone; + this.qaQueContent = qaQueContent; + this.qaQueUser = qaQueUser; } - - public QaUsrResp(String answer, - boolean hidden, - Date attemptTime, - String timezone, - QaQueContent qaQueContent, - QaQueUsr qaQueUser) { - this.answer = answer; - this.hidden = hidden; - this.attemptTime = attemptTime; - this.timezone = timezone; - this.qaQueContent = qaQueContent; - this.qaQueUser = qaQueUser; - } - + public QaUsrResp(String answer, boolean hidden, Date attemptTime, String timezone, QaQueContent qaQueContent, + QaQueUsr qaQueUser) { + this.answer = answer; + this.hidden = hidden; + this.attemptTime = attemptTime; + this.timezone = timezone; + this.qaQueContent = qaQueContent; + this.qaQueUser = qaQueUser; + } - public QaUsrResp(String answer, - boolean hidden, - Date attemptTime, - String timezone, - QaQueContent qaQueContent, - QaQueUsr qaQueUser, - boolean visible) { + public QaUsrResp(String answer, boolean hidden, Date attemptTime, String timezone, QaQueContent qaQueContent, + QaQueUsr qaQueUser, boolean visible) { this.answer = answer; this.hidden = hidden; this.attemptTime = attemptTime; this.timezone = timezone; this.qaQueContent = qaQueContent; this.qaQueUser = qaQueUser; - this.visible=visible; -} + this.visible = visible; + } - - public QaUsrResp(String answer, - boolean hidden, - Date attemptTime, - String timezone, - QaQueContent qaQueContent, - Long qaQueUsrUid) { - this.answer = answer; - this.hidden = hidden; - this.attemptTime = attemptTime; - this.timezone = timezone; - this.qaQueContent = qaQueContent; - this.queUsrId = qaQueUsrUid; + public QaUsrResp(String answer, boolean hidden, Date attemptTime, String timezone, QaQueContent qaQueContent, + Long qaQueUsrUid) { + this.answer = answer; + this.hidden = hidden; + this.attemptTime = attemptTime; + this.timezone = timezone; + this.qaQueContent = qaQueContent; + this.queUsrId = qaQueUsrUid; } - - - public QaUsrResp(String answer, - Date attemptTime, - QaQueContent question) - { - this.answer = answer; - this.attemptTime = attemptTime; - this.qaQueContent = question; + + public QaUsrResp(String answer, Date attemptTime, QaQueContent question) { + this.answer = answer; + this.attemptTime = attemptTime; + this.qaQueContent = question; } /** default constructor */ - public QaUsrResp(){} - + public QaUsrResp() { + } + /** * Copy construtor. Delegate to full construtor to achieve the object * creation. - * @param response the original survey user response + * + * @param response + * the original survey user response * @return the new qa user response cloned from original object */ - public static QaUsrResp newInstance(QaUsrResp response) - { - return new QaUsrResp(response.getResponseId(), - response.getAnswer(), - response.isHidden(), - response.getAttemptTime(), - response.getTimezone(), - response.getQaQueContent(), - response.qaQueUser); + public static QaUsrResp newInstance(QaUsrResp response) { + return new QaUsrResp(response.getResponseId(), response.getAnswer(), response.isHidden(), response + .getAttemptTime(), response.getTimezone(), response.getQaQueContent(), response.qaQueUser); } - - public String toString() { - return new ToStringBuilder(this) - .append("responseId: ", getResponseId()) - .append("answer:", getAnswer()) - .append("attempt time: ", getAttemptTime()) - .toString(); + return new ToStringBuilder(this).append("responseId: ", getResponseId()).append("answer:", getAnswer()).append( + "attempt time: ", getAttemptTime()).toString(); } public boolean equals(Object other) { - if ( !(other instanceof QaUsrResp) ) return false; - QaUsrResp castOther = (QaUsrResp) other; - return new EqualsBuilder() - .append(this.getResponseId(), castOther.getResponseId()) - .isEquals(); + if (!(other instanceof QaUsrResp)) + return false; + QaUsrResp castOther = (QaUsrResp) other; + return new EqualsBuilder().append(this.getResponseId(), castOther.getResponseId()).isEquals(); } public int hashCode() { - return new HashCodeBuilder() - .append(getResponseId()) - .toHashCode(); + return new HashCodeBuilder().append(getResponseId()).toHashCode(); } - /** - * @return Returns the answer. - */ - public String getAnswer() { - return answer; - } - /** - * @param answer The answer to set. - */ - public void setAnswer(String answer) { - this.answer = answer; - } - /** - * @return Returns the attemptTime. - */ - public Date getAttemptTime() { - return attemptTime; - } - /** - * @param attemptTime The attemptTime to set. - */ - public void setAttemptTime(Date attemptTime) { - this.attemptTime = attemptTime; - } - /** - * @return Returns the qaQueContent. - */ - public QaQueContent getQaQueContent() { - return qaQueContent; - } - /** - * @param qaQueContent The qaQueContent to set. - */ - public void setQaQueContent(QaQueContent qaQueContent) { - this.qaQueContent = qaQueContent; - } - /** - * @return Returns the qaQueUsr. - */ - public QaQueUsr getQaQueUser() { - return qaQueUser; - } - /** - * @param qaQueUsr The qaQueUsr to set. - */ - public void setQaQueUser(QaQueUsr qaQueUser) { - this.qaQueUser = qaQueUser; - } - /** - * @return Returns the responseId. - */ - public Long getResponseId() { - return responseId; - } - /** - * @param responseId The responseId to set. - */ - public void setResponseId(Long responseId) { - this.responseId = responseId; - } - - - /** + /** + * @return Returns the answer. + */ + public String getAnswer() { + return answer; + } + + /** + * @param answer + * The answer to set. + */ + public void setAnswer(String answer) { + this.answer = answer; + } + + /** + * @return Returns the attemptTime. + */ + public Date getAttemptTime() { + return attemptTime; + } + + /** + * @param attemptTime + * The attemptTime to set. + */ + public void setAttemptTime(Date attemptTime) { + this.attemptTime = attemptTime; + } + + /** + * @return Returns the qaQueContent. + */ + public QaQueContent getQaQueContent() { + return qaQueContent; + } + + /** + * @param qaQueContent + * The qaQueContent to set. + */ + public void setQaQueContent(QaQueContent qaQueContent) { + this.qaQueContent = qaQueContent; + } + + /** + * @return Returns the qaQueUsr. + */ + public QaQueUsr getQaQueUser() { + return qaQueUser; + } + + /** + * @param qaQueUsr + * The qaQueUsr to set. + */ + public void setQaQueUser(QaQueUsr qaQueUser) { + this.qaQueUser = qaQueUser; + } + + /** + * @return Returns the responseId. + */ + public Long getResponseId() { + return responseId; + } + + /** + * @param responseId + * The responseId to set. + */ + public void setResponseId(Long responseId) { + this.responseId = responseId; + } + + /** * @param responses * @return */ - public boolean doesRespExistIn(List responses) - { - for(Iterator i = responses.iterator();i.hasNext();) - { - QaUsrResp resp = (QaUsrResp)i.next(); - if((resp.getAnswer().trim()).equals(this.getAnswer().trim()) - &&resp.getQaQueUser().getQueUsrId()==this.getQaQueUser().getQueUsrId()) - return true; - } - return false; + public boolean doesRespExistIn(List responses) { + for (Iterator i = responses.iterator(); i.hasNext();) { + QaUsrResp resp = (QaUsrResp) i.next(); + if ((resp.getAnswer().trim()).equals(this.getAnswer().trim()) + && resp.getQaQueUser().getQueUsrId() == this.getQaQueUser().getQueUsrId()) + return true; + } + return false; } - - + /** * @param responses */ - public void updateResponseBy(List responses) - { - for(Iterator i = responses.iterator();i.hasNext();) - { - QaUsrResp resp = (QaUsrResp)i.next(); - if(resp.getQaQueUser().getQueUsrId()==this.getQaQueUser().getQueUsrId()) -// && resp.getQaAnsContent().getDisplayOrder()==this.getQaAnsContent().getDisplayOrder()) - this.updateResponse(resp); + public void updateResponseBy(List responses) { + for (Iterator i = responses.iterator(); i.hasNext();) { + QaUsrResp resp = (QaUsrResp) i.next(); + if (resp.getQaQueUser().getQueUsrId() == this.getQaQueUser().getQueUsrId()) + // && resp.getQaAnsContent().getDisplayOrder()==this.getQaAnsContent().getDisplayOrder()) + this.updateResponse(resp); - } + } } /** - * The response is not valid if it doesn't have a reference to question + * The response is not valid if it doesn't have a reference to question * object and question user object. - * @param resp the response to be validated + * + * @param resp + * the response to be validated * @return the validation result. */ - public boolean isResponseValid() - { - return this.getQaQueUser()!=null && this.getQaQueContent()!=null; - // &&this.getQaAnsContent()!=null; + public boolean isResponseValid() { + return this.getQaQueUser() != null && this.getQaQueContent() != null; + // &&this.getQaAnsContent()!=null; } - - + /** * Update current object according to the new response object. + * * @param resp */ - public void updateResponse(QaUsrResp resp) - { - if(!resp.isResponseValid()) - throw new IllegalArgumentException("Invalid response for update "); - - this.setAnswer(resp.getAnswer()); - this.setAttemptTime(resp.getAttemptTime()); - this.setQaQueContent(resp.getQaQueContent()); + public void updateResponse(QaUsrResp resp) { + if (!resp.isResponseValid()) + throw new IllegalArgumentException("Invalid response for update "); - this.setQaQueUser(resp.getQaQueUser()); - + this.setAnswer(resp.getAnswer()); + this.setAttemptTime(resp.getAttemptTime()); + this.setQaQueContent(resp.getQaQueContent()); + + this.setQaQueUser(resp.getQaQueUser()); + } - - + /** - * Validate whether the current response is correspondent to an author + * Validate whether the current response is correspondent to an author * defined answer. * * @return boolean value */ - public boolean isPredefinedResponse() - { - //may need to add more logic here - return false; + public boolean isPredefinedResponse() { + //may need to add more logic here + return false; } - - - public int compareTo(Object o) - { - QaUsrResp response = (QaUsrResp) o; - if (responseId == null) - return -1; - if (response.responseId == null) - return 1; + public int compareTo(Object o) { + QaUsrResp response = (QaUsrResp) o; - return (int) (responseId.longValue() - response.responseId.longValue()); + if (responseId == null) + return -1; + if (response.responseId == null) + return 1; + + return (int) (responseId.longValue() - response.responseId.longValue()); } - - - /** - * @return Returns the qaQueContentId. - */ - public Long getQaQueContentId() { - return qaQueContentId; - } - /** - * @param qaQueContentId The qaQueContentId to set. - */ - public void setQaQueContentId(Long qaQueContentId) { - this.qaQueContentId = qaQueContentId; - } - /** - * @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 hidden. - */ - public boolean isHidden() { - return hidden; - } - /** - * @param hidden The hidden to set. - */ - public void setHidden(boolean hidden) { - this.hidden = hidden; - } - - /** - * @return Returns the timezone. - */ - public String getTimezone() { - return timezone; - } - /** - * @param timezone The timezone to set. - */ - public void setTimezone(String timezone) { - this.timezone = timezone; - } - /** + * @return Returns the qaQueContentId. + */ + public Long getQaQueContentId() { + return qaQueContentId; + } + + /** + * @param qaQueContentId + * The qaQueContentId to set. + */ + public void setQaQueContentId(Long qaQueContentId) { + this.qaQueContentId = qaQueContentId; + } + + /** + * @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 hidden. + */ + public boolean isHidden() { + return hidden; + } + + /** + * @param hidden + * The hidden to set. + */ + public void setHidden(boolean hidden) { + this.hidden = hidden; + } + + /** + * @return Returns the timezone. + */ + public String getTimezone() { + return timezone; + } + + /** + * @param timezone + * The timezone to set. + */ + public void setTimezone(String timezone) { + this.timezone = timezone; + } + + /** * @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_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaUtils.java,v diff -u -r1.57 -r1.58 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java 26 Nov 2006 22:25:37 -0000 1.57 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java 19 Feb 2009 04:25:01 -0000 1.58 @@ -20,7 +20,7 @@ * http://www.gnu.org/licenses/gpl.txt * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; import java.text.DateFormat; @@ -44,566 +44,526 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ /** - * Common utility functions live here. + * Common utility functions live here. */ public abstract class QaUtils implements QaAppConstants { - static Logger logger = Logger.getLogger(QaUtils.class.getName()); - + static Logger logger = Logger.getLogger(QaUtils.class.getName()); + /** - * setDefaultSessionAttributes(HttpServletRequest request, QaContent defaultQaContent, QaAuthoringForm qaAuthoringForm) + * setDefaultSessionAttributes(HttpServletRequest request, QaContent + * defaultQaContent, QaAuthoringForm qaAuthoringForm) * * @param request * @param defaultQaContent * @param qaAuthoringForm */ - public static void populateAuthoringDTO(HttpServletRequest request, QaContent defaultQaContent, - QaGeneralAuthoringDTO qaGeneralAuthoringDTO) - { - qaGeneralAuthoringDTO.setActivityTitle(defaultQaContent.getTitle()); - qaGeneralAuthoringDTO.setActivityInstructions(defaultQaContent.getInstructions()); - - qaGeneralAuthoringDTO.setOnlineInstructions(defaultQaContent.getOnlineInstructions()); - qaGeneralAuthoringDTO.setOfflineInstructions(defaultQaContent.getOfflineInstructions()); + public static void populateAuthoringDTO(HttpServletRequest request, QaContent defaultQaContent, + QaGeneralAuthoringDTO qaGeneralAuthoringDTO) { + qaGeneralAuthoringDTO.setActivityTitle(defaultQaContent.getTitle()); + qaGeneralAuthoringDTO.setActivityInstructions(defaultQaContent.getInstructions()); + + qaGeneralAuthoringDTO.setOnlineInstructions(defaultQaContent.getOnlineInstructions()); + qaGeneralAuthoringDTO.setOfflineInstructions(defaultQaContent.getOfflineInstructions()); + } + + public static String replaceNewLines(String text) { + logger.debug("using text: " + text); + String newText = ""; + if (text != null) { + newText = text.replaceAll("\n", "
    "); + logger.debug("newText: " + newText); } - - - public static String replaceNewLines(String text) - { - logger.debug("using text: " + text); - String newText = ""; - if (text != null) - { - newText = text.replaceAll("\n","
    "); - logger.debug("newText: " + newText); - } - - return newText; + + return newText; } - - - - public static void setFormProperties(HttpServletRequest request, IQaService qaService, - QaAuthoringForm qaAuthoringForm, QaGeneralAuthoringDTO qaGeneralAuthoringDTO, String strToolContentID, String defaultContentIdStr, - String activeModule, SessionMap sessionMap, String httpSessionID) - { - logger.debug("setFormProperties: "); - logger.debug("using strToolContentID: " + strToolContentID); - logger.debug("using defaultContentIdStr: " + defaultContentIdStr); - logger.debug("using activeModule: " + activeModule); - logger.debug("using httpSessionID: " + httpSessionID); - qaAuthoringForm.setHttpSessionID(httpSessionID); - qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID); - - qaAuthoringForm.setToolContentID(strToolContentID); - - if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0)) - qaAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString()); - - qaAuthoringForm.setActiveModule(activeModule); - qaGeneralAuthoringDTO.setActiveModule(activeModule); - - String synchInMonitor=request.getParameter(SYNC_IN_MONITOR); - logger.debug("synchInMonitor: " + synchInMonitor); - qaAuthoringForm.setSynchInMonitor(synchInMonitor); - qaGeneralAuthoringDTO.setSynchInMonitor(synchInMonitor); - - String usernameVisible=request.getParameter(USERNAME_VISIBLE); - logger.debug("usernameVisible: " + usernameVisible); - qaAuthoringForm.setUsernameVisible(usernameVisible); - qaGeneralAuthoringDTO.setUsernameVisible(usernameVisible); - + public static void setFormProperties(HttpServletRequest request, IQaService qaService, + QaAuthoringForm qaAuthoringForm, QaGeneralAuthoringDTO qaGeneralAuthoringDTO, String strToolContentID, + String defaultContentIdStr, String activeModule, SessionMap sessionMap, String httpSessionID) { + logger.debug("setFormProperties: "); + logger.debug("using strToolContentID: " + strToolContentID); + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + logger.debug("using activeModule: " + activeModule); + logger.debug("using httpSessionID: " + httpSessionID); - String showOtherAnswers=request.getParameter("showOtherAnswers"); - logger.debug("showOtherAnswers: " + showOtherAnswers); - qaAuthoringForm.setShowOtherAnswers(showOtherAnswers); - qaGeneralAuthoringDTO.setShowOtherAnswers(showOtherAnswers); - - - String questionsSequenced=request.getParameter(QUESTIONS_SEQUENCED); - logger.debug("questionsSequenced: " + questionsSequenced); - qaAuthoringForm.setQuestionsSequenced(questionsSequenced); - qaGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced); - + qaAuthoringForm.setHttpSessionID(httpSessionID); + qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID); - String lockWhenFinished=request.getParameter("lockWhenFinished"); - logger.debug("lockWhenFinished: " + lockWhenFinished); - qaAuthoringForm.setLockWhenFinished(lockWhenFinished); - qaGeneralAuthoringDTO.setLockWhenFinished(lockWhenFinished); - - - String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); - logger.debug("offlineInstructions: " + offlineInstructions); - qaAuthoringForm.setOfflineInstructions(offlineInstructions); - qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + qaAuthoringForm.setToolContentID(strToolContentID); - String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); - logger.debug("onlineInstructions: " + onlineInstructions); - qaAuthoringForm.setOnlineInstructions(onlineInstructions); - qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0)) + qaAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString()); - String reflect=request.getParameter(REFLECT); - logger.debug("reflect: " + reflect); - qaAuthoringForm.setReflect(reflect); - qaGeneralAuthoringDTO.setReflect(reflect); - + qaAuthoringForm.setActiveModule(activeModule); + qaGeneralAuthoringDTO.setActiveModule(activeModule); - String reflectionSubject=request.getParameter(REFLECTION_SUBJECT); - logger.debug("reflectionSubject: " + reflectionSubject); - qaAuthoringForm.setReflectionSubject(reflectionSubject); - qaGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); - - logger.debug("ending setFormProperties with qaAuthoringForm: " + qaAuthoringForm); - logger.debug("ending setFormProperties with qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + String synchInMonitor = request.getParameter(SYNC_IN_MONITOR); + logger.debug("synchInMonitor: " + synchInMonitor); + qaAuthoringForm.setSynchInMonitor(synchInMonitor); + qaGeneralAuthoringDTO.setSynchInMonitor(synchInMonitor); + + String usernameVisible = request.getParameter(USERNAME_VISIBLE); + logger.debug("usernameVisible: " + usernameVisible); + qaAuthoringForm.setUsernameVisible(usernameVisible); + qaGeneralAuthoringDTO.setUsernameVisible(usernameVisible); + + String showOtherAnswers = request.getParameter("showOtherAnswers"); + logger.debug("showOtherAnswers: " + showOtherAnswers); + qaAuthoringForm.setShowOtherAnswers(showOtherAnswers); + qaGeneralAuthoringDTO.setShowOtherAnswers(showOtherAnswers); + + String questionsSequenced = request.getParameter(QUESTIONS_SEQUENCED); + logger.debug("questionsSequenced: " + questionsSequenced); + qaAuthoringForm.setQuestionsSequenced(questionsSequenced); + qaGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced); + + String lockWhenFinished = request.getParameter("lockWhenFinished"); + logger.debug("lockWhenFinished: " + lockWhenFinished); + qaAuthoringForm.setLockWhenFinished(lockWhenFinished); + qaGeneralAuthoringDTO.setLockWhenFinished(lockWhenFinished); + + String offlineInstructions = request.getParameter(OFFLINE_INSTRUCTIONS); + logger.debug("offlineInstructions: " + offlineInstructions); + qaAuthoringForm.setOfflineInstructions(offlineInstructions); + qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + String onlineInstructions = request.getParameter(ONLINE_INSTRUCTIONS); + logger.debug("onlineInstructions: " + onlineInstructions); + qaAuthoringForm.setOnlineInstructions(onlineInstructions); + qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String reflect = request.getParameter(REFLECT); + logger.debug("reflect: " + reflect); + qaAuthoringForm.setReflect(reflect); + qaGeneralAuthoringDTO.setReflect(reflect); + + String reflectionSubject = request.getParameter(REFLECTION_SUBJECT); + logger.debug("reflectionSubject: " + reflectionSubject); + qaAuthoringForm.setReflectionSubject(reflectionSubject); + qaGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); + + logger.debug("ending setFormProperties with qaAuthoringForm: " + qaAuthoringForm); + logger.debug("ending setFormProperties with qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); } - - public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException - { - HttpSession ss = SessionManager.getSession(); - /* get back login user DTO */ - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - logger.debug(logger + " " + "QaUtils" + " Current user is: " + user + " with id: " + user.getUserID()); - return user.getUserID().intValue(); + public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException { + HttpSession ss = SessionManager.getSession(); + /* get back login user DTO */ + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug(logger + " " + "QaUtils" + " Current user is: " + user + " with id: " + user.getUserID()); + return user.getUserID().intValue(); } - - - /** - * existsContent(long toolContentID) - * @param long toolContentID - * @return boolean - * determine whether a specific toolContentID exists in the db - */ - public static boolean existsContent(long toolContentID, IQaService qaService) - { - QaContent qaContent=qaService.loadQa(toolContentID); - logger.debug(logger + " " + "QaUtils " + "retrieving qaContent: " + qaContent); - if (qaContent == null) - return false; - - return true; - } - /** - * 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 toolContentID, IQaService qaService) - { - logger.debug("existsSession"); - QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolContentID); - logger.debug("qaSession:" + qaSession); - - if (qaSession == null) - return false; - - return true; - } - + /** + * existsContent(long toolContentID) + * + * @param long + * toolContentID + * @return boolean determine whether a specific toolContentID exists in the + * db + */ + public static boolean existsContent(long toolContentID, IQaService qaService) { + QaContent qaContent = qaService.loadQa(toolContentID); + logger.debug(logger + " " + "QaUtils " + "retrieving qaContent: " + qaContent); + if (qaContent == null) + return false; - public static String getFormattedDateString(Date date) - { - logger.debug(logger + " " + " QaUtils getFormattedDateString: " + - DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); - return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); - } + return true; + } - public static void configureContentRepository(HttpServletRequest request, IQaService qaService) - { - logger.debug("attempt configureContentRepository"); - logger.debug("qaService: " + qaService); - logger.debug("calling configureContentRepository()"); - qaService.configureContentRepository(); - logger.debug("configureContentRepository ran successfully"); - } - - - /** 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 ) { + /** + * 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 toolContentID, IQaService qaService) { + logger.debug("existsSession"); + QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolContentID); + logger.debug("qaSession:" + qaSession); - List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); - - if ( attachmentsList != null ) { - Iterator iter = attachmentsList.iterator(); - QaUploadedFile attachment = null; - while ( iter.hasNext() && attachment == null ) { - QaUploadedFile value = (QaUploadedFile) iter.next(); - if ( uuid.equals(value.getUuid()) ) { - attachment = value; - } + if (qaSession == null) + return false; - } - if ( attachment != null ) { - deletedList.add(attachment); - attachmentsList.remove(attachment); - } - } - - return deletedList; + return true; } - - - /** 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 filename, boolean isOnline, List attachmentsList, List deletedAttachmentsList ) { - List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); - - if ( attachmentsList != null ) { - Iterator iter = attachmentsList.iterator(); - QaUploadedFile attachment = null; - while ( iter.hasNext() && attachment == null ) { - QaUploadedFile value = (QaUploadedFile) iter.next(); - if ( filename.equals(value.getFileName()) && isOnline == value.isFileOnline()) { - attachment = value; - } + public static String getFormattedDateString(Date date) { + logger.debug(logger + " " + " QaUtils getFormattedDateString: " + + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); + return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); + } - } - if ( attachment != null ) { - deletedList.add(attachment); - attachmentsList.remove(attachment); - } - } - - return deletedList; + public static void configureContentRepository(HttpServletRequest request, IQaService qaService) { + logger.debug("attempt configureContentRepository"); + logger.debug("qaService: " + qaService); + logger.debug("calling configureContentRepository()"); + qaService.configureContentRepository(); + logger.debug("configureContentRepository ran successfully"); } - - - /** - * 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(QaContent qaContent) - * - * @param qaContent - * @return boolean - */ - public static boolean isRunOffline(QaContent qaContent) - { - logger.debug("is run offline: " + qaContent.isRunOffline()); - return qaContent.isRunOffline(); - } - - /** - * 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 QaComparator()); - logger.debug("listType: " + listType); - - Iterator listIterator=sessionsList.iterator(); - Long mapIndex=new Long(1); - - - while (listIterator.hasNext()) - { - if (listType.equals("String")) - { - logger.debug("listType String"); - String text=(String)listIterator.next(); - map.put(mapIndex.toString(), text); - } - else if (listType.equals("Long")) - { - logger.debug("listType Long"); - Long LongValue=(Long)listIterator.next(); - map.put(mapIndex.toString(), LongValue.toString()); - } - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; - } - - public static boolean isContentInUse(QaContent qaContent) - { - logger.debug("is content inuse: " + qaContent.isContentLocked()); - return qaContent.isContentLocked(); - } - /** - * the only attributes kept are TOOL_SESSION and TOOL_CONTENT_ID - * and - * ACTIVITY_TITLE - ACTIVITY_INSTRUCTIONS - * cleanUpSessionAbsolute(HttpServletRequest request) - * @param request - */ - public static void cleanUpSessionAbsolute(HttpServletRequest request) - { - request.getSession().removeAttribute(MY_SIGNATURE); - request.getSession().removeAttribute(ERROR_QAAPPLICATION); - request.getSession().removeAttribute(TARGET_MODE); - request.getSession().removeAttribute(TARGET_MODE_AUTHORING); - request.getSession().removeAttribute(TARGET_MODE_LEARNING); - request.getSession().removeAttribute(TARGET_MODE_MONITORING); - request.getSession().removeAttribute(TARGET_MODE_EXPORT_PORTFOLIO); - request.getSession().removeAttribute(AUTHORING_STARTER); - request.getSession().removeAttribute(LOAD_LEARNER); - request.getSession().removeAttribute(LEARNING_STARTER); - request.getSession().removeAttribute(MONITORING_STARTER); - request.getSession().removeAttribute(LOAD_MONITORING); - request.getSession().removeAttribute(EDIT_RESPONSE); - request.getSession().removeAttribute(EDITABLE_RESPONSE_ID); - request.getSession().removeAttribute(COPY_TOOL_CONTENT); - request.getSession().removeAttribute(ERROR_LIST); - request.getSession().removeAttribute(ERROR_LIST_LEARNER); - request.getSession().removeAttribute(DEFAULT_CONTENT_ID_STR); - request.getSession().removeAttribute(TOOL_SESSION_ID); - request.getSession().removeAttribute(LOAD); - request.getSession().removeAttribute(LOAD_QUESTIONS); - request.getSession().removeAttribute(LOAD_STARTER); - request.getSession().removeAttribute(IS_DEFINE_LATER); - request.getSession().removeAttribute(LEARNING_MODE); - request.getSession().removeAttribute(IS_ADD_QUESTION); - request.getSession().removeAttribute(IS_REMOVE_QUESTION); - request.getSession().removeAttribute(IS_REMOVE_CONTENT); - request.getSession().removeAttribute(SELECTION_CASE); - request.getSession().removeAttribute(MAP_QUESTION_CONTENT); - request.getSession().removeAttribute(DEFAULT_QUESTION_CONTENT); - request.getSession().removeAttribute(ONLINE_INSTRUCTIONS); - request.getSession().removeAttribute(OFFLINE_INSTRUCTIONS); - request.getSession().removeAttribute(END_LEARNING_MESSSAGE); - request.getSession().removeAttribute(ON); - request.getSession().removeAttribute(OFF); - request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS); - request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS); - request.getSession().removeAttribute(RICHTEXT_TITLE); - request.getSession().removeAttribute(RICHTEXT_INSTRUCTIONS); - request.getSession().removeAttribute(RICHTEXT_BLANK); - request.getSession().removeAttribute(SUBMIT_OFFLINE_FILE); - request.getSession().removeAttribute(SUBMIT_ONLINE_FILE); - request.getSession().removeAttribute(POPULATED_UPLOADED_FILESDATA); - request.getSession().removeAttribute(USER_ID); - request.getSession().removeAttribute(NOT_ATTEMPTED); - request.getSession().removeAttribute(INCOMPLETE); - request.getSession().removeAttribute(COMPLETED); - request.getSession().removeAttribute(MAP_TOOL_SESSIONS); - request.getSession().removeAttribute(MAX_TOOL_SESSION_COUNT.toString()); - request.getSession().removeAttribute(IS_TOOL_SESSION_CHANGED); - request.getSession().removeAttribute(COUNT_SESSION_COMPLETE); - request.getSession().removeAttribute(CURRENT_MONITORED_TOOL_SESSION); - request.getSession().removeAttribute(COUNT_ALL_USERS); - request.getSession().removeAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO); - request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS); - request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS_ID); - request.getSession().removeAttribute(MODE); - request.getSession().removeAttribute(LEARNER); - request.getSession().removeAttribute(TEACHER); - request.getSession().removeAttribute(PORTFOLIO_REPORT); - request.getSession().removeAttribute(PORTFOLIO_REQUEST); - request.getSession().removeAttribute(ADD_NEW_QUESTION); - request.getSession().removeAttribute(REMOVE_QUESTION); - request.getSession().removeAttribute(REMOVE_ALL_CONTENT); - request.getSession().removeAttribute(SUBMIT_ALL_CONTENT); - request.getSession().removeAttribute(SUBMIT_TAB_DONE); - request.getSession().removeAttribute(OPTION_OFF); - request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER); - request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); - request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); - request.getSession().removeAttribute(TOTAL_QUESTION_COUNT); - request.getSession().removeAttribute(MAP_ANSWERS); - request.getSession().removeAttribute(USER_FEEDBACK); - request.getSession().removeAttribute(REPORT_TITLE); - request.getSession().removeAttribute(MONITORING_REPORT_TITLE); - request.getSession().removeAttribute(REPORT_TITLE_LEARNER); - request.getSession().removeAttribute(END_LEARNING_MESSAGE); - request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE); - request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED); - request.getSession().removeAttribute(FROM_TOOL_CONTENT_ID); - request.getSession().removeAttribute(TO_TOOL_CONTENT_ID); - request.getSession().removeAttribute(LEARNER_REPORT); - request.getSession().removeAttribute(EDITACTIVITY_EDITMODE); - request.getSession().removeAttribute(RENDER_MONITORING_EDITACTIVITY); - request.getSession().removeAttribute(NO_AVAILABLE_SESSIONS); - request.getSession().removeAttribute(NO_TOOL_SESSIONS_AVAILABLE); - request.getSession().removeAttribute(TIMEZONE); - request.getSession().removeAttribute(TIMEZONE_ID); - request.getSession().removeAttribute(QUESTION_LISTING_MODE); - request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL); - request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); - request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); - request.getSession().removeAttribute(FEEDBACK_TYPE_SEQUENTIAL); - request.getSession().removeAttribute(FEEDBACK_TYPE_COMBINED); - request.getSession().removeAttribute(QUESTIONS); - request.getSession().removeAttribute(ATTACHMENT_LIST); - request.getSession().removeAttribute(SUBMIT_SUCCESS); - request.getSession().removeAttribute(DELETED_ATTACHMENT_LIST); - request.getSession().removeAttribute(UUID); - request.getSession().removeAttribute(IS_USERNAME_VISIBLE); - request.getSession().removeAttribute(CURRENT_ANSWER); - request.getSession().removeAttribute(ACTIVE_MODULE); - request.getSession().removeAttribute(AUTHORING); - request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE); - request.getSession().removeAttribute(SHOW_AUTHORING_TABS); - request.getSession().removeAttribute(DEFINE_LATER); - request.getSession().removeAttribute(SOURCE_MC_STARTER); - request.getSession().removeAttribute(IS_MONITORED_CONTENT_IN_USE); - request.getSession().removeAttribute(LOAD_MONITORING_CONTENT_EDITACTIVITY); - request.getSession().removeAttribute(MONITORING_ORIGINATED_DEFINELATER); - request.getSession().removeAttribute(REQUEST_LEARNING_REPORT); - request.getSession().removeAttribute(REQUEST_LEARNING_REPORT_VIEWONLY); - request.getSession().removeAttribute(REQUEST_PREVIEW); - request.getSession().removeAttribute(REQUEST_LEARNING_REPORT_PROGRESS); - - request.getSession().removeAttribute(USER_EXCEPTION_WRONG_FORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_UNCOMPATIBLE_IDS); - request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_USER_DOESNOTEXIST); - //request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST); - request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_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_MONITORINGTAB_CONTENTID_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP); - request.getSession().removeAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS); - request.getSession().removeAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY); - request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_IN_USE); - request.getSession().removeAttribute(USER_EXCEPTION_MODE_REQUIRED); - request.getSession().removeAttribute(USER_EXCEPTION_RUN_OFFLINE); - request.getSession().removeAttribute(USER_EXCEPTION_MODE_INVALID); - request.getSession().removeAttribute(USER_EXCEPTION_QUESTIONS_DUPLICATE); + /** + * 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(); + QaUploadedFile attachment = null; + while (iter.hasNext() && attachment == null) { + QaUploadedFile value = (QaUploadedFile) iter.next(); + if (uuid.equals(value.getUuid())) { + attachment = value; + } + + } + if (attachment != null) { + deletedList.add(attachment); + attachmentsList.remove(attachment); + } } - - /** - * setDefineLater(HttpServletRequest request, boolean value, String toolContentID) - * @param request - * @param value - * @param toolContentID - */ - public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, IQaService qaService) - { - logger.debug("qaService: " + qaService); - logger.debug("value:" + value); - logger.debug("strToolContentID:" + strToolContentID); - - QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue()); - logger.debug("qaContent:" + qaContent); - if (qaContent != null) - { - qaContent.setDefineLater(value); - logger.debug("defineLater has been set to:" + value); - qaService.updateQa(qaContent); - } + return deletedList; } - - /** - * determines the struts level location to return - * @param sourceMcStarter - * @param requestedModule - * @return - */ - public static String getDestination(String sourceMcStarter, String requestedModule) - { - logger.debug("sourceMcStarter: " + sourceMcStarter + " and requestedModule:" + requestedModule); - - if (requestedModule.equals(DEFINE_LATER)) - { - logger.debug("request is from define Later url. return to: " + LOAD_VIEW_ONLY); - return LOAD_VIEW_ONLY; + /** + * 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 filename, boolean isOnline, List attachmentsList, List deletedAttachmentsList) { + + List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); + + if (attachmentsList != null) { + Iterator iter = attachmentsList.iterator(); + QaUploadedFile attachment = null; + while (iter.hasNext() && attachment == null) { + QaUploadedFile value = (QaUploadedFile) iter.next(); + if (filename.equals(value.getFileName()) && isOnline == value.isFileOnline()) { + attachment = value; } - else if (requestedModule.equals(AUTHORING)) - { - logger.debug("request is from authoring url. return to: " + LOAD_QUESTIONS); - return LOAD_QUESTIONS; - } - else - { - logger.debug("request is from an unknown source. return null"); - return null; - } + + } + if (attachment != null) { + deletedList.add(attachment); + attachmentsList.remove(attachment); + } } - - public static void setDefineLater(HttpServletRequest request, boolean value, IQaService qaService, String toolContentID) - { - logger.debug("qaService:" + qaService); - logger.debug("toolContentID:" + toolContentID); - - QaContent qaContent=qaService.loadQa(new Long(toolContentID).longValue()); - logger.debug("qaContent:" + qaContent); - if (qaContent != null) - { - qaContent.setDefineLater(value); - logger.debug("defineLater has been set to true"); - qaService.updateQa(qaContent); - } + + return deletedList; } + /** + * 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(QaContent qaContent) + * + * @param qaContent + * @return boolean + */ + public static boolean isRunOffline(QaContent qaContent) { + logger.debug("is run offline: " + qaContent.isRunOffline()); + return qaContent.isRunOffline(); + } - public static String getCurrentLearnerID() - { - String userID = ""; - HttpSession ss = SessionManager.getSession(); - logger.debug("ss: " + ss); - - if (ss != null) - { - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - if ((user != null) && (user.getUserID() != null)) - { - userID = user.getUserID().toString(); - logger.debug("retrieved userId: " + userID); - } - } - return userID; + /** + * 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 QaComparator()); + logger.debug("listType: " + listType); + + Iterator listIterator = sessionsList.iterator(); + Long mapIndex = new Long(1); + + while (listIterator.hasNext()) { + if (listType.equals("String")) { + logger.debug("listType String"); + String text = (String) listIterator.next(); + map.put(mapIndex.toString(), text); + } else if (listType.equals("Long")) { + logger.debug("listType Long"); + Long LongValue = (Long) listIterator.next(); + map.put(mapIndex.toString(), LongValue.toString()); + } + mapIndex = new Long(mapIndex.longValue() + 1); + } + return map; } - - - 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); - logger.debug("retrieving toolUser: " + toolUser); - return toolUser; + + public static boolean isContentInUse(QaContent qaContent) { + logger.debug("is content inuse: " + qaContent.isContentLocked()); + return qaContent.isContentLocked(); + } + + /** + * the only attributes kept are TOOL_SESSION and TOOL_CONTENT_ID and + * ACTIVITY_TITLE ACTIVITY_INSTRUCTIONS + * cleanUpSessionAbsolute(HttpServletRequest request) + * + * @param request + */ + public static void cleanUpSessionAbsolute(HttpServletRequest request) { + request.getSession().removeAttribute(MY_SIGNATURE); + request.getSession().removeAttribute(ERROR_QAAPPLICATION); + request.getSession().removeAttribute(TARGET_MODE); + request.getSession().removeAttribute(TARGET_MODE_AUTHORING); + request.getSession().removeAttribute(TARGET_MODE_LEARNING); + request.getSession().removeAttribute(TARGET_MODE_MONITORING); + request.getSession().removeAttribute(TARGET_MODE_EXPORT_PORTFOLIO); + request.getSession().removeAttribute(AUTHORING_STARTER); + request.getSession().removeAttribute(LOAD_LEARNER); + request.getSession().removeAttribute(LEARNING_STARTER); + request.getSession().removeAttribute(MONITORING_STARTER); + request.getSession().removeAttribute(LOAD_MONITORING); + request.getSession().removeAttribute(EDIT_RESPONSE); + request.getSession().removeAttribute(EDITABLE_RESPONSE_ID); + request.getSession().removeAttribute(COPY_TOOL_CONTENT); + request.getSession().removeAttribute(ERROR_LIST); + request.getSession().removeAttribute(ERROR_LIST_LEARNER); + request.getSession().removeAttribute(DEFAULT_CONTENT_ID_STR); + request.getSession().removeAttribute(TOOL_SESSION_ID); + request.getSession().removeAttribute(LOAD); + request.getSession().removeAttribute(LOAD_QUESTIONS); + request.getSession().removeAttribute(LOAD_STARTER); + request.getSession().removeAttribute(IS_DEFINE_LATER); + request.getSession().removeAttribute(LEARNING_MODE); + request.getSession().removeAttribute(IS_ADD_QUESTION); + request.getSession().removeAttribute(IS_REMOVE_QUESTION); + request.getSession().removeAttribute(IS_REMOVE_CONTENT); + request.getSession().removeAttribute(SELECTION_CASE); + request.getSession().removeAttribute(MAP_QUESTION_CONTENT); + request.getSession().removeAttribute(DEFAULT_QUESTION_CONTENT); + request.getSession().removeAttribute(ONLINE_INSTRUCTIONS); + request.getSession().removeAttribute(OFFLINE_INSTRUCTIONS); + request.getSession().removeAttribute(END_LEARNING_MESSSAGE); + request.getSession().removeAttribute(ON); + request.getSession().removeAttribute(OFF); + request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS); + request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS); + request.getSession().removeAttribute(RICHTEXT_TITLE); + request.getSession().removeAttribute(RICHTEXT_INSTRUCTIONS); + request.getSession().removeAttribute(RICHTEXT_BLANK); + request.getSession().removeAttribute(SUBMIT_OFFLINE_FILE); + request.getSession().removeAttribute(SUBMIT_ONLINE_FILE); + request.getSession().removeAttribute(POPULATED_UPLOADED_FILESDATA); + request.getSession().removeAttribute(USER_ID); + request.getSession().removeAttribute(NOT_ATTEMPTED); + request.getSession().removeAttribute(INCOMPLETE); + request.getSession().removeAttribute(COMPLETED); + request.getSession().removeAttribute(MAP_TOOL_SESSIONS); + request.getSession().removeAttribute(MAX_TOOL_SESSION_COUNT.toString()); + request.getSession().removeAttribute(IS_TOOL_SESSION_CHANGED); + request.getSession().removeAttribute(COUNT_SESSION_COMPLETE); + request.getSession().removeAttribute(CURRENT_MONITORED_TOOL_SESSION); + request.getSession().removeAttribute(COUNT_ALL_USERS); + request.getSession().removeAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO); + request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS); + request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS_ID); + request.getSession().removeAttribute(MODE); + request.getSession().removeAttribute(LEARNER); + request.getSession().removeAttribute(TEACHER); + request.getSession().removeAttribute(PORTFOLIO_REPORT); + request.getSession().removeAttribute(PORTFOLIO_REQUEST); + request.getSession().removeAttribute(ADD_NEW_QUESTION); + request.getSession().removeAttribute(REMOVE_QUESTION); + request.getSession().removeAttribute(REMOVE_ALL_CONTENT); + request.getSession().removeAttribute(SUBMIT_ALL_CONTENT); + request.getSession().removeAttribute(SUBMIT_TAB_DONE); + request.getSession().removeAttribute(OPTION_OFF); + request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER); + request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); + request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); + request.getSession().removeAttribute(TOTAL_QUESTION_COUNT); + request.getSession().removeAttribute(MAP_ANSWERS); + request.getSession().removeAttribute(USER_FEEDBACK); + request.getSession().removeAttribute(REPORT_TITLE); + request.getSession().removeAttribute(MONITORING_REPORT_TITLE); + request.getSession().removeAttribute(REPORT_TITLE_LEARNER); + request.getSession().removeAttribute(END_LEARNING_MESSAGE); + request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE); + request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED); + request.getSession().removeAttribute(FROM_TOOL_CONTENT_ID); + request.getSession().removeAttribute(TO_TOOL_CONTENT_ID); + request.getSession().removeAttribute(LEARNER_REPORT); + request.getSession().removeAttribute(EDITACTIVITY_EDITMODE); + request.getSession().removeAttribute(RENDER_MONITORING_EDITACTIVITY); + request.getSession().removeAttribute(NO_AVAILABLE_SESSIONS); + request.getSession().removeAttribute(NO_TOOL_SESSIONS_AVAILABLE); + request.getSession().removeAttribute(TIMEZONE); + request.getSession().removeAttribute(TIMEZONE_ID); + request.getSession().removeAttribute(QUESTION_LISTING_MODE); + request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL); + request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); + request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); + request.getSession().removeAttribute(FEEDBACK_TYPE_SEQUENTIAL); + request.getSession().removeAttribute(FEEDBACK_TYPE_COMBINED); + request.getSession().removeAttribute(QUESTIONS); + request.getSession().removeAttribute(ATTACHMENT_LIST); + request.getSession().removeAttribute(SUBMIT_SUCCESS); + request.getSession().removeAttribute(DELETED_ATTACHMENT_LIST); + request.getSession().removeAttribute(UUID); + request.getSession().removeAttribute(IS_USERNAME_VISIBLE); + request.getSession().removeAttribute(CURRENT_ANSWER); + request.getSession().removeAttribute(ACTIVE_MODULE); + request.getSession().removeAttribute(AUTHORING); + request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE); + request.getSession().removeAttribute(SHOW_AUTHORING_TABS); + request.getSession().removeAttribute(DEFINE_LATER); + request.getSession().removeAttribute(SOURCE_MC_STARTER); + request.getSession().removeAttribute(IS_MONITORED_CONTENT_IN_USE); + request.getSession().removeAttribute(LOAD_MONITORING_CONTENT_EDITACTIVITY); + request.getSession().removeAttribute(MONITORING_ORIGINATED_DEFINELATER); + request.getSession().removeAttribute(REQUEST_LEARNING_REPORT); + request.getSession().removeAttribute(REQUEST_LEARNING_REPORT_VIEWONLY); + request.getSession().removeAttribute(REQUEST_PREVIEW); + request.getSession().removeAttribute(REQUEST_LEARNING_REPORT_PROGRESS); + + request.getSession().removeAttribute(USER_EXCEPTION_WRONG_FORMAT); + request.getSession().removeAttribute(USER_EXCEPTION_UNCOMPATIBLE_IDS); + request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); + request.getSession().removeAttribute(USER_EXCEPTION_USER_DOESNOTEXIST); + //request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST); + request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_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_MONITORINGTAB_CONTENTID_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP); + request.getSession().removeAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS); + request.getSession().removeAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY); + request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_IN_USE); + request.getSession().removeAttribute(USER_EXCEPTION_MODE_REQUIRED); + request.getSession().removeAttribute(USER_EXCEPTION_RUN_OFFLINE); + request.getSession().removeAttribute(USER_EXCEPTION_MODE_INVALID); + request.getSession().removeAttribute(USER_EXCEPTION_QUESTIONS_DUPLICATE); + } + + /** + * setDefineLater(HttpServletRequest request, boolean value, String + * toolContentID) + * + * @param request + * @param value + * @param toolContentID + */ + public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, + IQaService qaService) { + logger.debug("qaService: " + qaService); + logger.debug("value:" + value); + logger.debug("strToolContentID:" + strToolContentID); + + QaContent qaContent = qaService.loadQa(new Long(strToolContentID).longValue()); + logger.debug("qaContent:" + qaContent); + if (qaContent != null) { + qaContent.setDefineLater(value); + logger.debug("defineLater has been set to:" + value); + qaService.updateQa(qaContent); } - - - public static Long getUserId() - { - UserDTO toolUser=getToolUser(); - long userId=toolUser.getUserID().longValue(); - logger.debug("userId: " + userId); - return new Long(userId); + } + + /** + * determines the struts level location to return + * + * @param sourceMcStarter + * @param requestedModule + * @return + */ + public static String getDestination(String sourceMcStarter, String requestedModule) { + logger.debug("sourceMcStarter: " + sourceMcStarter + " and requestedModule:" + requestedModule); + + if (requestedModule.equals(DEFINE_LATER)) { + logger.debug("request is from define Later url. return to: " + LOAD_VIEW_ONLY); + return LOAD_VIEW_ONLY; + } else if (requestedModule.equals(AUTHORING)) { + logger.debug("request is from authoring url. return to: " + LOAD_QUESTIONS); + return LOAD_QUESTIONS; + } else { + logger.debug("request is from an unknown source. return null"); + return null; } - - public static String getUserName() - { - /* double check if username and login is the same */ - UserDTO toolUser=getToolUser(); - String userName=toolUser.getLogin(); - logger.debug("userName: " + userName); - return userName; + } + + public static void setDefineLater(HttpServletRequest request, boolean value, IQaService qaService, + String toolContentID) { + logger.debug("qaService:" + qaService); + logger.debug("toolContentID:" + toolContentID); + + QaContent qaContent = qaService.loadQa(new Long(toolContentID).longValue()); + logger.debug("qaContent:" + qaContent); + if (qaContent != null) { + qaContent.setDefineLater(value); + logger.debug("defineLater has been set to true"); + qaService.updateQa(qaContent); } - - public static String getUserFullName() - { - UserDTO toolUser=getToolUser(); - String fullName=toolUser.getFirstName() + " " + toolUser.getLastName(); - logger.debug("fullName: " + fullName); - return fullName; + } + + public static String getCurrentLearnerID() { + String userID = ""; + HttpSession ss = SessionManager.getSession(); + logger.debug("ss: " + ss); + + if (ss != null) { + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user != null) && (user.getUserID() != null)) { + userID = user.getUserID().toString(); + logger.debug("retrieved userId: " + userID); + } } + return userID; + } + 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); + logger.debug("retrieving toolUser: " + toolUser); + return toolUser; + } + + public static Long getUserId() { + UserDTO toolUser = getToolUser(); + long userId = toolUser.getUserID().longValue(); + logger.debug("userId: " + userId); + return new Long(userId); + } + + public static String getUserName() { + /* double check if username and login is the same */ + UserDTO toolUser = getToolUser(); + String userName = toolUser.getLogin(); + logger.debug("userName: " + userName); + return userName; + } + + public static String getUserFullName() { + UserDTO toolUser = getToolUser(); + String fullName = toolUser.getFirstName() + " " + toolUser.getLastName(); + logger.debug("fullName: " + fullName); + return fullName; + } + } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCategory.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCategory.java,v diff -u -r1.2 -r1.3 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCategory.java 4 Nov 2008 05:10:34 -0000 1.2 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCategory.java 19 Feb 2009 04:25:01 -0000 1.3 @@ -112,9 +112,8 @@ if (cognitiveSkills != null) { // create a copy of the skills - for(QaWizardCognitiveSkill skill : cognitiveSkills) - { - QaWizardCognitiveSkill newSkill = (QaWizardCognitiveSkill)skill.clone(); + for (QaWizardCognitiveSkill skill : cognitiveSkills) { + QaWizardCognitiveSkill newSkill = (QaWizardCognitiveSkill) skill.clone(); skills.add(newSkill); } category.setCognitiveSkills(skills); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCognitiveSkill.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCognitiveSkill.java,v diff -u -r1.2 -r1.3 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCognitiveSkill.java 4 Nov 2008 05:10:34 -0000 1.2 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCognitiveSkill.java 19 Feb 2009 04:25:01 -0000 1.3 @@ -118,7 +118,7 @@ return 1; } } - + public Object clone() { QaWizardCognitiveSkill skill = null; @@ -131,9 +131,8 @@ if (questions != null) { // create a copy of the skills - for(QaWizardQuestion question : questions) - { - QaWizardQuestion newQuestion = (QaWizardQuestion)question.clone(); + for (QaWizardQuestion question : questions) { + QaWizardQuestion newQuestion = (QaWizardQuestion) question.clone(); newQuestions.add(newQuestion); } skill.setQuestions(newQuestions); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaWizardDTO.java,v diff -u -r1.1 -r1.2 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardDTO.java 4 Nov 2008 05:10:34 -0000 1.1 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardDTO.java 19 Feb 2009 04:25:01 -0000 1.2 @@ -18,34 +18,32 @@ * * http://www.gnu.org/licenses/gpl.txt * **************************************************************** - */ - -/* $Id$ */ -package org.lamsfoundation.lams.tool.qa; - + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.qa; + import java.io.Serializable; import java.util.SortedSet; -public class QaWizardDTO implements Serializable{ - +public class QaWizardDTO implements Serializable { + public static final long serialVersionUID = 3481234912412784515L; - + SortedSet qaWizardCategories; - - public QaWizardDTO() {} - - public QaWizardDTO(SortedSet categories) - { - - + + public QaWizardDTO() { } + public QaWizardDTO(SortedSet categories) { + + } + public SortedSet getQaWizardCategories() { - return qaWizardCategories; + return qaWizardCategories; } public void setQaWizardCategories(SortedSet qaWizardCategories) { - this.qaWizardCategories = qaWizardCategories; + this.qaWizardCategories = qaWizardCategories; } } - \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardQuestion.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardQuestion.java,v diff -u -r1.2 -r1.3 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardQuestion.java 4 Nov 2008 05:10:34 -0000 1.2 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardQuestion.java 19 Feb 2009 04:25:01 -0000 1.3 @@ -99,7 +99,7 @@ return 1; } } - + public Object clone() { QaWizardQuestion question = null; try { Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/ReflectionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/ReflectionDTO.java,v diff -u -r1.3 -r1.4 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/ReflectionDTO.java 20 Sep 2006 15:15:44 -0000 1.3 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/ReflectionDTO.java 19 Feb 2009 04:25:01 -0000 1.4 @@ -23,110 +23,112 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.qa; - import org.apache.commons.lang.builder.ToStringBuilder; - /** - *

    DTO that holds reflections from users + *

    + * DTO that holds reflections from users *

    * * @author Ozgur Demirtas */ -public class ReflectionDTO implements Comparable -{ +public class ReflectionDTO implements Comparable { protected String userName; - + protected String userId; - + protected String sessionId; - + protected String reflectionUid; - + protected String entry; - - - public int compareTo(Object o) - { - ReflectionDTO reflectionDTO = (ReflectionDTO) o; - - if (reflectionDTO == null) - return 1; - else - return 0; + + public int compareTo(Object o) { + ReflectionDTO reflectionDTO = (ReflectionDTO) o; + + if (reflectionDTO == null) + return 1; + else + return 0; } - - public String toString() { - return new ToStringBuilder(this) - .append("userName: ", userName) - .append("userId: ", userId) - .append("sessionId: ", sessionId) - .append("reflectionUid: ", reflectionUid) - .append("entry: ", entry) - .toString(); + public String toString() { + return new ToStringBuilder(this).append("userName: ", userName).append("userId: ", userId).append( + "sessionId: ", sessionId).append("reflectionUid: ", reflectionUid).append("entry: ", entry).toString(); } - - /** * @return Returns the entry. */ public String getEntry() { - return entry; + return entry; } + /** - * @param entry The entry to set. + * @param entry + * The entry to set. */ public void setEntry(String entry) { - this.entry = entry; + this.entry = entry; } + /** * @return Returns the sessionId. */ public String getSessionId() { - return sessionId; + return sessionId; } + /** - * @param sessionId The sessionId to set. + * @param sessionId + * The sessionId to set. */ public void setSessionId(String sessionId) { - this.sessionId = sessionId; + this.sessionId = sessionId; } + /** * @return Returns the reflectionUid. */ public String getReflectionUid() { - return reflectionUid; + return reflectionUid; } + /** - * @param reflectionUid The reflectionUid to set. + * @param reflectionUid + * The reflectionUid to set. */ public void setReflectionUid(String reflectionUid) { - this.reflectionUid = reflectionUid; + this.reflectionUid = reflectionUid; } + /** * @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 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; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueContentDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/Attic/IQaQueContentDAO.java,v diff -u -r1.17 -r1.18 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueContentDAO.java 9 Dec 2008 05:38:15 -0000 1.17 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueContentDAO.java 19 Feb 2009 04:19:24 -0000 1.18 @@ -28,35 +28,33 @@ import org.lamsfoundation.lams.tool.qa.QaContent; import org.lamsfoundation.lams.tool.qa.QaQueContent; - /** * * @author Ozgur Demirtas - * + * */ -public interface IQaQueContentDAO -{ +public interface IQaQueContentDAO { public QaQueContent getQaQueById(long qaQueContentId); - + public QaQueContent getToolDefaultQuestionContent(final long qaContentId); - + public List getQuestionIndsForContent(QaContent qa); - + public void createQueContent(QaQueContent queContent); - + public void saveOrUpdateQaQueContent(QaQueContent qaQueContent); - + public void removeQueContent(long qaQueContentId); - + public void removeQaQueContent(QaQueContent qaQueContent); - + public List getQaQueContentsByContentId(long qaContentId); - + public List getAllQuestionEntries(final long qaContentId); - + public QaQueContent getQuestionContentByQuestionText(final String question, Long qaContentId); - - public QaQueContent getQuestionContentByDisplayOrder(Long displayOrder, Long qaContentId); - - public List getAllQuestionEntriesSorted(final long qaContentId); + + public QaQueContent getQuestionContentByDisplayOrder(Long displayOrder, Long qaContentId); + + public List getAllQuestionEntriesSorted(final long qaContentId); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java,v diff -u -r1.13 -r1.14 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java 20 Sep 2006 15:15:44 -0000 1.13 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java 19 Feb 2009 04:19:24 -0000 1.14 @@ -28,42 +28,35 @@ import org.lamsfoundation.lams.tool.qa.QaContent; import org.lamsfoundation.lams.tool.qa.QaSession; - /** + * * + * @author Ozgur Demirtas * - * * @author Ozgur Demirtas - * */ -public interface IQaSessionDAO -{ - public int countSessionIncomplete(); - - public int countSessionComplete(); - - public int countSessionComplete(QaContent qa); - - public QaSession getQaSessionById(long qaSessionId); - - public List getToolSessionsForContent(QaContent qa); - - public QaSession getQaSessionOrNullById(long qaSessionId); - - public int studentActivityOccurred(QaContent qa); - - public void CreateQaSession(QaSession session); - +public interface IQaSessionDAO { + public int countSessionIncomplete(); + + public int countSessionComplete(); + + public int countSessionComplete(QaContent qa); + + public QaSession getQaSessionById(long qaSessionId); + + public List getToolSessionsForContent(QaContent qa); + + public QaSession getQaSessionOrNullById(long qaSessionId); + + public int studentActivityOccurred(QaContent qa); + + public void CreateQaSession(QaSession session); + public void UpdateQaSession(QaSession session); - + public void deleteQaSession(QaSession session); - + public List getSessionsFromContent(QaContent qaContent); - + public String getSessionNameById(long qaSessionId); - + public List getSessionNamesFromContent(QaContent qaContent); } - - - - - Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaUsrRespDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaUsrRespDAO.java,v diff -u -r1.12 -r1.13 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaUsrRespDAO.java 11 Nov 2006 14:58:39 -0000 1.12 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaUsrRespDAO.java 19 Feb 2009 04:19:24 -0000 1.13 @@ -27,31 +27,27 @@ import org.lamsfoundation.lams.tool.qa.QaUsrResp; - /** * * @author Ozgur Demirtas * */ -public interface IQaUsrRespDAO -{ - public void saveUserResponse(QaUsrResp resp); - - public QaUsrResp getAttemptByUID(Long uid); +public interface IQaUsrRespDAO { + public void saveUserResponse(QaUsrResp resp); - public void updateUserResponse(QaUsrResp resp); - - public void createUserResponse(QaUsrResp resp); - - public void removeUserResponse(QaUsrResp resp); - - public void removeUserResponseByQaQueId(Long qaQueId); - - public QaUsrResp retrieveQaUsrResp(long responseId); - - public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId); - - public void removeAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId); -} + public QaUsrResp getAttemptByUID(Long uid); + public void updateUserResponse(QaUsrResp resp); + public void createUserResponse(QaUsrResp resp); + + public void removeUserResponse(QaUsrResp resp); + + public void removeUserResponseByQaQueId(Long qaQueId); + + public QaUsrResp retrieveQaUsrResp(long responseId); + + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId); + + public void removeAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId); +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaWizardDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaWizardDAO.java,v diff -u -r1.2 -r1.3 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaWizardDAO.java 4 Nov 2008 05:10:34 -0000 1.2 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaWizardDAO.java 19 Feb 2009 04:19:24 -0000 1.3 @@ -18,23 +18,26 @@ * * http://www.gnu.org/licenses/gpl.txt * **************************************************************** - */ - -/* $Id$ */ -package org.lamsfoundation.lams.tool.qa.dao; + */ +/* $Id$ */ +package org.lamsfoundation.lams.tool.qa.dao; + import java.util.SortedSet; import org.lamsfoundation.lams.dao.IBaseDAO; import org.lamsfoundation.lams.tool.qa.QaWizardCategory; -import org.lamsfoundation.lams.tool.qa.QaWizardCognitiveSkill; -import org.lamsfoundation.lams.tool.qa.QaWizardQuestion; -public interface IQaWizardDAO extends IBaseDAO{ + +public interface IQaWizardDAO extends IBaseDAO { void saveOrUpdateCategories(SortedSet categories); + SortedSet getWizardCategories(); + void deleteWizardCategoryByUID(Long uid); + void deleteWizardSkillByUID(Long uid); + void deleteWizardQuestionByUID(Long uid); + void deleteAllWizardCategories(); } - \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/QaQueUsrDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/Attic/QaQueUsrDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/QaQueUsrDAO.java 19 Feb 2009 04:19:24 -0000 1.1 @@ -0,0 +1,154 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $$Id: QaQueUsrDAO.java,v 1.1 2009/02/19 04:19:24 lfoxton Exp $$ */ +package org.lamsfoundation.lams.tool.qa.dao; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.FlushMode; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.dao.IQaQueUsrDAO; +import org.springframework.orm.hibernate3.HibernateTemplate; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates + */ + +public class QaQueUsrDAO extends HibernateDaoSupport implements IQaQueUsrDAO { + static Logger logger = Logger.getLogger(QaQueUsrDAO.class.getName()); + + private static final String COUNT_SESSION_USER = "select qaQueUsr.queUsrId from QaQueUsr qaQueUsr where qaQueUsr.qaSessionId= :qaSession"; + private static final String LOAD_USER_FOR_SESSION = "from qaQueUsr in class QaQueUsr where qaQueUsr.qaSessionId= :qaSessionId"; + + private static final String GET_USER_COUNT_FOR_CONTENT = "select count(*) from QaQueUsr quser, QaSession qses, QaQueContent qcon where " + + "quser.qaSession=qses and " + "qses.qaContent=qcon and " + "qcon.uid=:uid"; + + // select count(*) from tl_laqa11_que_usr quser, tl_laqa11_session qses where quser.qa_session_id=qses.uid and qses.qa_content_id=5378; + + public QaQueUsr getQaUserByUID(Long uid) { + return (QaQueUsr) this.getHibernateTemplate().get(QaQueUsr.class, uid); + } + + public int countSessionUser(QaSession qaSession) { + return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_USER, "qaSession", qaSession)).size(); + } + + public QaQueUsr getQaQueUsrById(long qaQueUsrId) { + String query = "from QaQueUsr user where user.queUsrId=?"; + + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(query).setLong(0, qaQueUsrId).list(); + + if (list != null && list.size() > 0) { + QaQueUsr qu = (QaQueUsr) list.get(0); + return qu; + } + return null; + } + + public QaQueUsr getQaUserBySession(final Long queUsrId, final Long qaSessionId) { + + String strGetUser = "from qaQueUsr in class QaQueUsr where qaQueUsr.queUsrId=:queUsrId and qaQueUsr.qaSessionId=:qaSessionId"; + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(strGetUser).setLong("queUsrId", queUsrId.longValue()).setLong( + "qaSessionId", qaSessionId.longValue()).list(); + + if (list != null && list.size() > 0) { + QaQueUsr usr = (QaQueUsr) list.get(0); + return usr; + } + return null; + } + + public List getUserBySessionOnly(final QaSession qaSession) { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(LOAD_USER_FOR_SESSION).setLong("qaSessionId", + qaSession.getUid().longValue()).list(); + return list; + } + + public QaQueUsr loadQaQueUsrById(long qaQueUsrId) { + return getQaQueUsrById(qaQueUsrId); + } + + public void createUsr(QaQueUsr usr) { + this.getSession().setFlushMode(FlushMode.AUTO); + this.getHibernateTemplate().save(usr); + } + + public void updateUsr(QaQueUsr usr) { + this.getSession().setFlushMode(FlushMode.AUTO); + this.getHibernateTemplate().update(usr); + } + + public void deleteQaQueUsr(QaQueUsr qaQueUsr) { + this.getSession().setFlushMode(FlushMode.AUTO); + this.getHibernateTemplate().delete(qaQueUsr); + } + + public int getTotalNumberOfUsers(QaContent qa) { + + int returnInt = 0; + if (qa != null && qa.getUid() != null) { + List result = getSession().createQuery(GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid()).list(); + Integer resultInt = (result.get(0) != null) ? (Integer) result.get(0) : new Integer(0); + returnInt = resultInt.intValue(); + } else { + logger.error("Attempt to count users from null content"); + } + logger.debug("Number of users for quContent " +qa.getUid()+ ": " + returnInt); + return returnInt; + + /* + String strGetUser = "from qaQueUsr in class QaQueUsr"; + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(strGetUser).list(); + logger.debug("strGetUser: " + strGetUser); + logger.debug("qa: " + qa); + logger.debug("list: " + list); + + int totalUserCount = 0; + if (list != null && list.size() > 0) { + QaQueUsr usr = (QaQueUsr) list.get(0); + logger.debug("usr: " + usr); + logger.debug("local usr content uid versus incoming content uid: " + + usr.getQaSession().getQaContent().getUid().intValue() + " versus " + qa.getUid().intValue()); + + if (usr.getQaSession().getQaContent().getUid().intValue() == qa.getUid().intValue()) { + ++totalUserCount; + } + } + logger.debug("final totalUserCount: " + totalUserCount); + return totalUserCount; + */ + } + +} \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java,v diff -u -r1.20 -r1.21 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java 19 Feb 2009 04:04:31 -0000 1.20 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java 19 Feb 2009 04:19:24 -0000 1.21 @@ -126,29 +126,6 @@ } logger.debug("Number of users for quContent " +qa.getUid()+ ": " + returnInt); return returnInt; - - /* - String strGetUser = "from qaQueUsr in class QaQueUsr"; - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(strGetUser).list(); - logger.debug("strGetUser: " + strGetUser); - logger.debug("qa: " + qa); - logger.debug("list: " + list); - - int totalUserCount = 0; - if (list != null && list.size() > 0) { - QaQueUsr usr = (QaQueUsr) list.get(0); - logger.debug("usr: " + usr); - logger.debug("local usr content uid versus incoming content uid: " - + usr.getQaSession().getQaContent().getUid().intValue() + " versus " + qa.getUid().intValue()); - - if (usr.getQaSession().getQaContent().getUid().intValue() == qa.getUid().intValue()) { - ++totalUserCount; - } - } - logger.debug("final totalUserCount: " + totalUserCount); - return totalUserCount; - */ } } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java,v diff -u -r1.53 -r1.54 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 19 Feb 2009 04:04:31 -0000 1.53 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 19 Feb 2009 04:25:02 -0000 1.54 @@ -85,7 +85,8 @@ public void updateQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException; /** - * Return the question content object according to the requested question content id. + * Return the question content object according to the requested question + * content id. * * @param qaQueContentId * qa question content id @@ -218,10 +219,11 @@ public void removeToolContent(Long toolContentId) throws QaApplicationException; /** - * createToolSession(Long toolSessionId,String toolSessionName, Long toolContentId) + * createToolSession(Long toolSessionId,String toolSessionName, Long + * toolContentId) * - * It is also defined here since in development we want to be able call it directly from the web-layer instead of it - * being called by the container. + * It is also defined here since in development we want to be able call it + * directly from the web-layer instead of it being called by the container. * * @param toolSessionId * @param toolContentId @@ -231,8 +233,8 @@ /** * leaveToolSession(Long toolSessionId, Long learnerId) * - * It is also defined here since in development we want to be able call it directly from our web-layer instead of it - * being called by the container. + * It is also defined here since in development we want to be able call it + * directly from our web-layer instead of it being called by the container. * * @param toolSessionId * @param toolContentId @@ -273,8 +275,8 @@ public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); /** - * Get the LAMS audit service. Needed as the web layer controls the staff updating of an answer, so the log entry - * must be made by the web layer. + * Get the LAMS audit service. Needed as the web layer controls the staff + * updating of an answer, so the log entry must be made by the web layer. */ public IAuditService getAuditService(); @@ -283,11 +285,12 @@ public QaContent getQaContentBySessionId(Long sessionId); /** - * Creates an unique name for a QaCondition. It consists of the tool output definition name and a unique positive - * integer number. + * Creates an unique name for a QaCondition. It consists of the tool output + * definition name and a unique positive integer number. * * @param existingConditions - * existing conditions; required to check if a condition with the same name does not exist. + * existing conditions; required to check if a condition with + * the same name does not exist. * @return unique QaCondition name */ public String createConditionName(Collection existingConditions); @@ -319,7 +322,8 @@ public SortedSet getWizardCategories(); /** - * Saves the entire set of QaWizardCategories (including the child cognitive skills and questions) + * Saves the entire set of QaWizardCategories (including the child cognitive + * skills and questions) * * @param categories */ Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaImportContentVersionFilter.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaImportContentVersionFilter.java,v diff -u -r1.3 -r1.4 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaImportContentVersionFilter.java 15 Nov 2006 00:45:50 -0000 1.3 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaImportContentVersionFilter.java 19 Feb 2009 04:25:02 -0000 1.4 @@ -28,15 +28,15 @@ /** * Import filter class for different versions of Q&A content. */ -public class QaImportContentVersionFilter extends ToolContentVersionFilter{ +public class QaImportContentVersionFilter extends ToolContentVersionFilter { - /** - * Import 2.0RC1 version content to 2.0RC2 version. Added lock on finish - * field. - */ - public void up20061102To20061113(){ - // Change name to suit the version you give the tool. - this.addField(QaContent.class, "lockWhenFinished", new Boolean(true)); - this.addField(QaContent.class, "showOtherAnswers", new Boolean(true)); - } + /** + * Import 2.0RC1 version content to 2.0RC2 version. Added lock on finish + * field. + */ + public void up20061102To20061113() { + // Change name to suit the version you give the tool. + this.addField(QaContent.class, "lockWhenFinished", new Boolean(true)); + this.addField(QaContent.class, "showOtherAnswers", new Boolean(true)); + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java,v diff -u -r1.8 -r1.9 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java 31 Oct 2008 05:57:26 -0000 1.8 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java 19 Feb 2009 04:25:02 -0000 1.9 @@ -164,7 +164,8 @@ } /** - * Creates a default condition so teachers know how to use complex conditions for this tool. + * Creates a default condition so teachers know how to use complex + * conditions for this tool. * * @param qaContent * content of the tool Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java,v diff -u -r1.85 -r1.86 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 19 Feb 2009 04:04:31 -0000 1.85 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 19 Feb 2009 04:25:02 -0000 1.86 @@ -97,15 +97,19 @@ import org.springframework.dao.DataAccessException; /** - * The POJO implementation of Survey service. All business logics of survey tool are implemented in this class. It - * translate the request from presentation layer and perform approporiate database operation. + * The POJO implementation of Survey service. All business logics of survey tool + * are implemented in this class. It translate the request from presentation + * layer and perform approporiate database operation. * - * Two construtors are provided in this class. The constuctor with Hibernate session object allows survey tool to handle - * long run application transaction. The developer can store Hibernate session in http session and pass across different - * http request. This implementation also make the testing out side JBoss container much easier. + * Two construtors are provided in this class. The constuctor with Hibernate + * session object allows survey tool to handle long run application transaction. + * The developer can store Hibernate session in http session and pass across + * different http request. This implementation also make the testing out side + * JBoss container much easier. * - * Every method is implemented as a Hibernate session transaction. It open an new persistent session or connect to - * existing persistent session in the begining and it close or disconnect to the persistent session in the end. + * Every method is implemented as a Hibernate session transaction. It open an + * new persistent session or connect to existing persistent session in the + * begining and it close or disconnect to the persistent session in the end. * * @author Ozgur Demirtas * @@ -661,8 +665,9 @@ } /** - * checks the paramter content in the user responses table boolean studentActivityOccurredGlobal(QaContent - * qaContent) throws QaApplicationException + * checks the paramter content in the user responses table boolean + * studentActivityOccurredGlobal(QaContent qaContent) throws + * QaApplicationException * * @param qa * @return boolean @@ -688,8 +693,8 @@ } /** - * counts the number of sessions marked INCOMPLETE for a content int countIncompleteSession(QaContent qa) throws - * QaApplicationException + * counts the number of sessions marked INCOMPLETE for a content int + * countIncompleteSession(QaContent qa) throws QaApplicationException * * @param qa * @return int @@ -704,11 +709,13 @@ } /** - * checks the parameter content in the tool sessions table. find out if any student has ever used (logged in through - * the url and replied) to this content return true even if you have only one content passed as parameter referenced - * in the tool sessions table + * checks the parameter content in the tool sessions table. find out if any + * student has ever used (logged in through the url and replied) to this + * content return true even if you have only one content passed as parameter + * referenced in the tool sessions table * - * boolean studentActivityOccurred(QaContent qa) throws QaApplicationException + * boolean studentActivityOccurred(QaContent qa) throws + * QaApplicationException * * @param qa * @return boolean @@ -726,12 +733,15 @@ } /** - * gets called ONLY when a lesson is being created in monitoring mode. Should create the new content(toContent) - * based on what the author has created her content with. In q/a tool's case that is content + question's content - * but not user responses. The deep copy should go only as far as default content (or author created content) - * already goes. ToolContentManager CONTRACT + * gets called ONLY when a lesson is being created in monitoring mode. + * Should create the new content(toContent) based on what the author has + * created her content with. In q/a tool's case that is content + question's + * content but not user responses. The deep copy should go only as far as + * default content (or author created content) already goes. + * ToolContentManager CONTRACT * - * similar to public void removeToolContent(Long toolContentID) gets called by Container+Flash + * similar to public void removeToolContent(Long toolContentID) gets called + * by Container+Flash * */ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException @@ -811,8 +821,9 @@ } /** - * setAsForceCompleteSession(Long toolSessionId) throws QaApplicationException update the tool session status to - * COMPLETE for this tool session + * setAsForceCompleteSession(Long toolSessionId) throws + * QaApplicationException update the tool session status to COMPLETE for + * this tool session * * @param Long * toolSessionId @@ -830,8 +841,8 @@ } /** - * setAsForceComplete(Long userId) throws QaApplicationException update the tool session status to COMPLETE for this - * user + * setAsForceComplete(Long userId) throws QaApplicationException update the + * tool session status to COMPLETE for this user * * @param userId */ @@ -876,7 +887,8 @@ } /** - * setAsDefineLater(Long toolContentID) throws DataMissingException, ToolException + * setAsDefineLater(Long toolContentID) throws DataMissingException, + * ToolException * * @param toolContentID * return void @@ -898,8 +910,8 @@ } /** - * setAsRunOffline(Long toolContentID) throws DataMissingException, ToolException set the runOffline to true on this - * content + * setAsRunOffline(Long toolContentID) throws DataMissingException, + * ToolException set the runOffline to true on this content * * @param toolContentID * return void @@ -922,12 +934,13 @@ /** * - * removeToolContent(Long toolContentID) gets automatically called only in monitoring mode when the author chooses - * to delete a lesson. + * removeToolContent(Long toolContentID) gets automatically called only in + * monitoring mode when the author chooses to delete a lesson. * - * The idea is to remove content + its relevant sessions + in q/a tools's case the question's content from the db. - * ToolContentManager CONTRACT this gets called automatically by Flash when a deletion is detected in the tool - * interface. + * The idea is to remove content + its relevant sessions + in q/a tools's + * case the question's content from the db. ToolContentManager CONTRACT this + * gets called automatically by Flash when a deletion is detected in the + * tool interface. */ public void removeToolContent(Long toolContentID) { QaServicePOJO.logger.debug("start of removeToolContent with toolContentID: " + toolContentID); @@ -991,8 +1004,9 @@ } /** - * removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException - * Will need an update on the core tool signature: reason : when qaContent is null throw an exception + * removeToolContent(Long toolContentID, boolean removeSessionData) throws + * SessionDataExistsException, ToolException Will need an update on the core + * tool signature: reason : when qaContent is null throw an exception * */ public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, @@ -1046,7 +1060,8 @@ } /** - * Export the XML fragment for the tool's content, along with any files needed for the content. + * Export the XML fragment for the tool's content, along with any files + * needed for the content. * * @throws DataMissingException * if no tool content matches the toolSessionId @@ -1098,7 +1113,8 @@ } /** - * Import the XML fragment for the tool's content, along with any files needed for the content. + * Import the XML fragment for the tool's content, along with any files + * needed for the content. * * @throws ToolException * if any other error occurs @@ -1140,12 +1156,14 @@ } /** - * Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions - * that are always available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created - * for a particular activity such as the answer to the third question contains the word Koala and hence the need for - * the toolContentId + * Get the definitions for possible output for an activity, based on the + * toolContentId. These may be definitions that are always available for the + * tool (e.g. number of marks for Multiple Choice) or a custom definition + * created for a particular activity such as the answer to the third + * question contains the word Koala and hence the need for the toolContentId * - * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition + * @return SortedMap of ToolOutputDefinitions with the key being the name of + * each definition */ public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException { QaContent qaContent = qaDAO.getQaById(toolContentId); @@ -1160,8 +1178,9 @@ } /** - * it is possible that the tool session id already exists in the tool sessions table as the users from the same - * session are involved. existsSession(long toolSessionId) + * it is possible that the tool session id already exists in the tool + * sessions table as the users from the same session are involved. + * existsSession(long toolSessionId) * * @param toolSessionId * @return boolean @@ -1181,10 +1200,12 @@ } /** - * createToolSession(Long toolSessionId,String toolSessionName, Long toolContentID) throws ToolException - * ToolSessionManager CONTRACT : creates a tool session with the incoming toolSessionId in the tool session table + * createToolSession(Long toolSessionId,String toolSessionName, Long + * toolContentID) throws ToolException ToolSessionManager CONTRACT : creates + * a tool session with the incoming toolSessionId in the tool session table * - * gets called only in the Learner mode. All the learners in the same group have the same toolSessionId. + * gets called only in the Learner mode. All the learners in the same group + * have the same toolSessionId. * */ public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentID) throws ToolException { @@ -1293,8 +1314,9 @@ /** * Complete the tool session. * - * Part of the ToolSessionManager contract. Called by controller service to force complete the qa session, or by the - * web front end to complete the qa session + * Part of the ToolSessionManager contract. Called by controller service to + * force complete the qa session, or by the web front end to complete the qa + * session * */ public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException { @@ -1349,8 +1371,8 @@ /** * Get the tool output for the given tool output names. * - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long, - * java.lang.Long) + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, + * java.lang.Long, java.lang.Long) */ public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) { return getQaOutputFactory().getToolOutput(names, this, toolSessionId, learnerId); @@ -1359,8 +1381,8 @@ /** * Get the tool output for the given tool output name. * - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, - * java.lang.Long) + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, + * java.lang.Long, java.lang.Long) */ public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) { return getQaOutputFactory().getToolOutput(name, this, toolSessionId, learnerId); @@ -1395,11 +1417,12 @@ } /** - * This method verifies the credentials of the SubmitFiles Tool and gives it the Ticket to login and - * access the Content Repository. + * This method verifies the credentials of the SubmitFiles Tool and gives it + * the Ticket to login and access the Content Repository. * - * A valid ticket is needed in order to access the content from the repository. This method would be called evertime - * the tool needs to upload/download files from the content repository. + * A valid ticket is needed in order to access the content from the + * repository. This method would be called evertime the tool needs to + * upload/download files from the content repository. * * @return ITicket The ticket for repostory access * @throws SubmitFilesException @@ -1423,8 +1446,8 @@ } /** - * This method deletes the content with the given uuid and versionID from the content - * repository + * This method deletes the content with the given uuid and + * versionID from the content repository * * @param uuid * The uuid of the node to be deleted @@ -1768,7 +1791,8 @@ } /** - * Set the description, throws away the title value as this is not supported in 2.0 + * Set the description, throws away the title value as this is not supported + * in 2.0 */ public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException, DataMissingException { @@ -1894,7 +1918,8 @@ } /** - * Saves the entire set of QaWizardCategories (including the child cognitive skills and questions) + * Saves the entire set of QaWizardCategories (including the child cognitive + * skills and questions) * * @param categories */ Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServiceProxy.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServiceProxy.java,v diff -u -r1.10 -r1.11 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServiceProxy.java 20 Sep 2006 15:15:44 -0000 1.10 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServiceProxy.java 19 Feb 2009 04:25:02 -0000 1.11 @@ -29,46 +29,42 @@ import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; - /** - *

    This class act as the proxy between web layer and service layer. It is - * designed to decouple the presentation logic and business logic completely. - * In this way, the presentation tier will no longer be aware of the changes in + *

    + * This class act as the proxy between web layer and service layer. It is + * designed to decouple the presentation logic and business logic completely. In + * this way, the presentation tier will no longer be aware of the changes in * service layer. Therefore we can feel free to switch the business logic - * implementation.

    + * implementation. + *

    * * @author Ozgur Demirtas - * + * */ -public class QaServiceProxy -{ +public class QaServiceProxy { /** * Return the q/a domain service object. It will delegate to the Spring * helper method to retrieve the proper bean from Spring bean factory. - * @param servletContext the servletContext for current application + * + * @param servletContext + * the servletContext for current application * @return qaService object. */ - public static final IQaService getQaService(ServletContext servletContext) - { - return (IQaService)getQaDomainService(servletContext); + public static final IQaService getQaService(ServletContext servletContext) { + return (IQaService) getQaDomainService(servletContext); } - - public static final ToolSessionManager getQaSessionManager(ServletContext servletContext) - { - return (ToolSessionManager)getQaDomainService(servletContext); + + public static final ToolSessionManager getQaSessionManager(ServletContext servletContext) { + return (ToolSessionManager) getQaDomainService(servletContext); } - - public static final ToolContentManager getQaContentManager(ServletContext servletContext) - { - return (ToolContentManager)getQaDomainService(servletContext); + + public static final ToolContentManager getQaContentManager(ServletContext servletContext) { + return (ToolContentManager) getQaDomainService(servletContext); } - - private static Object getQaDomainService(ServletContext servletContext) - { - WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); - return wac.getBean("qaService"); + private static Object getQaDomainService(ServletContext servletContext) { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); + return wac.getBean("qaService"); } - } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQueContentComparator.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQueContentComparator.java,v diff -u -r1.1 -r1.2 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQueContentComparator.java 30 Sep 2008 05:54:57 -0000 1.1 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQueContentComparator.java 19 Feb 2009 04:25:02 -0000 1.2 @@ -5,7 +5,8 @@ import org.lamsfoundation.lams.tool.qa.QaQueContent; /** - * Comparator for QaQueContent. Only the display order is compared. + * Comparator for QaQueContent. Only the display order is + * compared. * * @author Marcin Cieslak */ Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQuestionContentDTOComparator.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQuestionContentDTOComparator.java,v diff -u -r1.1 -r1.2 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQuestionContentDTOComparator.java 30 Sep 2008 05:54:57 -0000 1.1 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQuestionContentDTOComparator.java 19 Feb 2009 04:25:02 -0000 1.2 @@ -5,7 +5,8 @@ import org.lamsfoundation.lams.tool.qa.QaQuestionContentDTO; /** - * Comparator for QaQuestionContentDTO. Only the display order is compared. + * Comparator for QaQuestionContentDTO. Only the display order + * is compared. * * @author Marcin Cieslak */ Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaToolContentHandler.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaToolContentHandler.java,v diff -u -r1.9 -r1.10 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaToolContentHandler.java 20 Sep 2006 15:15:44 -0000 1.9 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaToolContentHandler.java 19 Feb 2009 04:25:01 -0000 1.10 @@ -32,34 +32,34 @@ public class QaToolContentHandler extends ToolContentHandler { public static final String SPRING_BEAN_NAME = "qaToolContentHandler"; - + private static String repositoryWorkspaceName = "qaworkspace"; private static String repositoryUser = "qa_user"; - private static char[] repositoryId = {'l','a','m','s','-','q','a'}; + private static char[] repositoryId = { 'l', 'a', 'm', 's', '-', 'q', 'a' }; private QaToolContentHandler() { - super(); + super(); } /* (non-Javadoc) * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName() */ public String getRepositoryWorkspaceName() { - return repositoryWorkspaceName; + return repositoryWorkspaceName; } /* (non-Javadoc) * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser() */ public String getRepositoryUser() { - return repositoryUser; + return repositoryUser; } /* (non-Javadoc) * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId() */ public char[] getRepositoryId() { - return repositoryId; + return repositoryId; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java,v diff -u -r1.47 -r1.48 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java 9 Dec 2008 05:38:14 -0000 1.47 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java 19 Feb 2009 04:25:02 -0000 1.48 @@ -371,8 +371,8 @@ } /** - * repopulateMap(TreeMap mapQuestionContent, HttpServletRequest request) return void repopulates the user entries - * into the Map + * repopulateMap(TreeMap mapQuestionContent, HttpServletRequest request) + * return void repopulates the user entries into the Map */ protected void repopulateMap(Map mapQuestionContent, HttpServletRequest request) { AuthoringUtil.logger.debug("starting repopulateMap"); @@ -561,8 +561,9 @@ } /** - * removes unused question entries from db removeRedundantQuestions (Map mapQuestionContent, IQaService qaService, - * QaAuthoringForm qaAuthoringForm) + * removes unused question entries from db removeRedundantQuestions (Map + * mapQuestionContent, IQaService qaService, QaAuthoringForm + * qaAuthoringForm) * * @param mapQuestionContent * @param qaService @@ -641,7 +642,8 @@ } /** - * createQuestionContent(TreeMap mapQuestionContent, HttpServletRequest request) return void + * createQuestionContent(TreeMap mapQuestionContent, HttpServletRequest + * request) return void * * persist the questions in the Map the user has submitted */ @@ -744,8 +746,9 @@ } /** - * sorts the questions by the display order reOrganizeDisplayOrder(Map mapQuestionContent, IQaService qaService, - * QaAuthoringForm qaAuthoringForm, QaContent qaContent) + * sorts the questions by the display order reOrganizeDisplayOrder(Map + * mapQuestionContent, IQaService qaService, QaAuthoringForm + * qaAuthoringForm, QaContent qaContent) * * @param mapQuestionContent * @param qaService @@ -782,7 +785,8 @@ } /** - * checks if any entry is duplicate verifyDuplicatesOptionsMap(Map mapQuestions) + * checks if any entry is duplicate verifyDuplicatesOptionsMap(Map + * mapQuestions) * * @param mapQuestions * @return Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ClearSessionAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ClearSessionAction.java,v diff -u -r1.5 -r1.6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ClearSessionAction.java 20 Sep 2006 15:15:41 -0000 1.5 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ClearSessionAction.java 19 Feb 2009 04:25:02 -0000 1.6 @@ -31,22 +31,22 @@ import org.lamsfoundation.lams.web.util.AttributeNames; /** - * This class give a chance to clear HttpSession when user save/close authoring page. - * @author Steve.Ni - * ----------------XDoclet Tags-------------------- + * This class give a chance to clear HttpSession when user save/close authoring + * page. * - * @struts:action path="/clearsession" validate="false" - * + * @author Steve.Ni ----------------XDoclet Tags-------------------- + * + * @struts:action path="/clearsession" validate="false" + * * @version $Revision$ */ public class ClearSessionAction extends LamsAuthoringFinishAction { - @Override - public void clearSession(String customiseSessionID,HttpSession session, ToolAccessMode mode) { - if(mode.isAuthor()){ - session.removeAttribute(QaAction.SUBMIT_SUCCESS); - } + @Override + public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) { + if (mode.isAuthor()) { + session.removeAttribute(QaAction.SUBMIT_SUCCESS); } + } - } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java,v diff -u -r1.16 -r1.17 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java 21 Nov 2007 00:48:14 -0000 1.16 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java 19 Feb 2009 04:25:02 -0000 1.17 @@ -21,7 +21,6 @@ * **************************************************************** */ - package org.lamsfoundation.lams.tool.qa.web; import javax.servlet.http.Cookie; @@ -40,165 +39,162 @@ import org.lamsfoundation.lams.tool.qa.service.IQaService; import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet; + /** - *

    Enables exporting portfolio for teacher and learner modes.

    + *

    + * Enables exporting portfolio for teacher and learner modes. + *

    * * @author Ozgur Demirtas */ -public class ExportServlet extends AbstractExportPortfolioServlet implements QaAppConstants{ - static Logger logger = Logger.getLogger(ExportServlet.class.getName()); - private static final long serialVersionUID = -1779093489007108143L; - private final String FILENAME = "qa_main.html"; - - - public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) - { - logger.debug("dispathcing doExport"); - String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath(); - logger.debug("basePath:" + basePath); +public class ExportServlet extends AbstractExportPortfolioServlet implements QaAppConstants { + static Logger logger = Logger.getLogger(ExportServlet.class.getName()); + private static final long serialVersionUID = -1779093489007108143L; + private final String FILENAME = "qa_main.html"; - if (StringUtils.equals(mode,ToolAccessMode.LEARNER.toString())){ - learner(request,response,directoryName,cookies); - }else if (StringUtils.equals(mode,ToolAccessMode.TEACHER.toString())){ - teacher(request,response,directoryName,cookies); - } + public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies) { + logger.debug("dispathcing doExport"); + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + + request.getContextPath(); + logger.debug("basePath:" + basePath); - writeResponseToFile(basePath+"/export/exportportfolio.jsp",directoryName,FILENAME,cookies); - - return FILENAME; + if (StringUtils.equals(mode, ToolAccessMode.LEARNER.toString())) { + learner(request, response, directoryName, cookies); + } else if (StringUtils.equals(mode, ToolAccessMode.TEACHER.toString())) { + teacher(request, response, directoryName, cookies); } - - protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { - if (toolContentID == null && toolSessionID == null) { - logger.error("Tool content Id or and session Id are null. Unable to activity title"); - } else { - IQaService service = QaServiceProxy.getQaService(getServletContext()); - QaContent content = null; - if ( toolContentID != null ) { - content=service.retrieveQa(toolContentID); - } else { - QaSession session=service.retrieveQaSession(toolSessionID); - if ( session != null ) - content = session.getQaContent(); - } - if ( content != null ) { - activityTitle = content.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); + + writeResponseToFile(basePath + "/export/exportportfolio.jsp", directoryName, FILENAME, cookies); + + return FILENAME; + } + + protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies) { + if (toolContentID == null && toolSessionID == null) { + logger.error("Tool content Id or and session Id are null. Unable to activity title"); + } else { + IQaService service = QaServiceProxy.getQaService(getServletContext()); + QaContent content = null; + if (toolContentID != null) { + content = service.retrieveQa(toolContentID); + } else { + QaSession session = service.retrieveQaSession(toolSessionID); + if (session != null) + content = session.getQaContent(); + } + if (content != null) { + activityTitle = content.getTitle(); + } } + return super.doOfflineExport(request, response, directoryName, cookies); + } - public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) - { - logger.debug("starting learner mode..."); - - IQaService qaService = QaServiceProxy.getQaService(getServletContext()); - - logger.debug("userID:" + userID); - logger.debug("toolSessionID:" + toolSessionID); - - if (userID == null || toolSessionID == null) - { - String error = "Tool session Id or user Id is null. Unable to continue"; - logger.error(error); - throw new QaApplicationException(error); - } - - QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionID.longValue()); - - // If the learner hasn't answered yet, then they won't exist in the session. - // Yet we might be asked for their page, as the activity has been commenced. - // So need to do a "blank" page in that case - QaQueUsr learner = qaService.getQaUserBySession(userID,qaSession.getUid()); - logger.debug("learner: " + learner); - - QaContent content=qaSession.getQaContent(); - logger.debug("content: " + content); - logger.debug("content id: " + content.getQaContentId()); - - if (content == null) - { - String error="The content for this activity has not been defined yet."; - logger.error(error); - throw new QaApplicationException(error); - } + public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { + logger.debug("starting learner mode..."); - logger.debug("calling learning mode toolSessionID:" + toolSessionID + " userID: " + userID ); - QaMonitoringAction qaMonitoringAction= new QaMonitoringAction(); - logger.debug("start refreshSummaryData for learner mode."); + IQaService qaService = QaServiceProxy.getQaService(getServletContext()); - GeneralLearnerFlowDTO generalLearnerFlowDTO= LearningUtil.buildGeneralLearnerFlowDTO(content); - generalLearnerFlowDTO.setUserUid(learner != null?learner.getUid().toString():null); - logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); + logger.debug("userID:" + userID); + logger.debug("toolSessionID:" + toolSessionID); - // if learner is null, don't want to show other people's answers - if ( learner != null ) { - qaMonitoringAction.refreshSummaryData(request, content, qaService, content.isUsernameVisible(), true, toolSessionID.toString(), - userID.toString(), generalLearnerFlowDTO, false, toolSessionID.toString()); - logger.debug("end refreshSummaryData for learner mode."); - qaMonitoringAction.prepareReflectionData(request, content, qaService, userID.toString(), true, toolSessionID.toString()); - } - - generalLearnerFlowDTO =(GeneralLearnerFlowDTO)request.getAttribute(GENERAL_LEARNER_FLOW_DTO); - logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); + if (userID == null || toolSessionID == null) { + String error = "Tool session Id or user Id is null. Unable to continue"; + logger.error(error); + throw new QaApplicationException(error); + } - logger.debug("for the special case of export portfolio we place generalLearnerFlowDTO into session scope"); - request.getSession().setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionID.longValue()); - request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "learner"); - logger.debug("ending learner mode: "); + // If the learner hasn't answered yet, then they won't exist in the session. + // Yet we might be asked for their page, as the activity has been commenced. + // So need to do a "blank" page in that case + QaQueUsr learner = qaService.getQaUserBySession(userID, qaSession.getUid()); + logger.debug("learner: " + learner); + + QaContent content = qaSession.getQaContent(); + logger.debug("content: " + content); + logger.debug("content id: " + content.getQaContentId()); + + if (content == null) { + String error = "The content for this activity has not been defined yet."; + logger.error(error); + throw new QaApplicationException(error); + } + + logger.debug("calling learning mode toolSessionID:" + toolSessionID + " userID: " + userID); + QaMonitoringAction qaMonitoringAction = new QaMonitoringAction(); + logger.debug("start refreshSummaryData for learner mode."); + + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(content); + generalLearnerFlowDTO.setUserUid(learner != null ? learner.getUid().toString() : null); + logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); + + // if learner is null, don't want to show other people's answers + if (learner != null) { + qaMonitoringAction + .refreshSummaryData(request, content, qaService, content.isUsernameVisible(), true, toolSessionID + .toString(), userID.toString(), generalLearnerFlowDTO, false, toolSessionID.toString()); + logger.debug("end refreshSummaryData for learner mode."); + qaMonitoringAction.prepareReflectionData(request, content, qaService, userID.toString(), true, + toolSessionID.toString()); + } + + generalLearnerFlowDTO = (GeneralLearnerFlowDTO) request.getAttribute(GENERAL_LEARNER_FLOW_DTO); + logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); + + logger.debug("for the special case of export portfolio we place generalLearnerFlowDTO into session scope"); + request.getSession().setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + + request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "learner"); + logger.debug("ending learner mode: "); } - - public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) - { - logger.debug("starting teacher mode..."); - - IQaService qaService = QaServiceProxy.getQaService(getServletContext()); - - if (toolContentID==null) - { - String error="Tool Content Id is missing. Unable to continue"; - logger.error(error); - throw new QaApplicationException(error); - } - QaContent content=qaService.loadQa(toolContentID.longValue()); - logger.debug("content: " + content); - - if (content == null) - { - String error="Data is missing from the database. Unable to Continue"; - logger.error(error); - throw new QaApplicationException(error); - } - - QaMonitoringAction qaMonitoringAction= new QaMonitoringAction(); - logger.debug("start refreshSummaryData for teacher mode."); + public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { + logger.debug("starting teacher mode..."); - GeneralLearnerFlowDTO generalLearnerFlowDTO= LearningUtil.buildGeneralLearnerFlowDTO(content); - logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); - qaMonitoringAction.refreshSummaryData(request, content, qaService, true, false, - null, null, generalLearnerFlowDTO, false, "All"); - logger.debug("end refreshSummaryData for teacher mode."); - logger.debug("teacher uses content id: " + content.getQaContentId()); - - generalLearnerFlowDTO =(GeneralLearnerFlowDTO)request.getAttribute(GENERAL_LEARNER_FLOW_DTO); - logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); - - logger.debug("for the special case of export portfolio we place generalLearnerFlowDTO into session scope"); - request.getSession().setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + IQaService qaService = QaServiceProxy.getQaService(getServletContext()); - request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "teacher"); - - qaMonitoringAction.prepareReflectionData(request, content, qaService, null, true, "All"); - - - request.setAttribute("currentMonitoredToolSession", "All"); - MonitoringUtil.generateGroupsSessionData(request, qaService, content, true); - - - - logger.debug("ending teacher mode: "); + if (toolContentID == null) { + String error = "Tool Content Id is missing. Unable to continue"; + logger.error(error); + throw new QaApplicationException(error); + } + + QaContent content = qaService.loadQa(toolContentID.longValue()); + logger.debug("content: " + content); + + if (content == null) { + String error = "Data is missing from the database. Unable to Continue"; + logger.error(error); + throw new QaApplicationException(error); + } + + QaMonitoringAction qaMonitoringAction = new QaMonitoringAction(); + logger.debug("start refreshSummaryData for teacher mode."); + + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(content); + logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); + qaMonitoringAction.refreshSummaryData(request, content, qaService, true, false, null, null, + generalLearnerFlowDTO, false, "All"); + logger.debug("end refreshSummaryData for teacher mode."); + logger.debug("teacher uses content id: " + content.getQaContentId()); + + generalLearnerFlowDTO = (GeneralLearnerFlowDTO) request.getAttribute(GENERAL_LEARNER_FLOW_DTO); + logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); + + logger.debug("for the special case of export portfolio we place generalLearnerFlowDTO into session scope"); + request.getSession().setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + + request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "teacher"); + + qaMonitoringAction.prepareReflectionData(request, content, qaService, null, true, "All"); + + request.setAttribute("currentMonitoredToolSession", "All"); + MonitoringUtil.generateGroupsSessionData(request, qaService, content, true); + + logger.debug("ending teacher mode: "); } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java,v diff -u -r1.39 -r1.40 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 13 Nov 2006 19:38:46 -0000 1.39 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 19 Feb 2009 04:25:02 -0000 1.40 @@ -50,333 +50,288 @@ /** * - * Keeps all operations needed for Learning mode. + * Keeps all operations needed for Learning mode. + * * @author Ozgur Demirtas - * + * */ -public class LearningUtil implements QaAppConstants{ - static Logger logger = Logger.getLogger(LearningUtil.class.getName()); - - public static void saveFormRequestData(HttpServletRequest request, QaLearningForm qaLearningForm) - { - logger.debug("saving form request data..."); - String toolSessionID=request.getParameter("toolSessionID"); - logger.debug("toolSessionID: " + toolSessionID); - qaLearningForm.setToolSessionID(toolSessionID); +public class LearningUtil implements QaAppConstants { + static Logger logger = Logger.getLogger(LearningUtil.class.getName()); - String userID=request.getParameter("userID"); - logger.debug("userID: " + userID); - qaLearningForm.setUserID(userID); - - String httpSessionID=request.getParameter("httpSessionID"); - logger.debug("httpSessionID: " + httpSessionID); - qaLearningForm.setHttpSessionID(httpSessionID); - - String totalQuestionCount=request.getParameter("totalQuestionCount"); - logger.debug("totalQuestionCount: " + totalQuestionCount); - qaLearningForm.setTotalQuestionCount(totalQuestionCount); - - logger.debug("done saving form request data."); + public static void saveFormRequestData(HttpServletRequest request, QaLearningForm qaLearningForm) { + logger.debug("saving form request data..."); + String toolSessionID = request.getParameter("toolSessionID"); + logger.debug("toolSessionID: " + toolSessionID); + qaLearningForm.setToolSessionID(toolSessionID); + + String userID = request.getParameter("userID"); + logger.debug("userID: " + userID); + qaLearningForm.setUserID(userID); + + String httpSessionID = request.getParameter("httpSessionID"); + logger.debug("httpSessionID: " + httpSessionID); + qaLearningForm.setHttpSessionID(httpSessionID); + + String totalQuestionCount = request.getParameter("totalQuestionCount"); + logger.debug("totalQuestionCount: " + totalQuestionCount); + qaLearningForm.setTotalQuestionCount(totalQuestionCount); + + logger.debug("done saving form request data."); + } + + public static GeneralLearnerFlowDTO buildGeneralLearnerFlowDTO(QaContent qaContent) { + logger.debug("starting buildMcGeneralLearnerFlowDTO: " + qaContent); + GeneralLearnerFlowDTO generalLearnerFlowDTO = new GeneralLearnerFlowDTO(); + generalLearnerFlowDTO.setActivityTitle(qaContent.getTitle()); + generalLearnerFlowDTO.setActivityInstructions(qaContent.getInstructions()); + generalLearnerFlowDTO.setReportTitleLearner(qaContent.getReportTitle()); + + if (qaContent.isQuestionsSequenced()) + generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_SEQUENTIAL); + else + generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_COMBINED); + + generalLearnerFlowDTO.setUserNameVisible(new Boolean(qaContent.isUsernameVisible()).toString()); + generalLearnerFlowDTO.setShowOtherAnswers(new Boolean(qaContent.isShowOtherAnswers()).toString()); + generalLearnerFlowDTO.setActivityOffline(new Boolean(qaContent.isRunOffline()).toString()); + + logger.debug("continue buildGeneralLearnerFlowDTO: " + qaContent); + generalLearnerFlowDTO.setTotalQuestionCount(new Integer(qaContent.getQaQueContents().size())); + logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); + + Map mapQuestions = new TreeMap(new QaComparator()); + Map mapFeedback = new TreeMap(new QaComparator()); + + Iterator contentIterator = qaContent.getQaQueContents().iterator(); + while (contentIterator.hasNext()) { + QaQueContent qaQueContent = (QaQueContent) contentIterator.next(); + if (qaQueContent != null) { + int displayOrder = qaQueContent.getDisplayOrder(); + if (displayOrder != 0) { + /* + * add the question to the questions Map in the displayOrder + */ + mapQuestions.put(new Integer(displayOrder).toString(), qaQueContent.getQuestion()); + + String feedback = qaQueContent.getFeedback(); + logger.debug("feedback: " + feedback); + if (feedback == null) + feedback = ""; + + mapFeedback.put(new Integer(displayOrder).toString(), feedback.trim()); + } + } } - - public static GeneralLearnerFlowDTO buildGeneralLearnerFlowDTO(QaContent qaContent) - { - logger.debug("starting buildMcGeneralLearnerFlowDTO: " + qaContent); - GeneralLearnerFlowDTO generalLearnerFlowDTO =new GeneralLearnerFlowDTO(); - generalLearnerFlowDTO.setActivityTitle(qaContent.getTitle()); - generalLearnerFlowDTO.setActivityInstructions(qaContent.getInstructions()); - generalLearnerFlowDTO.setReportTitleLearner(qaContent.getReportTitle()); - - if (qaContent.isQuestionsSequenced()) - generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_SEQUENTIAL); - else - generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_COMBINED); - - - generalLearnerFlowDTO.setUserNameVisible(new Boolean(qaContent.isUsernameVisible()).toString()); - generalLearnerFlowDTO.setShowOtherAnswers(new Boolean(qaContent.isShowOtherAnswers()).toString()); - generalLearnerFlowDTO.setActivityOffline(new Boolean(qaContent.isRunOffline()).toString()); - - logger.debug("continue buildGeneralLearnerFlowDTO: " + qaContent); - generalLearnerFlowDTO.setTotalQuestionCount(new Integer(qaContent.getQaQueContents().size())); - logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); - - Map mapQuestions= new TreeMap(new QaComparator()); - Map mapFeedback= new TreeMap(new QaComparator()); - - Iterator contentIterator=qaContent.getQaQueContents().iterator(); - while (contentIterator.hasNext()) - { - QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); - if (qaQueContent != null) - { - int displayOrder=qaQueContent.getDisplayOrder(); - if (displayOrder != 0) - { - /* - * add the question to the questions Map in the displayOrder - */ - mapQuestions.put(new Integer(displayOrder).toString(),qaQueContent.getQuestion()); - - String feedback=qaQueContent.getFeedback(); - logger.debug("feedback: " + feedback); - if (feedback == null) feedback=""; - - mapFeedback.put(new Integer(displayOrder).toString(), feedback.trim()); - } - } - } - - logger.debug("mapFeedback: " + mapFeedback); - - generalLearnerFlowDTO.setMapFeedback(mapFeedback); - generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions); - return generalLearnerFlowDTO; + logger.debug("mapFeedback: " + mapFeedback); + + generalLearnerFlowDTO.setMapFeedback(mapFeedback); + generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions); + return generalLearnerFlowDTO; } /** * createUsersAndResponses(Map mapAnswers, HttpServletRequest request) * create users of the responses - * @param mapAnswers, request - * return void - * + * + * @param mapAnswers, + * request return void + * */ - protected void createUsersAndResponses(Map mapAnswers, HttpServletRequest request, IQaService qaService, - Long toolContentID, Long toolSessionID) - { - logger.debug("createUsers-retrieving qaService: " + qaService); - logger.debug("mapAnswers: " + mapAnswers); - logger.debug("toolContentID: " + toolContentID); - logger.debug("toolSessionID: " + toolSessionID); - - HttpSession ss = SessionManager.getSession(); - /* get back login user DTO */ - UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); - logger.debug("retrieving toolUser: " + toolUser); - logger.debug("retrieving toolUser userId: " + toolUser.getUserID()); - logger.debug("retrieving toolUser username: " + toolUser.getLogin()); + protected void createUsersAndResponses(Map mapAnswers, HttpServletRequest request, IQaService qaService, + Long toolContentID, Long toolSessionID) { + logger.debug("createUsers-retrieving qaService: " + qaService); + logger.debug("mapAnswers: " + mapAnswers); + logger.debug("toolContentID: " + toolContentID); + logger.debug("toolSessionID: " + toolSessionID); - String userName=toolUser.getLogin(); - String fullName= toolUser.getFirstName() + " " + toolUser.getLastName(); - logger.debug("retrieving toolUser fullname: " + fullName); - - Long userId=new Long(toolUser.getUserID().longValue()); - - /* - * obtain QaContent to be used in creating QaQueUsr - */ - QaContent qaContent=qaService.retrieveQa(toolContentID.longValue()); - logger.debug("createUsers-retrieving qaContent: " + qaContent); + HttpSession ss = SessionManager.getSession(); + /* get back login user DTO */ + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug("retrieving toolUser: " + toolUser); + logger.debug("retrieving toolUser userId: " + toolUser.getUserID()); + logger.debug("retrieving toolUser username: " + toolUser.getLogin()); - QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionID.longValue()); - logger.debug("createUsers-retrieving qaSession: " + qaSession); - - Iterator contentIterator=qaContent.getQaQueContents().iterator(); - logger.debug("createUsers-attempt iteration questions"); - - QaQueUsr qaQueUsr= new QaQueUsr(userId, - userName, - fullName, - null, - qaSession, - new TreeSet()); - - logger.debug("createQaQueUsr - qaQueUsr: " + qaQueUsr); - - logger.debug("session uid: " + qaSession.getUid()); - /*note that it is possible for a user to already exist from another tool session. In this case don't add any more user record*/ - QaQueUsr qaQueUsrLocal=qaService.getQaUserBySession(userId, qaSession.getUid()); - logger.debug("qaQueUsrLocal: " + qaQueUsrLocal); - - if ((qaQueUsr != null) && (qaQueUsrLocal == null)) - { - qaQueUsr=createUser(request, toolSessionID, qaService); - logger.debug("created qaQueUsr: " + qaQueUsr); - } - else - { - logger.debug("assign user"); - qaQueUsr=qaQueUsrLocal; - } - - logger.debug("qaQueUsr uid:" + qaQueUsr.getUid()); - - - boolean isResponseFinalized=qaQueUsr.isResponseFinalized(); - logger.debug("isResponseFinalized: " + isResponseFinalized); - - boolean lockWhenFinished=qaContent.isLockWhenFinished(); - logger.debug("lockWhenFinished: " + lockWhenFinished); - - boolean enableAttemptEntry=false; - boolean userAttemptExist=false; - - if (!isResponseFinalized) - { - logger.debug("type 1 attempt entry"); - enableAttemptEntry=true; - } - - if (isResponseFinalized && (!lockWhenFinished)) - { - logger.debug("type 2 attempt entry"); - logger.debug("second visit and lockWhenFinished is false, enable attempt entry"); - userAttemptExist=true; - enableAttemptEntry=true; - } - logger.debug("final enableAttemptEntry: " + enableAttemptEntry); - logger.debug("final userAttemptExist: " + userAttemptExist); - - if (enableAttemptEntry) - { - logger.debug("enableAttemptEntry is true, so creating the responses: "); - while (contentIterator.hasNext()) - { - QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); - if (qaQueContent != null) - { - logger.debug("qaQueContent uid:" + qaQueContent.getUid()); - - String question=qaQueContent.getQuestion(); - logger.debug("question:" + question); - String displayOrder=new Long(qaQueContent.getDisplayOrder()).toString(); - logger.debug("displayOrder:" + displayOrder); - String answer=(String)mapAnswers.get(displayOrder); - - logger.debug("iterationg question-answers: displayOrder: " + displayOrder + - " question: " + question + " answer: " + answer); - - String timezoneId=""; - - List attempts=qaService.getAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), qaQueContent.getUid()); - logger.debug("attempts:" + attempts); - - - if (userAttemptExist) - { - logger.debug("since userAttemptExist is true remove them:"); - qaService.removeAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), qaQueContent.getUid()); - - logger.debug("creating response."); - QaUsrResp qaUsrResp= new QaUsrResp(answer,false, - new Date(System.currentTimeMillis()), - timezoneId, - qaQueContent, - qaQueUsr, - true); + String userName = toolUser.getLogin(); + String fullName = toolUser.getFirstName() + " " + toolUser.getLastName(); + logger.debug("retrieving toolUser fullname: " + fullName); - logger.debug("iterationg qaUsrResp: " + qaUsrResp); - if (qaUsrResp != null) - { - qaService.createQaUsrResp(qaUsrResp); - logger.debug("created qaUsrResp in the db"); - } + Long userId = new Long(toolUser.getUserID().longValue()); - logger.debug("recreated user attempts since the content is not locked when finished"); - } - else - { - logger.debug("first time attempt entry or content is locked"); - if ((attempts != null) && (attempts.size() > 0)) - { - logger.debug("this user already responsed to q/a in this session:"); - } - else - { - logger.debug("creating response."); - QaUsrResp qaUsrResp= new QaUsrResp(answer,false, - new Date(System.currentTimeMillis()), - timezoneId, - qaQueContent, - qaQueUsr, - true); + /* + * obtain QaContent to be used in creating QaQueUsr + */ + QaContent qaContent = qaService.retrieveQa(toolContentID.longValue()); + logger.debug("createUsers-retrieving qaContent: " + qaContent); - logger.debug("iterationg qaUsrResp: " + qaUsrResp); - if (qaUsrResp != null) - { - qaService.createQaUsrResp(qaUsrResp); - logger.debug("created qaUsrResp in the db"); - } - } - } - } - } + QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionID.longValue()); + logger.debug("createUsers-retrieving qaSession: " + qaSession); - } - - logger.debug("current user is: " + qaQueUsr); - if (qaQueUsr != null) - { - qaQueUsr.setResponseFinalized(true); - logger.debug("finalized user input"); - qaService.updateQaQueUsr(qaQueUsr); + Iterator contentIterator = qaContent.getQaQueContents().iterator(); + logger.debug("createUsers-attempt iteration questions"); + + QaQueUsr qaQueUsr = new QaQueUsr(userId, userName, fullName, null, qaSession, new TreeSet()); + + logger.debug("createQaQueUsr - qaQueUsr: " + qaQueUsr); + + logger.debug("session uid: " + qaSession.getUid()); + /*note that it is possible for a user to already exist from another tool session. In this case don't add any more user record*/ + QaQueUsr qaQueUsrLocal = qaService.getQaUserBySession(userId, qaSession.getUid()); + logger.debug("qaQueUsrLocal: " + qaQueUsrLocal); + + if ((qaQueUsr != null) && (qaQueUsrLocal == null)) { + qaQueUsr = createUser(request, toolSessionID, qaService); + logger.debug("created qaQueUsr: " + qaQueUsr); + } else { + logger.debug("assign user"); + qaQueUsr = qaQueUsrLocal; + } + + logger.debug("qaQueUsr uid:" + qaQueUsr.getUid()); + + boolean isResponseFinalized = qaQueUsr.isResponseFinalized(); + logger.debug("isResponseFinalized: " + isResponseFinalized); + + boolean lockWhenFinished = qaContent.isLockWhenFinished(); + logger.debug("lockWhenFinished: " + lockWhenFinished); + + boolean enableAttemptEntry = false; + boolean userAttemptExist = false; + + if (!isResponseFinalized) { + logger.debug("type 1 attempt entry"); + enableAttemptEntry = true; + } + + if (isResponseFinalized && (!lockWhenFinished)) { + logger.debug("type 2 attempt entry"); + logger.debug("second visit and lockWhenFinished is false, enable attempt entry"); + userAttemptExist = true; + enableAttemptEntry = true; + } + logger.debug("final enableAttemptEntry: " + enableAttemptEntry); + logger.debug("final userAttemptExist: " + userAttemptExist); + + if (enableAttemptEntry) { + logger.debug("enableAttemptEntry is true, so creating the responses: "); + while (contentIterator.hasNext()) { + QaQueContent qaQueContent = (QaQueContent) contentIterator.next(); + if (qaQueContent != null) { + logger.debug("qaQueContent uid:" + qaQueContent.getUid()); + + String question = qaQueContent.getQuestion(); + logger.debug("question:" + question); + String displayOrder = new Long(qaQueContent.getDisplayOrder()).toString(); + logger.debug("displayOrder:" + displayOrder); + String answer = (String) mapAnswers.get(displayOrder); + + logger.debug("iterationg question-answers: displayOrder: " + displayOrder + " question: " + + question + " answer: " + answer); + + String timezoneId = ""; + + List attempts = qaService.getAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), qaQueContent + .getUid()); + logger.debug("attempts:" + attempts); + + if (userAttemptExist) { + logger.debug("since userAttemptExist is true remove them:"); + qaService.removeAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), qaQueContent.getUid()); + + logger.debug("creating response."); + QaUsrResp qaUsrResp = new QaUsrResp(answer, false, new Date(System.currentTimeMillis()), + timezoneId, qaQueContent, qaQueUsr, true); + + logger.debug("iterationg qaUsrResp: " + qaUsrResp); + if (qaUsrResp != null) { + qaService.createQaUsrResp(qaUsrResp); + logger.debug("created qaUsrResp in the db"); + } + + logger.debug("recreated user attempts since the content is not locked when finished"); + } else { + logger.debug("first time attempt entry or content is locked"); + if ((attempts != null) && (attempts.size() > 0)) { + logger.debug("this user already responsed to q/a in this session:"); + } else { + logger.debug("creating response."); + QaUsrResp qaUsrResp = new QaUsrResp(answer, false, new Date(System.currentTimeMillis()), + timezoneId, qaQueContent, qaQueUsr, true); + + logger.debug("iterationg qaUsrResp: " + qaUsrResp); + if (qaUsrResp != null) { + qaService.createQaUsrResp(qaUsrResp); + logger.debug("created qaUsrResp in the db"); + } + } + } } - } + } - - public static QaQueUsr createUser(HttpServletRequest request, Long toolSessionID, IQaService qaService) - { - logger.debug("creating a new user in the tool db, toolSessionID: " + toolSessionID); - logger.debug("qaService: " + qaService); - - Long queUsrId=QaUtils.getUserId(); - String username=QaUtils.getUserName(); - String fullname=QaUtils.getUserFullName(); - - QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionID.longValue()); - logger.debug("qaSession: " + qaSession); - - QaQueUsr qaQueUsr= new QaQueUsr(queUsrId, - username, - fullname, - null, - qaSession, - new TreeSet()); + } - qaService.createQaQueUsr(qaQueUsr); - logger.debug("created qaQueUsr in the db: " + qaQueUsr); - return qaQueUsr; + logger.debug("current user is: " + qaQueUsr); + if (qaQueUsr != null) { + qaQueUsr.setResponseFinalized(true); + logger.debug("finalized user input"); + qaService.updateQaQueUsr(qaQueUsr); } + } - protected String getRemainingQuestionCount(int currentQuestionIndex, String totalQuestionCount) - { - logger.debug("totalQuestionCount: " + totalQuestionCount); - int remainingQuestionCount=new Long(totalQuestionCount).intValue() - currentQuestionIndex +1; - logger.debug("remainingQuestionCount: " + remainingQuestionCount); + public static QaQueUsr createUser(HttpServletRequest request, Long toolSessionID, IQaService qaService) { + logger.debug("creating a new user in the tool db, toolSessionID: " + toolSessionID); + logger.debug("qaService: " + qaService); - return new Integer(remainingQuestionCount).toString(); + Long queUsrId = QaUtils.getUserId(); + String username = QaUtils.getUserName(); + String fullname = QaUtils.getUserFullName(); + + QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionID.longValue()); + logger.debug("qaSession: " + qaSession); + + QaQueUsr qaQueUsr = new QaQueUsr(queUsrId, username, fullname, null, qaSession, new TreeSet()); + + qaService.createQaQueUsr(qaQueUsr); + logger.debug("created qaQueUsr in the db: " + qaQueUsr); + return qaQueUsr; } - + protected String getRemainingQuestionCount(int currentQuestionIndex, String totalQuestionCount) { + logger.debug("totalQuestionCount: " + totalQuestionCount); + int remainingQuestionCount = new Long(totalQuestionCount).intValue() - currentQuestionIndex + 1; + logger.debug("remainingQuestionCount: " + remainingQuestionCount); + + return new Integer(remainingQuestionCount).toString(); + } + /** - * feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex) - * give user feedback on the remaining questions - * @param qaLearningForm - * return void - */ - protected String feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex, String totalQuestionCount) - { - logger.debug("totalQuestionCount: " + totalQuestionCount); - int remainingQuestionCount=new Long(totalQuestionCount).intValue() - currentQuestionIndex +1; - logger.debug("remainingQuestionCount: " + remainingQuestionCount); - String userFeedback=""; - if (remainingQuestionCount != 0) - userFeedback= "Remaining question count: " + remainingQuestionCount; - else - userFeedback= "End of the questions."; - - return userFeedback; + * feedBackAnswersProgress(HttpServletRequest request, int + * currentQuestionIndex) give user feedback on the remaining questions + * + * @param qaLearningForm + * return void + */ + protected String feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex, + String totalQuestionCount) { + logger.debug("totalQuestionCount: " + totalQuestionCount); + int remainingQuestionCount = new Long(totalQuestionCount).intValue() - currentQuestionIndex + 1; + logger.debug("remainingQuestionCount: " + remainingQuestionCount); + String userFeedback = ""; + if (remainingQuestionCount != 0) + userFeedback = "Remaining question count: " + remainingQuestionCount; + else + userFeedback = "End of the questions."; + + return userFeedback; } - - public void setContentInUse(long toolContentID, IQaService qaService) - { - QaContent qaContent=qaService.loadQa(toolContentID); - logger.debug("retrieve qaContent: " + qaContent); - - qaContent.setContentLocked(true); - logger.debug("content with id : " + toolContentID + "has been marked LOCKED"); - qaService.updateQa(qaContent); - logger.debug("content with id : " + toolContentID + "has been marked LOCKED and updated in the db"); + + public void setContentInUse(long toolContentID, IQaService qaService) { + QaContent qaContent = qaService.loadQa(toolContentID); + logger.debug("retrieve qaContent: " + qaContent); + + qaContent.setContentLocked(true); + logger.debug("content with id : " + toolContentID + "has been marked LOCKED"); + qaService.updateQa(qaContent); + logger.debug("content with id : " + toolContentID + "has been marked LOCKED and updated in the db"); } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/MonitoringUtil.java,v diff -u -r1.40 -r1.41 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java 8 Feb 2007 02:23:27 -0000 1.40 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java 19 Feb 2009 04:25:02 -0000 1.41 @@ -51,630 +51,574 @@ /** * - * Keeps all operations needed for Monitoring mode. + * Keeps all operations needed for Monitoring mode. + * * @author Ozgur Demirtas - * + * */ -public class MonitoringUtil implements QaAppConstants{ - static Logger logger = Logger.getLogger(MonitoringUtil.class.getName()); +public class MonitoringUtil implements QaAppConstants { + static Logger logger = Logger.getLogger(MonitoringUtil.class.getName()); - /** - * determine whether all the tool sessions for a particular content has been COMPLETED - * boolean isSessionsSync(HttpServletRequest request, long toolContentId) - * @param toolContentId - * @return boolean + /** + * determine whether all the tool sessions for a particular content has been + * COMPLETED boolean isSessionsSync(HttpServletRequest request, long + * toolContentId) + * + * @param toolContentId + * @return boolean + */ + public boolean isSessionsSync(QaContent qaContent) { + /* + * iterate all the tool sessions, if even one session is INCOMPLETE, the function returns false */ - public boolean isSessionsSync(QaContent qaContent) - { - /* - * iterate all the tool sessions, if even one session is INCOMPLETE, the function returns false - */ - if (qaContent != null) - { - Iterator sessionIterator=qaContent.getQaSessions().iterator(); - while (sessionIterator.hasNext()) - { - QaSession qaSession=(QaSession)sessionIterator.next(); - logger.debug("iterated qaSession : " + qaSession); - if (qaSession.getSession_status().equalsIgnoreCase(QaSession.INCOMPLETE)) - return false; - } - } - + if (qaContent != null) { + Iterator sessionIterator = qaContent.getQaSessions().iterator(); + while (sessionIterator.hasNext()) { + QaSession qaSession = (QaSession) sessionIterator.next(); + logger.debug("iterated qaSession : " + qaSession); + if (qaSession.getSession_status().equalsIgnoreCase(QaSession.INCOMPLETE)) + return false; + } + } + return true; + } + + /** + * updateResponse(HttpServletRequest request, String responseId, String + * updatedResponse) + * + * @param qaService + * @param responseId + * @param updatedResponse + */ + public void updateResponse(IQaService qaService, String responseId, String updatedResponse) { + logger.debug("load response with responseId: " + new Long(responseId).longValue()); + QaUsrResp qaUsrResp = qaService.retrieveQaUsrResp(new Long(responseId).longValue()); + logger.debug("loaded user response: " + qaUsrResp); + qaUsrResp.setAnswer(updatedResponse); + qaService.updateQaUsrResp(qaUsrResp); + logger.debug("updated user response in the db: " + qaUsrResp); + } + + /** + * hideResponse(HttpServletRequest request, String responseId) + * + * @param qaService + * @param responseId + */ + public void hideResponse(IQaService qaService, String responseId) { + logger.debug("load response with responseId for hiding: " + new Long(responseId).longValue()); + QaUsrResp qaUsrResp = qaService.retrieveQaUsrResp(new Long(responseId).longValue()); + logger.debug("loaded user response: " + qaUsrResp); + qaUsrResp.setHidden(true); + qaService.updateQaUsrResp(qaUsrResp); + logger.debug("updated user response in the db: " + qaUsrResp); + } + + /** + * unHideResponse(HttpServletRequest request, String responseId) + * + * @param request + * @param responseId + */ + public void unHideResponse(IQaService qaService, String responseId) { + logger.debug("load response with responseId for un-hiding: " + new Long(responseId).longValue()); + QaUsrResp qaUsrResp = qaService.retrieveQaUsrResp(new Long(responseId).longValue()); + logger.debug("loaded user response: " + qaUsrResp); + qaUsrResp.setHidden(false); + qaService.updateQaUsrResp(qaUsrResp); + logger.debug("updated user response in the db: " + qaUsrResp); + } + + /** + * populates all the tool sessions in a map + * populateToolSessions(HttpServletRequest request, McContent mcContent) + * + * @param request + * @param mcContent + * @return Map + */ + public static Map populateToolSessions(HttpServletRequest request, QaContent qaContent, IQaService qaService) { + List sessionsList = qaService.getSessionNamesFromContent(qaContent); + logger.debug("sessionsList size is:..." + sessionsList.size()); + + Map sessionsMap = QaUtils.convertToStringMap(sessionsList, "String"); + logger.debug("generated sessionsMap:..." + sessionsMap); + logger.debug("sessionsMap size:..." + sessionsMap.size()); + + if (sessionsMap.isEmpty()) { + logger.debug("sessionsMap size is 0:"); + sessionsMap.put(new Long(1).toString(), "None"); + } else { + logger.debug("sessionsMap has some entries: " + sessionsMap.size()); + sessionsMap.put(new Long(sessionsMap.size() + 1).toString(), "All"); } - - /** - * updateResponse(HttpServletRequest request, String responseId, String updatedResponse) - * @param qaService - * @param responseId - * @param updatedResponse - */ - public void updateResponse(IQaService qaService, String responseId, String updatedResponse) - { - logger.debug("load response with responseId: " + new Long(responseId).longValue()); - QaUsrResp qaUsrResp=qaService.retrieveQaUsrResp(new Long(responseId).longValue()); - logger.debug("loaded user response: " + qaUsrResp); - qaUsrResp.setAnswer(updatedResponse); - qaService.updateQaUsrResp(qaUsrResp); - logger.debug("updated user response in the db: " + qaUsrResp); + logger.debug("final sessionsMap:" + sessionsMap); + return sessionsMap; + } + + /** + * populates all the tool sessions in a map + * populateToolSessions(HttpServletRequest request, McContent mcContent) + * + * @param request + * @param mcContent + * @return Map + */ + public static Map populateToolSessionsId(HttpServletRequest request, QaContent qaContent, IQaService qaService) { + List sessionsList = qaService.getSessionsFromContent(qaContent); + logger.debug("sessionsList size is:..." + sessionsList.size()); + + Map sessionsMap = QaUtils.convertToStringMap(sessionsList, "Long"); + logger.debug("generated sessionsMap:..." + sessionsMap); + logger.debug("sessionsMap size:..." + sessionsMap.size()); + + if (sessionsMap.isEmpty()) { + logger.debug("sessionsMap size is 0:"); + sessionsMap.put(new Long(1).toString(), "None"); + } else { + logger.debug("sessionsMap has some entries: " + sessionsMap.size()); + sessionsMap.put(new Long(sessionsMap.size() + 1).toString(), "All"); } - - - /** - * hideResponse(HttpServletRequest request, String responseId) - * @param qaService - * @param responseId - */ - public void hideResponse(IQaService qaService, String responseId) - { - logger.debug("load response with responseId for hiding: " + new Long(responseId).longValue()); - QaUsrResp qaUsrResp=qaService.retrieveQaUsrResp(new Long(responseId).longValue()); - logger.debug("loaded user response: " + qaUsrResp); - qaUsrResp.setHidden(true); - qaService.updateQaUsrResp(qaUsrResp); - logger.debug("updated user response in the db: " + qaUsrResp); + + logger.debug("final sessionsMap:" + sessionsMap); + return sessionsMap; + } + + /** + * ends up populating the attempt history for all the users of all the tool + * sessions for a content buildGroupsQuestionData(HttpServletRequest + * request, McContent mcContent) + * + * User id is needed if isUserNamesVisible is false && is learnerRequest = + * true, as it is required to work out if the data being analysed is the + * current user. + * + * @param request + * @param mcContent + * @return List + */ + public static List buildGroupsQuestionData(HttpServletRequest request, QaContent qaContent, IQaService qaService, + boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId) { + logger.debug("buildGroupsQuestionData: " + currentSessionId); + + logger.debug("isUserNamesVisible: " + isUserNamesVisible); + logger.debug("isLearnerRequest: " + isLearnerRequest); + logger.debug("userId: " + userId); + logger.debug("qaService: " + qaService); + + logger.debug("will be building groups question data for content:..." + qaContent); + List listQuestions = qaService.getAllQuestionEntries(qaContent.getUid()); + logger.debug("listQuestions:..." + listQuestions); + + String sessionName = ""; + if ((currentSessionId != null) && (!currentSessionId.equals("All"))) { + QaSession qaSession = qaService.retrieveQaSessionOrNullById(new Long(currentSessionId).longValue()); + logger.debug("qaSession: " + qaSession); + + sessionName = qaSession.getSession_name(); } - - - /** - * unHideResponse(HttpServletRequest request, String responseId) - * @param request - * @param responseId - */ - public void unHideResponse(IQaService qaService, String responseId) - { - logger.debug("load response with responseId for un-hiding: " + new Long(responseId).longValue()); - QaUsrResp qaUsrResp=qaService.retrieveQaUsrResp(new Long(responseId).longValue()); - logger.debug("loaded user response: " + qaUsrResp); - qaUsrResp.setHidden(false); - qaService.updateQaUsrResp(qaUsrResp); - logger.debug("updated user response in the db: " + qaUsrResp); + logger.debug("sessionName: " + sessionName); + request.setAttribute(CURRENT_SESSION_NAME, sessionName); + + List listMonitoredAnswersContainerDTO = new LinkedList(); + + Iterator itListQuestions = listQuestions.iterator(); + while (itListQuestions.hasNext()) { + QaQueContent qaQueContent = (QaQueContent) itListQuestions.next(); + logger.debug("mcQueContent:..." + qaQueContent); + + if (qaQueContent != null) { + QaMonitoredAnswersDTO qaMonitoredAnswersDTO = new QaMonitoredAnswersDTO(); + qaMonitoredAnswersDTO.setQuestionUid(qaQueContent.getUid().toString()); + qaMonitoredAnswersDTO.setQuestion(qaQueContent.getQuestion()); + qaMonitoredAnswersDTO.setSessionName(sessionName); + + logger.debug("using allUsersData to retrieve users data: " + isUserNamesVisible); + Map questionAttemptData = buildGroupsAttemptData(request, qaContent, qaService, qaQueContent, + qaQueContent.getUid().toString(), isUserNamesVisible, isLearnerRequest, currentSessionId, + userId); + logger.debug("questionAttemptData:..." + questionAttemptData); + qaMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData); + listMonitoredAnswersContainerDTO.add(qaMonitoredAnswersDTO); + + } } - - - /** - * populates all the tool sessions in a map - * populateToolSessions(HttpServletRequest request, McContent mcContent) - * - * @param request - * @param mcContent - * @return Map - */ - public static Map populateToolSessions(HttpServletRequest request, QaContent qaContent, IQaService qaService) - { - List sessionsList=qaService.getSessionNamesFromContent(qaContent); - logger.debug("sessionsList size is:..." + sessionsList.size()); - - Map sessionsMap=QaUtils.convertToStringMap(sessionsList, "String"); - logger.debug("generated sessionsMap:..." + sessionsMap); - logger.debug("sessionsMap size:..." + sessionsMap.size()); - - if (sessionsMap.isEmpty()) - { - logger.debug("sessionsMap size is 0:"); - sessionsMap.put(new Long(1).toString() , "None"); + logger.debug("final listMonitoredAnswersContainerDTO:..." + listMonitoredAnswersContainerDTO); + return listMonitoredAnswersContainerDTO; + } + + /** + * User id is needed if learnerRequest = true, as it is required to work out + * if the data being analysed is the current user (for not show other names) + * or to work out which is the user's answers (for not show all answers). + */ + public static Map buildGroupsAttemptData(HttpServletRequest request, QaContent qaContent, IQaService qaService, + QaQueContent qaQueContent, String questionUid, boolean isUserNamesVisible, boolean isLearnerRequest, + String currentSessionId, String userId) { + logger.debug("doing buildGroupsAttemptData..."); + logger.debug("isUserNamesVisible: " + isUserNamesVisible); + logger.debug("isLearnerRequest: " + isLearnerRequest); + logger.debug("currentSessionId: " + currentSessionId); + logger.debug("userId: " + userId); + + logger.debug("qaService: " + qaService); + + Map mapMonitoredAttemptsContainerDTO = new TreeMap(new QaStringComparator()); + List listMonitoredAttemptsContainerDTO = new LinkedList(); + + Map summaryToolSessions = populateToolSessionsId(request, qaContent, qaService); + logger.debug("summaryToolSessions: " + summaryToolSessions); + + Iterator itMap = summaryToolSessions.entrySet().iterator(); + + /*request is for monitoring summary */ + if (!isLearnerRequest) { + + if (currentSessionId != null) { + if (currentSessionId.equals("All")) { + logger.debug("**summary request is for All**:"); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry) itMap.next(); + logger.debug("using the summary tool sessions pair: " + pairs.getKey() + " = " + + pairs.getValue()); + + if (!(pairs.getValue().toString().equals("None")) + && !(pairs.getValue().toString().equals("All"))) { + logger + .debug("using the numerical summary tool sessions pair: " + " = " + + pairs.getValue()); + QaSession qaSession = qaService.retrieveQaSession(new Long(pairs.getValue().toString()) + .longValue()); + logger.debug("qaSession: " + " = " + qaSession); + if (qaSession != null) { + List listUsers = qaService.getUserBySessionOnly(qaSession); + logger.debug("listMcUsers for session id:" + qaSession.getQaSessionId() + " = " + + listUsers); + Map sessionUsersAttempts = populateSessionUsersAttempts(request, qaService, qaSession + .getQaSessionId(), listUsers, questionUid, isUserNamesVisible, + isLearnerRequest, userId); + listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); + } + } + } + } else if (!currentSessionId.equals("All")) { + logger.debug("**summary request is for currentSessionId**:" + currentSessionId); + QaSession qaSession = qaService + .retrieveQaSession(new Long(currentSessionId.toString()).longValue()); + logger.debug("qaSession: " + " = " + qaSession); + + List listUsers = qaService.getUserBySessionOnly(qaSession); + logger.debug("listUsers: " + " = " + listUsers); + + Map sessionUsersAttempts = populateSessionUsersAttempts(request, qaService, new Long( + currentSessionId), listUsers, questionUid, isUserNamesVisible, isLearnerRequest, userId); + listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); } - else - { - logger.debug("sessionsMap has some entries: " + sessionsMap.size()); - sessionsMap.put(new Long(sessionsMap.size()+ 1).toString() , "All"); - } - - logger.debug("final sessionsMap:" + sessionsMap); - return sessionsMap; - } - - /** - * populates all the tool sessions in a map - * populateToolSessions(HttpServletRequest request, McContent mcContent) - * - * @param request - * @param mcContent - * @return Map - */ - public static Map populateToolSessionsId(HttpServletRequest request, QaContent qaContent, IQaService qaService) - { - List sessionsList=qaService.getSessionsFromContent(qaContent); - logger.debug("sessionsList size is:..." + sessionsList.size()); - - Map sessionsMap=QaUtils.convertToStringMap(sessionsList, "Long"); - logger.debug("generated sessionsMap:..." + sessionsMap); - logger.debug("sessionsMap size:..." + sessionsMap.size()); - - if (sessionsMap.isEmpty()) - { - logger.debug("sessionsMap size is 0:"); - sessionsMap.put(new Long(1).toString() , "None"); + } + } else { + /*request is for learner report, use only the passed tool session in the report. */ + logger.debug("using currentSessionId for the learner report:" + currentSessionId); + QaSession qaSession = qaService.retrieveQaSession(new Long(currentSessionId).longValue()); + logger.debug("qaSession: " + " = " + qaSession); + if (qaSession != null) { + List listUsers = null; + if (qaContent.isShowOtherAnswers()) { + listUsers = qaService.getUserBySessionOnly(qaSession); + } else { + listUsers = new ArrayList(); + QaQueUsr currentUser = qaService.getQaUserBySession(new Long(userId).longValue(), qaSession + .getUid()); + if (currentUser != null) + listUsers.add(currentUser); } - else - { - logger.debug("sessionsMap has some entries: " + sessionsMap.size()); - sessionsMap.put(new Long(sessionsMap.size()+ 1).toString() , "All"); - } - - logger.debug("final sessionsMap:" + sessionsMap); - return sessionsMap; + logger.debug("listQaUsers for session id:" + qaSession.getQaSessionId() + " = " + listUsers); + Map sessionUsersAttempts = populateSessionUsersAttempts(request, qaService, qaSession.getQaSessionId(), + listUsers, questionUid, isUserNamesVisible, isLearnerRequest, userId); + listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); + } } - - - /** - * ends up populating the attempt history for all the users of all the tool sessions for a content - * buildGroupsQuestionData(HttpServletRequest request, McContent mcContent) - * - * User id is needed if isUserNamesVisible is false && is learnerRequest = true, - * as it is required to work out if the data being analysed is the current user. - * - * @param request - * @param mcContent - * @return List - */ - public static List buildGroupsQuestionData(HttpServletRequest request, QaContent qaContent, IQaService qaService, - boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId) - { - logger.debug("buildGroupsQuestionData: " + currentSessionId); - - logger.debug("isUserNamesVisible: " + isUserNamesVisible); - logger.debug("isLearnerRequest: " + isLearnerRequest); - logger.debug("userId: " + userId); - logger.debug("qaService: " + qaService); - - logger.debug("will be building groups question data for content:..." + qaContent); - List listQuestions=qaService.getAllQuestionEntries(qaContent.getUid()); - logger.debug("listQuestions:..." + listQuestions); - - String sessionName=""; - if ((currentSessionId != null) && (!currentSessionId.equals("All"))) - { - QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(currentSessionId).longValue()); - logger.debug("qaSession: " + qaSession); - - sessionName=qaSession.getSession_name(); - } - logger.debug("sessionName: " + sessionName); - request.setAttribute(CURRENT_SESSION_NAME, sessionName); - - - List listMonitoredAnswersContainerDTO= new LinkedList(); - - Iterator itListQuestions = listQuestions.iterator(); - while (itListQuestions.hasNext()) - { - QaQueContent qaQueContent =(QaQueContent)itListQuestions.next(); - logger.debug("mcQueContent:..." + qaQueContent); - - if (qaQueContent != null) - { - QaMonitoredAnswersDTO qaMonitoredAnswersDTO= new QaMonitoredAnswersDTO(); - qaMonitoredAnswersDTO.setQuestionUid(qaQueContent.getUid().toString()); - qaMonitoredAnswersDTO.setQuestion(qaQueContent.getQuestion()); - qaMonitoredAnswersDTO.setSessionName(sessionName); - - logger.debug("using allUsersData to retrieve users data: " + isUserNamesVisible); - Map questionAttemptData= buildGroupsAttemptData(request, qaContent, qaService, qaQueContent, qaQueContent.getUid().toString(), - isUserNamesVisible,isLearnerRequest, currentSessionId, userId); - logger.debug("questionAttemptData:..." + questionAttemptData); - qaMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData); - listMonitoredAnswersContainerDTO.add(qaMonitoredAnswersDTO); - - } - } - logger.debug("final listMonitoredAnswersContainerDTO:..." + listMonitoredAnswersContainerDTO); - return listMonitoredAnswersContainerDTO; - } - - /** User id is needed if learnerRequest = true, as it is required to work out if the data being - * analysed is the current user (for not show other names) or to work out which is the user's answers - * (for not show all answers). - */ - public static Map buildGroupsAttemptData(HttpServletRequest request, QaContent qaContent, IQaService qaService, QaQueContent qaQueContent, String questionUid, - boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId) - { - logger.debug("doing buildGroupsAttemptData..."); - logger.debug("isUserNamesVisible: " + isUserNamesVisible); - logger.debug("isLearnerRequest: " + isLearnerRequest); - logger.debug("currentSessionId: " + currentSessionId); - logger.debug("userId: " + userId); - - - logger.debug("qaService: " + qaService); - Map mapMonitoredAttemptsContainerDTO= new TreeMap(new QaStringComparator()); - List listMonitoredAttemptsContainerDTO= new LinkedList(); - - Map summaryToolSessions=populateToolSessionsId(request, qaContent, qaService); - logger.debug("summaryToolSessions: " + summaryToolSessions); - - Iterator itMap = summaryToolSessions.entrySet().iterator(); - - - /*request is for monitoring summary */ - if (!isLearnerRequest) - { + logger.debug("final listMonitoredAttemptsContainerDTO:..." + listMonitoredAttemptsContainerDTO); + mapMonitoredAttemptsContainerDTO = convertToMap(listMonitoredAttemptsContainerDTO); + logger.debug("final mapMonitoredAttemptsContainerDTO:..." + mapMonitoredAttemptsContainerDTO); + return mapMonitoredAttemptsContainerDTO; + } - if (currentSessionId != null) - { - if (currentSessionId.equals("All")) - { - logger.debug("**summary request is for All**:"); - while (itMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the summary tool sessions pair: " + pairs.getKey() + " = " + pairs.getValue()); - - if (!(pairs.getValue().toString().equals("None")) && !(pairs.getValue().toString().equals("All"))) - { - logger.debug("using the numerical summary tool sessions pair: " + " = " + pairs.getValue()); - QaSession qaSession= qaService.retrieveQaSession(new Long(pairs.getValue().toString()).longValue()); - logger.debug("qaSession: " + " = " + qaSession); - if (qaSession != null) - { - List listUsers=qaService.getUserBySessionOnly(qaSession); - logger.debug("listMcUsers for session id:" + qaSession.getQaSessionId() + " = " + listUsers); - Map sessionUsersAttempts=populateSessionUsersAttempts(request, qaService, qaSession.getQaSessionId(), listUsers, questionUid, - isUserNamesVisible, isLearnerRequest, userId); - listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); - } - } - } - } - else if (!currentSessionId.equals("All")) - { - logger.debug("**summary request is for currentSessionId**:" + currentSessionId); - QaSession qaSession= qaService.retrieveQaSession(new Long(currentSessionId.toString()).longValue()); - logger.debug("qaSession: " + " = " + qaSession); - - List listUsers=qaService.getUserBySessionOnly(qaSession); - logger.debug("listUsers: " + " = " + listUsers); - - Map sessionUsersAttempts=populateSessionUsersAttempts(request, qaService, new Long(currentSessionId), listUsers, questionUid, - isUserNamesVisible, isLearnerRequest, userId); - listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); - } - } - } - else - { - /*request is for learner report, use only the passed tool session in the report. */ - logger.debug("using currentSessionId for the learner report:" + currentSessionId); - QaSession qaSession= qaService.retrieveQaSession(new Long(currentSessionId).longValue()); - logger.debug("qaSession: " + " = " + qaSession); - if (qaSession != null) - { - List listUsers=null; - if ( qaContent.isShowOtherAnswers() ) { - listUsers = qaService.getUserBySessionOnly(qaSession); - } else { - listUsers = new ArrayList(); - QaQueUsr currentUser = qaService.getQaUserBySession(new Long(userId).longValue(),qaSession.getUid()); - if ( currentUser != null ) - listUsers.add(currentUser); - } - logger.debug("listQaUsers for session id:" + qaSession.getQaSessionId() + " = " + listUsers); - Map sessionUsersAttempts=populateSessionUsersAttempts(request, qaService, qaSession.getQaSessionId(), listUsers, questionUid, - isUserNamesVisible, isLearnerRequest, userId); - listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); - } - } + /** + * Populates all the user's attempt data of a particular tool session + * populateSessionUsersAttempts(HttpServletRequest request,List listUsers) + * User id is needed if isUserNamesVisible is false && is learnerRequest = + * true, as it is required to work out if the data being analysed is the + * current user. + * + * @param request + * @param listUsers + * @return List + */ + public static Map populateSessionUsersAttempts(HttpServletRequest request, IQaService qaService, Long sessionId, + List listUsers, String questionUid, boolean isUserNamesVisible, boolean isLearnerRequest, String userId) { + logger.debug("isUserNamesVisible: " + isUserNamesVisible); + logger.debug("isLearnerRequest: " + isLearnerRequest); + logger.debug("userId: " + userId); - logger.debug("final listMonitoredAttemptsContainerDTO:..." + listMonitoredAttemptsContainerDTO); - mapMonitoredAttemptsContainerDTO=convertToMap(listMonitoredAttemptsContainerDTO); - logger.debug("final mapMonitoredAttemptsContainerDTO:..." + mapMonitoredAttemptsContainerDTO); - return mapMonitoredAttemptsContainerDTO; - } - - - /** - * Populates all the user's attempt data of a particular tool session - * populateSessionUsersAttempts(HttpServletRequest request,List listUsers) - * User id is needed if isUserNamesVisible is false && is learnerRequest = true, - * as it is required to work out if the data being analysed is the current user. - * - * @param request - * @param listUsers - * @return List - */ - public static Map populateSessionUsersAttempts(HttpServletRequest request,IQaService qaService, Long sessionId, - List listUsers, String questionUid, boolean isUserNamesVisible, boolean isLearnerRequest, String userId) - { - logger.debug("isUserNamesVisible: " + isUserNamesVisible); - logger.debug("isLearnerRequest: " + isLearnerRequest); - logger.debug("userId: " + userId); - - logger.debug("doing populateSessionUsersAttempts..."); - logger.debug("qaService: " + qaService); - - Map mapMonitoredUserContainerDTO= new TreeMap(new QaStringComparator()); - List listMonitoredUserContainerDTO= new LinkedList(); - Iterator itUsers=listUsers.iterator(); + logger.debug("doing populateSessionUsersAttempts..."); + logger.debug("qaService: " + qaService); - while (itUsers.hasNext()) - { - QaQueUsr qaQueUsr=(QaQueUsr)itUsers.next(); - logger.debug("qaQueUsr: " + qaQueUsr); - - if (qaQueUsr != null) - { - logger.debug("getting listUserAttempts for user id: " + qaQueUsr.getUid() + " and que content id: " + questionUid); - List listUserAttempts=qaService.getAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), new Long(questionUid)); - logger.debug("listUserAttempts: " + listUserAttempts); + Map mapMonitoredUserContainerDTO = new TreeMap(new QaStringComparator()); + List listMonitoredUserContainerDTO = new LinkedList(); + Iterator itUsers = listUsers.iterator(); - Iterator itAttempts=listUserAttempts.iterator(); - while (itAttempts.hasNext()) - { - QaUsrResp qaUsrResp=(QaUsrResp)itAttempts.next(); - logger.debug("qaUsrResp: " + qaUsrResp); - - if (qaUsrResp != null) - { - QaMonitoredUserDTO qaMonitoredUserDTO = new QaMonitoredUserDTO(); - qaMonitoredUserDTO.setAttemptTime(qaUsrResp.getAttemptTime()); - qaMonitoredUserDTO.setTimeZone(qaUsrResp.getTimezone()); - qaMonitoredUserDTO.setUid(qaUsrResp.getResponseId().toString()); - - if (!isUserNamesVisible && isLearnerRequest && - !userId.equals(qaQueUsr.getQueUsrId().toString()) ) { - logger.debug("this is not current user, put his name as blank."); - qaMonitoredUserDTO.setUserName(" "); - } else { - logger.debug("this is current user, put his name normally."); - qaMonitoredUserDTO.setUserName(qaQueUsr.getFullname()); - } - - qaMonitoredUserDTO.setQueUsrId(qaQueUsr.getUid().toString()); - qaMonitoredUserDTO.setSessionId(sessionId.toString()); - qaMonitoredUserDTO.setResponse(qaUsrResp.getAnswer()); - - String responsePresentable=QaUtils.replaceNewLines(qaUsrResp.getAnswer()); - logger.debug("responsePresentable: " + responsePresentable); - qaMonitoredUserDTO.setResponsePresentable(responsePresentable); + while (itUsers.hasNext()) { + QaQueUsr qaQueUsr = (QaQueUsr) itUsers.next(); + logger.debug("qaQueUsr: " + qaQueUsr); - qaMonitoredUserDTO.setQuestionUid(questionUid); - qaMonitoredUserDTO.setVisible(new Boolean(qaUsrResp.isVisible()).toString()); - listMonitoredUserContainerDTO.add(qaMonitoredUserDTO); - } - } - } + if (qaQueUsr != null) { + logger.debug("getting listUserAttempts for user id: " + qaQueUsr.getUid() + " and que content id: " + + questionUid); + List listUserAttempts = qaService.getAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), new Long( + questionUid)); + logger.debug("listUserAttempts: " + listUserAttempts); + + Iterator itAttempts = listUserAttempts.iterator(); + while (itAttempts.hasNext()) { + QaUsrResp qaUsrResp = (QaUsrResp) itAttempts.next(); + logger.debug("qaUsrResp: " + qaUsrResp); + + if (qaUsrResp != null) { + QaMonitoredUserDTO qaMonitoredUserDTO = new QaMonitoredUserDTO(); + qaMonitoredUserDTO.setAttemptTime(qaUsrResp.getAttemptTime()); + qaMonitoredUserDTO.setTimeZone(qaUsrResp.getTimezone()); + qaMonitoredUserDTO.setUid(qaUsrResp.getResponseId().toString()); + + if (!isUserNamesVisible && isLearnerRequest + && !userId.equals(qaQueUsr.getQueUsrId().toString())) { + logger.debug("this is not current user, put his name as blank."); + qaMonitoredUserDTO.setUserName(" "); + } else { + logger.debug("this is current user, put his name normally."); + qaMonitoredUserDTO.setUserName(qaQueUsr.getFullname()); + } + + qaMonitoredUserDTO.setQueUsrId(qaQueUsr.getUid().toString()); + qaMonitoredUserDTO.setSessionId(sessionId.toString()); + qaMonitoredUserDTO.setResponse(qaUsrResp.getAnswer()); + + String responsePresentable = QaUtils.replaceNewLines(qaUsrResp.getAnswer()); + logger.debug("responsePresentable: " + responsePresentable); + qaMonitoredUserDTO.setResponsePresentable(responsePresentable); + + qaMonitoredUserDTO.setQuestionUid(questionUid); + qaMonitoredUserDTO.setVisible(new Boolean(qaUsrResp.isVisible()).toString()); + listMonitoredUserContainerDTO.add(qaMonitoredUserDTO); + } } - - logger.debug("final listMonitoredUserContainerDTO: " + listMonitoredUserContainerDTO); - mapMonitoredUserContainerDTO=convertToMcMonitoredUserDTOMap(listMonitoredUserContainerDTO); - logger.debug("final mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO); - return mapMonitoredUserContainerDTO; + } } - - - public static Map convertToMcMonitoredUserDTOMap(List list) - { - logger.debug("using convertToQaMonitoredUserDTOMap: " + list); - Map map= new TreeMap(new QaStringComparator()); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - - while (listIterator.hasNext()) - { - QaMonitoredUserDTO data=(QaMonitoredUserDTO)listIterator.next(); - map.put(mapIndex.toString(), data); - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; + + logger.debug("final listMonitoredUserContainerDTO: " + listMonitoredUserContainerDTO); + mapMonitoredUserContainerDTO = convertToMcMonitoredUserDTOMap(listMonitoredUserContainerDTO); + logger.debug("final mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO); + return mapMonitoredUserContainerDTO; + } + + public static Map convertToMcMonitoredUserDTOMap(List list) { + logger.debug("using convertToQaMonitoredUserDTOMap: " + list); + Map map = new TreeMap(new QaStringComparator()); + + Iterator listIterator = list.iterator(); + Long mapIndex = new Long(1); + + while (listIterator.hasNext()) { + QaMonitoredUserDTO data = (QaMonitoredUserDTO) listIterator.next(); + map.put(mapIndex.toString(), data); + mapIndex = new Long(mapIndex.longValue() + 1); } + return map; + } - - public static Map removeNewLinesMap(Map map) - { - Map newMap= new TreeMap(new QaStringComparator()); - - Iterator itMap = map.entrySet().iterator(); - while (itMap.hasNext()) - { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the summary tool sessions pair: " + pairs.getKey() + " = " + pairs.getValue()); - newMap.put(pairs.getKey(), QaUtils.replaceNewLines(pairs.getValue().toString())); - } - logger.debug("newMap: " + newMap); - return newMap; + public static Map removeNewLinesMap(Map map) { + Map newMap = new TreeMap(new QaStringComparator()); + + Iterator itMap = map.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry) itMap.next(); + logger.debug("using the summary tool sessions pair: " + pairs.getKey() + " = " + pairs.getValue()); + newMap.put(pairs.getKey(), QaUtils.replaceNewLines(pairs.getValue().toString())); } - + logger.debug("newMap: " + newMap); + return newMap; + } - public static Map convertToMap(List list) - { - logger.debug("using convertToMap: " + list); - Map map= new TreeMap(new QaStringComparator()); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - - while (listIterator.hasNext()) - { - Map data=(Map)listIterator.next(); - map.put(mapIndex.toString(), data); - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; + public static Map convertToMap(List list) { + logger.debug("using convertToMap: " + list); + Map map = new TreeMap(new QaStringComparator()); + + Iterator listIterator = list.iterator(); + Long mapIndex = new Long(1); + + while (listIterator.hasNext()) { + Map data = (Map) listIterator.next(); + map.put(mapIndex.toString(), data); + mapIndex = new Long(mapIndex.longValue() + 1); } + return map; + } - - - - public static boolean notebookEntriesExist(IQaService qaService, QaContent qaContent) - { - logger.debug("finding out about content level notebook entries: " + qaContent); - Iterator iteratorSession= qaContent.getQaSessions().iterator(); - while (iteratorSession.hasNext()) - { - QaSession qaSession=(QaSession) iteratorSession.next(); - logger.debug("qaSession: " + qaSession); - - if (qaSession != null) - { - logger.debug("qaSession id: " + qaSession.getQaSessionId()); - - Iterator iteratorUser=qaSession.getQaQueUsers().iterator(); - while (iteratorUser.hasNext()) - { - QaQueUsr qaQueUsr=(QaQueUsr) iteratorUser.next(); - logger.debug("qaQueUsr: " + qaQueUsr); - - if (qaQueUsr != null) - { - logger.debug("qaQueUsr id: " + qaQueUsr.getQueUsrId()); - - logger.debug("attempt getting notebookEntry: "); - NotebookEntry notebookEntry = qaService.getEntry(qaSession.getQaSessionId(), - CoreNotebookConstants.NOTEBOOK_TOOL, - MY_SIGNATURE, new Integer(qaQueUsr.getQueUsrId().intValue())); - - logger.debug("notebookEntry: " + notebookEntry); - if (notebookEntry != null) - { - logger.debug("found at least one notebookEntry: " + notebookEntry.getEntry()); - return true; - } - - } - } + public static boolean notebookEntriesExist(IQaService qaService, QaContent qaContent) { + logger.debug("finding out about content level notebook entries: " + qaContent); + Iterator iteratorSession = qaContent.getQaSessions().iterator(); + while (iteratorSession.hasNext()) { + QaSession qaSession = (QaSession) iteratorSession.next(); + logger.debug("qaSession: " + qaSession); + + if (qaSession != null) { + logger.debug("qaSession id: " + qaSession.getQaSessionId()); + + Iterator iteratorUser = qaSession.getQaQueUsers().iterator(); + while (iteratorUser.hasNext()) { + QaQueUsr qaQueUsr = (QaQueUsr) iteratorUser.next(); + logger.debug("qaQueUsr: " + qaQueUsr); + + if (qaQueUsr != null) { + logger.debug("qaQueUsr id: " + qaQueUsr.getQueUsrId()); + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntry = qaService.getEntry(qaSession.getQaSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(qaQueUsr.getQueUsrId() + .intValue())); + + logger.debug("notebookEntry: " + notebookEntry); + if (notebookEntry != null) { + logger.debug("found at least one notebookEntry: " + notebookEntry.getEntry()); + return true; + } + } } - return false; + } } - - - public static void buildQaStatsDTO(HttpServletRequest request, IQaService qaService, QaContent qaContent) - { - logger.debug("building qaStatsDTO: " + qaContent); - QaStatsDTO qaStatsDTO= new QaStatsDTO(); - - int countSessionComplete=0; - int countAllUsers=0; - logger.debug("finding out about content level notebook entries: " + qaContent); - Iterator iteratorSession= qaContent.getQaSessions().iterator(); - while (iteratorSession.hasNext()) - { - QaSession qaSession=(QaSession) iteratorSession.next(); - logger.debug("qaSession: " + qaSession); - - if (qaSession != null) - { - logger.debug("qaSession id: " + qaSession.getQaSessionId()); - - if (qaSession.getSession_status().equals(COMPLETED)) - { - ++countSessionComplete; - } - - Iterator iteratorUser=qaSession.getQaQueUsers().iterator(); - while (iteratorUser.hasNext()) - { - QaQueUsr qaQueUsr=(QaQueUsr) iteratorUser.next(); - logger.debug("qaQueUsr: " + qaQueUsr); - - if (qaQueUsr != null) - { - logger.debug("qaQueUsr foundid"); - ++countAllUsers; - } - } - } + return false; + } + + public static void buildQaStatsDTO(HttpServletRequest request, IQaService qaService, QaContent qaContent) { + logger.debug("building qaStatsDTO: " + qaContent); + QaStatsDTO qaStatsDTO = new QaStatsDTO(); + + int countSessionComplete = 0; + int countAllUsers = 0; + logger.debug("finding out about content level notebook entries: " + qaContent); + Iterator iteratorSession = qaContent.getQaSessions().iterator(); + while (iteratorSession.hasNext()) { + QaSession qaSession = (QaSession) iteratorSession.next(); + logger.debug("qaSession: " + qaSession); + + if (qaSession != null) { + logger.debug("qaSession id: " + qaSession.getQaSessionId()); + + if (qaSession.getSession_status().equals(COMPLETED)) { + ++countSessionComplete; } - logger.debug("countAllUsers: " + countAllUsers); - logger.debug("countSessionComplete: " + countSessionComplete); - - - qaStatsDTO.setCountAllUsers(new Integer(countAllUsers).toString()); - qaStatsDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); - - logger.debug("qaStatsDTO: " + qaStatsDTO); - request.setAttribute(QA_STATS_DTO, qaStatsDTO); - } - - public static void generateGroupsSessionData(HttpServletRequest request, IQaService qaService, QaContent qaContent, boolean forExport) - { - logger.debug("generateGroupsSessionData: " + qaContent); - - List listAllGroupsDTO=buildGroupBasedSessionData(request, qaContent, qaService); - logger.debug("listAllGroupsDTO: " + listAllGroupsDTO); - - request.setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO); + Iterator iteratorUser = qaSession.getQaQueUsers().iterator(); + while (iteratorUser.hasNext()) { + QaQueUsr qaQueUsr = (QaQueUsr) iteratorUser.next(); + logger.debug("qaQueUsr: " + qaQueUsr); - if (forExport) - request.getSession().setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO); + if (qaQueUsr != null) { + logger.debug("qaQueUsr foundid"); + ++countAllUsers; + } + } + } } + logger.debug("countAllUsers: " + countAllUsers); + logger.debug("countSessionComplete: " + countSessionComplete); - - - public static List buildGroupBasedSessionData(HttpServletRequest request, QaContent qaContent, IQaService qaService) - { - logger.debug("buildGroupBasedSessionData" + qaContent); - logger.debug("will be building groups question data for content:..." + qaContent); - List listQuestions=qaService.getAllQuestionEntries(qaContent.getUid()); - logger.debug("listQuestions:..." + listQuestions); - - List listAllGroupsContainerDTO= new LinkedList(); - - - Iterator iteratorSession= qaContent.getQaSessions().iterator(); - while (iteratorSession.hasNext()) - { - QaSession qaSession=(QaSession) iteratorSession.next(); - logger.debug("iteration for group based session data: " + qaSession); - String currentSessionId=qaSession.getQaSessionId().toString(); - logger.debug("currentSessionId: " + currentSessionId); - - String currentSessionName=qaSession.getSession_name(); - logger.debug("currentSessionName: " + currentSessionName); - - QaAllGroupsDTO qaAllGroupsDTO= new QaAllGroupsDTO(); - List listMonitoredAnswersContainerDTO= new LinkedList(); - - if (qaSession != null) - { - Iterator itListQuestions = listQuestions.iterator(); - while (itListQuestions.hasNext()) - { - QaQueContent qaQueContent =(QaQueContent)itListQuestions.next(); - logger.debug("qaQueContent:..." + qaQueContent); - - if (qaQueContent != null) - { - logger.debug("populating QaMonitoredAnswersDTO for : " + qaQueContent); - QaMonitoredAnswersDTO qaMonitoredAnswersDTO= new QaMonitoredAnswersDTO(); - qaMonitoredAnswersDTO.setQuestionUid(qaQueContent.getUid().toString()); - qaMonitoredAnswersDTO.setQuestion(qaQueContent.getQuestion()); - qaMonitoredAnswersDTO.setSessionId(currentSessionId); - qaMonitoredAnswersDTO.setSessionName(currentSessionName); - - Map questionAttemptData= buildGroupsAttemptData(request, qaContent, qaService, qaQueContent, qaQueContent.getUid().toString(), - true,false, currentSessionId, null); - logger.debug("generated questionAttemptData: " + questionAttemptData); - qaMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData); - - logger.debug("adding qaMonitoredAnswersDTO to the listMonitoredAnswersContainerDTO: " + qaMonitoredAnswersDTO); - listMonitoredAnswersContainerDTO.add(qaMonitoredAnswersDTO); - } - } + qaStatsDTO.setCountAllUsers(new Integer(countAllUsers).toString()); + qaStatsDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); + + logger.debug("qaStatsDTO: " + qaStatsDTO); + + request.setAttribute(QA_STATS_DTO, qaStatsDTO); + } + + public static void generateGroupsSessionData(HttpServletRequest request, IQaService qaService, QaContent qaContent, + boolean forExport) { + logger.debug("generateGroupsSessionData: " + qaContent); + + List listAllGroupsDTO = buildGroupBasedSessionData(request, qaContent, qaService); + logger.debug("listAllGroupsDTO: " + listAllGroupsDTO); + + request.setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO); + + if (forExport) + request.getSession().setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO); + } + + public static List buildGroupBasedSessionData(HttpServletRequest request, QaContent qaContent, IQaService qaService) { + logger.debug("buildGroupBasedSessionData" + qaContent); + logger.debug("will be building groups question data for content:..." + qaContent); + List listQuestions = qaService.getAllQuestionEntries(qaContent.getUid()); + logger.debug("listQuestions:..." + listQuestions); + + List listAllGroupsContainerDTO = new LinkedList(); + + Iterator iteratorSession = qaContent.getQaSessions().iterator(); + while (iteratorSession.hasNext()) { + QaSession qaSession = (QaSession) iteratorSession.next(); + logger.debug("iteration for group based session data: " + qaSession); + String currentSessionId = qaSession.getQaSessionId().toString(); + logger.debug("currentSessionId: " + currentSessionId); + + String currentSessionName = qaSession.getSession_name(); + logger.debug("currentSessionName: " + currentSessionName); + + QaAllGroupsDTO qaAllGroupsDTO = new QaAllGroupsDTO(); + List listMonitoredAnswersContainerDTO = new LinkedList(); + + if (qaSession != null) { + Iterator itListQuestions = listQuestions.iterator(); + while (itListQuestions.hasNext()) { + QaQueContent qaQueContent = (QaQueContent) itListQuestions.next(); + logger.debug("qaQueContent:..." + qaQueContent); + + if (qaQueContent != null) { + logger.debug("populating QaMonitoredAnswersDTO for : " + qaQueContent); + QaMonitoredAnswersDTO qaMonitoredAnswersDTO = new QaMonitoredAnswersDTO(); + qaMonitoredAnswersDTO.setQuestionUid(qaQueContent.getUid().toString()); + qaMonitoredAnswersDTO.setQuestion(qaQueContent.getQuestion()); + qaMonitoredAnswersDTO.setSessionId(currentSessionId); + qaMonitoredAnswersDTO.setSessionName(currentSessionName); + + Map questionAttemptData = buildGroupsAttemptData(request, qaContent, qaService, qaQueContent, + qaQueContent.getUid().toString(), true, false, currentSessionId, null); + logger.debug("generated questionAttemptData: " + questionAttemptData); + qaMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData); + + logger.debug("adding qaMonitoredAnswersDTO to the listMonitoredAnswersContainerDTO: " + + qaMonitoredAnswersDTO); + listMonitoredAnswersContainerDTO.add(qaMonitoredAnswersDTO); } - logger.debug("listMonitoredAnswersContainerDTO:" + listMonitoredAnswersContainerDTO); - - logger.debug("adding listMonitoredAnswersContainerDTO to the qaAllGroupsDTO:" + listMonitoredAnswersContainerDTO); - qaAllGroupsDTO.setGroupData(listMonitoredAnswersContainerDTO); - qaAllGroupsDTO.setSessionName(currentSessionName); - qaAllGroupsDTO.setSessionId(currentSessionId); - - logger.debug("built qaAllGroupsDTO:" + qaAllGroupsDTO); - listAllGroupsContainerDTO.add(qaAllGroupsDTO); - } - - - logger.debug("final listAllGroupsContainerDTO:..." + listAllGroupsContainerDTO); - return listAllGroupsContainerDTO; - } - - -} + } + logger.debug("listMonitoredAnswersContainerDTO:" + listMonitoredAnswersContainerDTO); + logger.debug("adding listMonitoredAnswersContainerDTO to the qaAllGroupsDTO:" + + listMonitoredAnswersContainerDTO); + qaAllGroupsDTO.setGroupData(listMonitoredAnswersContainerDTO); + qaAllGroupsDTO.setSessionName(currentSessionName); + qaAllGroupsDTO.setSessionId(currentSessionId); + logger.debug("built qaAllGroupsDTO:" + qaAllGroupsDTO); + listAllGroupsContainerDTO.add(qaAllGroupsDTO); + + } + + logger.debug("final listAllGroupsContainerDTO:..." + listAllGroupsContainerDTO); + return listAllGroupsContainerDTO; + } + +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java,v diff -u -r1.26 -r1.27 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java 4 Nov 2008 00:41:19 -0000 1.26 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java 19 Feb 2009 04:25:02 -0000 1.27 @@ -82,13 +82,15 @@ *

    * *

    - * Note that Struts action class only has the responsibility to navigate page flow. All database operation should go to - * service layer and data transformation from domain model to struts form bean should go to form bean class. This ensure - * clean and maintainable code. + * Note that Struts action class only has the responsibility to navigate page + * flow. All database operation should go to service layer and data + * transformation from domain model to struts form bean should go to form bean + * class. This ensure clean and maintainable code. *

    * - * SystemException is thrown whenever an known error condition is identified. No system exception error - * handling code should appear in the Struts action class as all of them are handled in + * SystemException is thrown whenever an known error condition is + * identified. No system exception error handling code should appear in the + * Struts action class as all of them are handled in * CustomStrutsExceptionHandler. * * @author Ozgur Demirtas @@ -161,22 +163,24 @@ *

    * *

    - * It is assuming that progress engine should pass in the tool access mode and the tool session id as http - * parameters. + * It is assuming that progress engine should pass in the tool access mode + * and the tool session id as http parameters. *

    * * @param mapping - * An ActionMapping class that will be used by the Action class to tell the ActionServlet where to - * send the end-user. + * An ActionMapping class that will be used by the Action + * class to tell the ActionServlet where to send the + * end-user. * * @param form - * The ActionForm class that will contain any data submitted by the end-user via a form. + * The ActionForm class that will contain any data submitted + * by the end-user via a form. * @param request * A standard Servlet HttpServletRequest class. * @param response * A standard Servlet HttpServletResponse class. - * @return An ActionForward class that will be returned to the ActionServlet indicating where the user is to go - * next. + * @return An ActionForward class that will be returned to the ActionServlet + * indicating where the user is to go next. * @throws IOException * @throws ServletException * @throws QaApplicationException @@ -190,8 +194,10 @@ } /** - * submits content into the tool database ActionForward submitAllContent(ActionMapping mapping, ActionForm form, - * HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + * submits content into the tool database ActionForward + * submitAllContent(ActionMapping mapping, ActionForm form, + * HttpServletRequest request, HttpServletResponse response) throws + * IOException, ServletException * * @param mapping * @param form @@ -833,7 +839,8 @@ } /** - * opens up an new screen within the current page for adding a new question newQuestionBox + * opens up an new screen within the current page for adding a new question + * newQuestionBox * * @param mapping * @param form @@ -922,13 +929,14 @@ request.setAttribute(QaAppConstants.ATTR_WIZARD_ENABLED, true); request.setAttribute(QaAppConstants.ATTR_WIZARD_CATEGORIES, qaService.getWizardCategories()); } - + QaAction.logger.debug("fwd ing to newQuestionBox: "); return mapping.findForward("newQuestionBox"); } /** - * opens up an new screen within the current page for editing a question newEditableQuestionBox + * opens up an new screen within the current page for editing a question + * newEditableQuestionBox * * @param mapping * @param form @@ -1042,8 +1050,10 @@ } /** - * removes a question from the questions map ActionForward removeQuestion(ActionMapping mapping, ActionForm form, - * HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + * removes a question from the questions map ActionForward + * removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest + * request, HttpServletResponse response) throws IOException, + * ServletException * * @param mapping * @param form @@ -1487,8 +1497,10 @@ } /** - * adds a new file to content repository ActionForward addNewFile(ActionMapping mapping, ActionForm form, - * HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + * adds a new file to content repository ActionForward + * addNewFile(ActionMapping mapping, ActionForm form, HttpServletRequest + * request, HttpServletResponse response) throws IOException, + * ServletException * * @param mapping * @param form @@ -1613,8 +1625,10 @@ } /** - * deletes a file from the content repository ActionForward deleteFile(ActionMapping mapping, ActionForm form, - * HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + * deletes a file from the content repository ActionForward + * deleteFile(ActionMapping mapping, ActionForm form, HttpServletRequest + * request, HttpServletResponse response) throws IOException, + * ServletException * * @param mapping * @param form @@ -1756,7 +1770,8 @@ } /** - * addFileToContentRepository(HttpServletRequest request, QaAuthoringForm qaAuthoringForm) + * addFileToContentRepository(HttpServletRequest request, QaAuthoringForm + * qaAuthoringForm) * * @param request * @param qaAuthoringForm @@ -1872,8 +1887,9 @@ /** * - * Go through the attachments collections. Remove any content repository or tool objects matching entries in the the - * deletedAttachments collection, add any new attachments in the attachments collection. Clear the + * Go through the attachments collections. Remove any content repository or + * tool objects matching entries in the the deletedAttachments collection, + * add any new attachments in the attachments collection. Clear the * deletedAttachments collection, ready for new editing. * * @param qaContent @@ -1941,8 +1957,10 @@ } /** - * calls monitoring action summary screen generation ActionForward getSummary(ActionMapping mapping, ActionForm - * form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + * calls monitoring action summary screen generation ActionForward + * getSummary(ActionMapping mapping, ActionForm form, HttpServletRequest + * request, HttpServletResponse response) throws IOException, + * ServletException * * @param mapping * @param form @@ -1960,8 +1978,10 @@ } /** - * calls monitoring action instructions screen generation ActionForward getInstructions(ActionMapping mapping, - * ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + * calls monitoring action instructions screen generation ActionForward + * getInstructions(ActionMapping mapping, ActionForm form, + * HttpServletRequest request, HttpServletResponse response) throws + * IOException, ServletException * * @param mapping * @param form @@ -1981,8 +2001,9 @@ /** * calls monitoring action stats screen generation * - * ActionForward getStats(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse - * response) throws IOException, ServletException + * ActionForward getStats(ActionMapping mapping, ActionForm form, + * HttpServletRequest request, HttpServletResponse response) throws + * IOException, ServletException * * @param mapping * @param form @@ -2002,8 +2023,10 @@ } /** - * generates Edit Activity screen ActionForward editActivityQuestions(ActionMapping mapping, ActionForm form, - * HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ToolException + * generates Edit Activity screen ActionForward + * editActivityQuestions(ActionMapping mapping, ActionForm form, + * HttpServletRequest request, HttpServletResponse response) throws + * IOException, ServletException, ToolException * * @param mapping * @param form @@ -2148,7 +2171,8 @@ } /** - * Get the deleted condition list, which could be persisted or non-persisted items. + * Get the deleted condition list, which could be persisted or non-persisted + * items. * * @param request * @return Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAdminAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAdminAction.java,v diff -u -r1.2 -r1.3 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAdminAction.java 4 Nov 2008 05:10:34 -0000 1.2 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAdminAction.java 19 Feb 2009 04:25:02 -0000 1.3 @@ -349,13 +349,13 @@ */ @SuppressWarnings("unchecked") public ActionForward importWizard(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response){ + HttpServletResponse response) { QaAdminForm adminForm = (QaAdminForm) form; if (qaService == null) { qaService = QaServiceProxy.getQaService(this.getServlet().getServletContext()); } - + // First save the config items QaConfigItem enableQaWizard = qaService.getConfigItem(QaConfigItem.KEY_ENABLE_QAWIZARD); @@ -374,24 +374,23 @@ enableQaWizard.setConfigValue(QaAdminForm.FALSE); } qaService.saveOrUpdateConfigItem(enableQaWizard); - // Now perform the import try { String xml = new String(adminForm.getImportFile().getFileData()); XStream conversionXml = new XStream(); - SortedSet exportCategories = (SortedSet)conversionXml.fromXML(xml); + SortedSet exportCategories = (SortedSet) conversionXml.fromXML(xml); qaService.deleteAllWizardCategories(); qaService.saveOrUpdateQaWizardCategories(exportCategories); } catch (Exception e) { logger.error("Failed to import wizard model", e); request.setAttribute("error", true); - request.setAttribute("errorKey", "wizard.import.error"); + request.setAttribute("errorKey", "wizard.import.error"); request.setAttribute(ATTR_CATEGORIES, getQaWizardCategories()); return mapping.findForward("config"); - } - + } + request.setAttribute(ATTR_CATEGORIES, getQaWizardCategories()); request.setAttribute("savedSuccess", true); return mapping.findForward("config"); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAdminForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaAdminForm.java,v diff -u -r1.2 -r1.3 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAdminForm.java 4 Nov 2008 05:10:34 -0000 1.2 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAdminForm.java 19 Feb 2009 04:25:02 -0000 1.3 @@ -29,68 +29,69 @@ public class QaAdminForm extends ActionForm { public static final long serialVersionUID = 978235712395273523L; - - public static final String TRUE= "true"; - public static final String FALSE= "false"; - + + public static final String TRUE = "true"; + public static final String FALSE = "false"; + private Boolean qaWizardEnabled; private String serialiseXML; private String deleteCategoriesCSV; private String deleteSkillsCSV; private String deleteQuestionsCSV; private FormFile importFile; - - public QaAdminForm() {} + public QaAdminForm() { + } + public Boolean getQaWizardEnabled() { - return qaWizardEnabled; + return qaWizardEnabled; } public void setQaWizardEnabled(Boolean qaWizardEnabled) { - this.qaWizardEnabled = qaWizardEnabled; + this.qaWizardEnabled = qaWizardEnabled; } public void setQaWizardEnabled(String qaWizardEnabled) { this.qaWizardEnabled = qaWizardEnabled.equals(TRUE); } public String getSerialiseXML() { - return serialiseXML; + return serialiseXML; } public void setSerialiseXML(String serialiseXML) { - this.serialiseXML = serialiseXML; + this.serialiseXML = serialiseXML; } public String getDeleteCategoriesCSV() { - return deleteCategoriesCSV; + return deleteCategoriesCSV; } public void setDeleteCategoriesCSV(String deleteCategoriesCSV) { - this.deleteCategoriesCSV = deleteCategoriesCSV; + this.deleteCategoriesCSV = deleteCategoriesCSV; } public String getDeleteSkillsCSV() { - return deleteSkillsCSV; + return deleteSkillsCSV; } public void setDeleteSkillsCSV(String deleteSkillsCSV) { - this.deleteSkillsCSV = deleteSkillsCSV; + this.deleteSkillsCSV = deleteSkillsCSV; } public String getDeleteQuestionsCSV() { - return deleteQuestionsCSV; + return deleteQuestionsCSV; } public void setDeleteQuestionsCSV(String deleteQuestionsCSV) { - this.deleteQuestionsCSV = deleteQuestionsCSV; + this.deleteQuestionsCSV = deleteQuestionsCSV; } public FormFile getImportFile() { - return importFile; + return importFile; } public void setImportFile(FormFile importFile) { - this.importFile = importFile; + this.importFile = importFile; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringConditionAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringConditionAction.java,v diff -u -r1.5 -r1.6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringConditionAction.java 9 Dec 2008 05:38:14 -0000 1.5 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringConditionAction.java 19 Feb 2009 04:25:02 -0000 1.6 @@ -55,8 +55,8 @@ import org.springframework.web.context.support.WebApplicationContextUtils; /** - * Auxiliary action in author mode. It contains operations with QaCondition. The rest of operations are located in - * QaAction action. + * Auxiliary action in author mode. It contains operations with QaCondition. The + * rest of operations are located in QaAction action. * * @author Marcin Cieslak * @see org.lamsfoundation.lams.tool.qa.web.QaAction @@ -139,9 +139,11 @@ } /** - * This method will get necessary information from condition form and save or update into HttpSession - * condition list. Notice, this save is not persist them into database, just save HttpSession - * temporarily. Only they will be persist when the entire authoring page is being persisted. + * This method will get necessary information from condition form and save + * or update into HttpSession condition list. Notice, this + * save is not persist them into database, just save + * HttpSession temporarily. Only they will be persist when + * the entire authoring page is being persisted. * * @param mapping * @param form @@ -180,8 +182,9 @@ } /** - * Remove condition from HttpSession list and update page display. As authoring rule, all persist only happen when - * user submit whole page. So this remove is just impact HttpSession values. + * Remove condition from HttpSession list and update page display. As + * authoring rule, all persist only happen when user submit whole page. So + * this remove is just impact HttpSession values. * * @param mapping * @param form @@ -319,7 +322,8 @@ } /** - * Get the deleted condition list, which could be persisted or non-persisted items. + * Get the deleted condition list, which could be persisted or non-persisted + * items. * * @param request * @return Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaAuthoringForm.java,v diff -u -r1.24 -r1.25 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java 13 Nov 2006 19:38:46 -0000 1.24 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java 19 Feb 2009 04:25:02 -0000 1.25 @@ -33,745 +33,849 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ public class QaAuthoringForm extends QaLearningForm implements QaAppConstants { - protected String addContent; - protected String removeContent; - protected String removeAllContent; - protected String submitAllContent; - protected String submitTabDone; - protected String submitOfflineFile; - protected String submitOnlineFile; - protected String dispatch; - protected String currentTab; - - protected String choice; - protected String choiceBasic; - protected String choiceAdvanced; - protected String choiceInstructions; + protected String addContent; + protected String removeContent; + protected String removeAllContent; + protected String submitAllContent; + protected String submitTabDone; + protected String submitOfflineFile; + protected String submitOnlineFile; + protected String dispatch; + protected String currentTab; - protected String activeModule; - - /* basic content */ - protected String title; - protected String instructions; - protected String questionIndex; - protected String isRemoveContent; + protected String choice; + protected String choiceBasic; + protected String choiceAdvanced; + protected String choiceInstructions; - /* instructions content */ - protected String onlineInstructions; - protected String offlineInstructions; - protected FormFile theOfflineFile; - protected FormFile theOnlineFile; - - protected String toolContentID; - /* advanced content */ - protected String synchInMonitor; - protected String reportTitle; - protected String monitoringReportTitle; - protected String endLearningMessage; - protected String usernameVisible; - protected String showOtherAnswers; - protected String questionsSequenced; - protected String lockWhenFinished; - protected String reflect; - protected String reflectionSubject; - - /* proxy controllers for Monitoring tabs */ - protected String summaryMonitoring; - protected String instructionsMonitoring; - protected String editActivityMonitoring; - protected String statsMonitoring; + protected String activeModule; - protected String edit; - private String contentFolderID; - private String addSingleQuestion; - private String editableQuestionIndex; - private String feedback; - private String editQuestionBoxRequest; - - protected String defineLaterInEditMode; - protected String defaultContentIdStr; - protected Map mapQuestionContent; - protected IQaService qaService; - - - public void resetUserAction() - { - this.addContent=null; - this.removeContent=null; - this.removeAllContent=null; - this.submitAllContent=null; - this.submitTabDone=null; - this.submitOfflineFile=null; - this.submitOnlineFile=null; - - this.summaryMonitoring=null; - this.instructionsMonitoring=null; - this.editActivityMonitoring=null; - this.statsMonitoring=null; - this.edit=null; + /* basic content */ + protected String title; + protected String instructions; + protected String questionIndex; + protected String isRemoveContent; + + /* instructions content */ + protected String onlineInstructions; + protected String offlineInstructions; + protected FormFile theOfflineFile; + protected FormFile theOnlineFile; + + protected String toolContentID; + /* advanced content */ + protected String synchInMonitor; + protected String reportTitle; + protected String monitoringReportTitle; + protected String endLearningMessage; + protected String usernameVisible; + protected String showOtherAnswers; + protected String questionsSequenced; + protected String lockWhenFinished; + protected String reflect; + protected String reflectionSubject; + + /* proxy controllers for Monitoring tabs */ + protected String summaryMonitoring; + protected String instructionsMonitoring; + protected String editActivityMonitoring; + protected String statsMonitoring; + + protected String edit; + private String contentFolderID; + private String addSingleQuestion; + private String editableQuestionIndex; + private String feedback; + private String editQuestionBoxRequest; + + protected String defineLaterInEditMode; + protected String defaultContentIdStr; + protected Map mapQuestionContent; + protected IQaService qaService; + + public void resetUserAction() { + this.addContent = null; + this.removeContent = null; + this.removeAllContent = null; + this.submitAllContent = null; + this.submitTabDone = null; + this.submitOfflineFile = null; + this.submitOnlineFile = null; + + this.summaryMonitoring = null; + this.instructionsMonitoring = null; + this.editActivityMonitoring = null; + this.statsMonitoring = null; + this.edit = null; } - - public void reset() - { - this.addContent=null; - this.removeContent=null; - this.removeAllContent=null; - this.submitAllContent=null; - this.submitTabDone=null; - this.submitOfflineFile=null; - this.submitOnlineFile=null; - this.choice=null; - this.choiceBasic=null; - this.choiceAdvanced=null; - this.choiceInstructions=null; - - this.title=null; - this.instructions=null; - this.questionIndex=null; - this.isRemoveContent=null; + public void reset() { + this.addContent = null; + this.removeContent = null; + this.removeAllContent = null; + this.submitAllContent = null; + this.submitTabDone = null; + this.submitOfflineFile = null; + this.submitOnlineFile = null; - this.onlineInstructions=null; - this.offlineInstructions=null; - - this.endLearningMessage=null; - this.synchInMonitor=null; - this.reportTitle=null; - this.monitoringReportTitle=null; - this.questionsSequenced=null; - this.lockWhenFinished=null; - this.reflect=null; - - - this.summaryMonitoring=null; - this.instructionsMonitoring=null; - this.editActivityMonitoring=null; - this.statsMonitoring=null; - this.edit=null; - this.toolContentID=null; - this.currentTab=null; - } - - public void resetRadioBoxes() - { - this.synchInMonitor =OPTION_OFF; - this.usernameVisible =OPTION_OFF; - this.questionsSequenced =OPTION_OFF; - this.lockWhenFinished =OPTION_OFF; - this.reflect =OPTION_OFF; - } + this.choice = null; + this.choiceBasic = null; + this.choiceAdvanced = null; + this.choiceInstructions = null; - public String toString() { - return new ToStringBuilder(this) - .append("Listing current QaAuthoringForm properties: ") - .append("toolContentID: ", toolContentID) - .append("currentTab: ", currentTab) - .append("activeModule: ", activeModule) - .append("defaultContentIdStr: ", defaultContentIdStr) - .append("title: ", title) - .append("instructions: ", instructions) - .append("reportTitle: ", reportTitle) - .append("monitoringReportTitle: ", monitoringReportTitle) - .append("endLearningMessage: ", endLearningMessage) - .append("onlineInstructions: ", onlineInstructions) - .append("offlineInstructions: ", offlineInstructions) - .append("usernameVisible: ", usernameVisible) - .append("showOtherAnswers: ", showOtherAnswers) - .append("synchInMonitor: ", synchInMonitor) - .append("questionsSequenced: ", questionsSequenced) - .append("lockWhenFinished: ", lockWhenFinished) - .append("reflect: ", reflect) - .append("defineLaterInEditMode: ", defineLaterInEditMode) - .toString(); + this.title = null; + this.instructions = null; + this.questionIndex = null; + this.isRemoveContent = null; + + this.onlineInstructions = null; + this.offlineInstructions = null; + + this.endLearningMessage = null; + this.synchInMonitor = null; + this.reportTitle = null; + this.monitoringReportTitle = null; + this.questionsSequenced = null; + this.lockWhenFinished = null; + this.reflect = null; + + this.summaryMonitoring = null; + this.instructionsMonitoring = null; + this.editActivityMonitoring = null; + this.statsMonitoring = null; + this.edit = null; + this.toolContentID = null; + this.currentTab = null; } - - /** - * @return Returns the isRemoveContent. - */ - public String getIsRemoveContent() { - return isRemoveContent; - } - /** - * @param isRemoveContent The isRemoveContent to set. - */ - public void setIsRemoveContent(String isRemoveContent) { - this.isRemoveContent = isRemoveContent; - } - /** - * @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 addContent. - */ - public String getAddContent() { - return addContent; - } - /** - * @param addContent The addContent to set. - */ - public void setAddContent(String addContent) { - this.addContent = addContent; - } - /** - * @return Returns the removeContent. - */ - public String getRemoveContent() { - return removeContent; - } - /** - * @param removeContent The removeContent to set. - */ - public void setRemoveContent(String removeContent) { - this.removeContent = removeContent; - } - /** - * @return Returns the removeAllContent. - */ - public String getRemoveAllContent() { - return removeAllContent; - } - /** - * @param removeAllContent The removeAllContent to set. - */ - public void setRemoveAllContent(String removeAllContent) { - this.removeAllContent = removeAllContent; - } - /** - * @return Returns the submitAllContent. - */ - public String getSubmitAllContent() { - return submitAllContent; - } - /** - * @param submitAllContent The submitAllContent to set. - */ - public void setSubmitAllContent(String submitAllContent) { - this.submitAllContent = submitAllContent; - } - /** - * @return Returns the instructions. - */ - public String getInstructions() { - return instructions; - } - /** - * @param instructions The instructions to set. - */ - public void setInstructions(String instructions) { - this.instructions = instructions; - } - /** - * @return Returns the title. - */ - public String getTitle() { - return title; - } - /** - * @param title The title to set. - */ - public void setTitle(String title) { - this.title = title; - } + public void resetRadioBoxes() { + this.synchInMonitor = OPTION_OFF; + this.usernameVisible = OPTION_OFF; + this.questionsSequenced = OPTION_OFF; + this.lockWhenFinished = OPTION_OFF; + this.reflect = OPTION_OFF; + } - /** - * @return Returns the offlineInstructions. - */ - public String getOfflineInstructions() { - return offlineInstructions; - } - /** - * @param offlineInstructions The offlineInstructions to set. - */ - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } - /** - * @return Returns the onlineInstructions. - */ - public String getOnlineInstructions() { - return onlineInstructions; - } - /** - * @param onlineInstructions The onlineInstructions to set. - */ - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } - - /** - * @return Returns the syncInMonitor. - */ - public String getSynchInMonitor() { - return synchInMonitor; - } - /** - * @param syncInMonitor The syncInMonitor to set. - */ - public void setSynchInMonitor(String synchInMonitor) { - this.synchInMonitor = synchInMonitor; - } - - /** - * @return Returns the choiceAdvanced. - */ - public String getChoiceAdvanced() { - return choiceAdvanced; - } - /** - * @param choiceAdvanced The choiceAdvanced to set. - */ - public void setChoiceAdvanced(String choiceAdvanced) { - this.choiceAdvanced = choiceAdvanced; - } - /** - * @return Returns the choiceBasic. - */ - public String getChoiceBasic() { - return choiceBasic; - } - /** - * @param choiceBasic The choiceBasic to set. - */ - public void setChoiceBasic(String choiceBasic) { - this.choiceBasic = choiceBasic; - } - /** - * @return Returns the choiceInstructions. - */ - public String getChoiceInstructions() { - return choiceInstructions; - } - /** - * @param choiceInstructions The choiceInstructions to set. - */ - public void setChoiceInstructions(String choiceInstructions) { - this.choiceInstructions = choiceInstructions; - } - /** - * @return Returns the choice. - */ - public String getChoice() { - return choice; - } - /** - * @param choice The choice to set. - */ - public void setChoice(String choice) { - this.choice = choice; - } - /** - * @return Returns the reportTitle. - */ - public String getReportTitle() { - return reportTitle; - } - /** - * @param reportTitle The reportTitle to set. - */ - public void setReportTitle(String reportTitle) { - this.reportTitle = reportTitle; - } - /** - * @return Returns the usernameVisible. - */ - public String getUsernameVisible() { - return usernameVisible; - } - /** - * @param usernameVisible The usernameVisible to set. - */ - public void setUsernameVisible(String usernameVisible) { - this.usernameVisible = usernameVisible; - } - /** - * @return Returns the submitTabDone. - */ - public String getSubmitTabDone() { - return submitTabDone; - } - /** - * @param submitTabDone The submitTabDone to set. - */ - public void setSubmitTabDone(String submitTabDone) { - this.submitTabDone = submitTabDone; - } - - /** - * @return Returns the questionsSequenced. - */ - public String getQuestionsSequenced() { - return questionsSequenced; - } - /** - * @param questionsSequenced The questionsSequenced to set. - */ - public void setQuestionsSequenced(String questionsSequenced) { - this.questionsSequenced = questionsSequenced; - } - /** - * @return Returns the endLearningMessage. - */ - public String getEndLearningMessage() { - return endLearningMessage; - } - /** - * @param endLearningMessage The endLearningMessage to set. - */ - public void setEndLearningMessage(String endLearningMessage) { - this.endLearningMessage = endLearningMessage; - } - /** - * @return Returns the monitoringReportTitle. - */ - public String getMonitoringReportTitle() { - return monitoringReportTitle; - } - /** - * @param monitoringReportTitle The monitoringReportTitle to set. - */ - public void setMonitoringReportTitle(String monitoringReportTitle) { - this.monitoringReportTitle = monitoringReportTitle; - } - /** - * @return Returns the editActivityMonitoring. - */ - public String getEditActivityMonitoring() { - return editActivityMonitoring; - } - /** - * @param editActivityMonitoring The editActivityMonitoring to set. - */ - public void setEditActivityMonitoring(String editActivityMonitoring) { - this.editActivityMonitoring = editActivityMonitoring; - } - /** - * @return Returns the instructionsMonitoring. - */ - public String getInstructionsMonitoring() { - return instructionsMonitoring; - } - /** - * @param instructionsMonitoring The instructionsMonitoring to set. - */ - public void setInstructionsMonitoring(String instructionsMonitoring) { - this.instructionsMonitoring = instructionsMonitoring; - } - /** - * @return Returns the statsMonitoring. - */ - public String getStatsMonitoring() { - return statsMonitoring; - } - /** - * @param statsMonitoring The statsMonitoring to set. - */ - public void setStatsMonitoring(String statsMonitoring) { - this.statsMonitoring = statsMonitoring; - } - /** - * @return Returns the summaryMonitoring. - */ - public String getSummaryMonitoring() { - return summaryMonitoring; - } - /** - * @param summaryMonitoring The summaryMonitoring to set. - */ - public void setSummaryMonitoring(String summaryMonitoring) { - this.summaryMonitoring = summaryMonitoring; - } - /** - * @return Returns the edit. - */ - public String getEdit() { - return edit; - } - /** - * @param edit The edit to set. - */ - public void setEdit(String edit) { - this.edit = edit; - } - - /** - * @return Returns the submitOfflineFile. - */ - public String getSubmitOfflineFile() { - return submitOfflineFile; - } - /** - * @param submitOfflineFile The submitOfflineFile to set. - */ - public void setSubmitOfflineFile(String submitOfflineFile) { - this.submitOfflineFile = submitOfflineFile; - } - /** - * @param theOfflineFile The theOfflineFile to set. - */ - public void setTheOfflineFile(FormFile theOfflineFile) { - this.theOfflineFile = theOfflineFile; - } - /** - * @param theOnlineFile The theOnlineFile to set. - */ - public void setTheOnlineFile(FormFile theOnlineFile) { - this.theOnlineFile = theOnlineFile; - } - /** - * @return Returns the theOfflineFile. - */ - public FormFile getTheOfflineFile() { - return theOfflineFile; - } - /** - * @return Returns the theOnlineFile. - */ - public FormFile getTheOnlineFile() { - return theOnlineFile; - } - /** - * @return Returns the submitOnlineFile. - */ - public String getSubmitOnlineFile() { - return submitOnlineFile; - } - /** - * @param submitOnlineFile The submitOnlineFile to set. - */ - public void setSubmitOnlineFile(String submitOnlineFile) { - this.submitOnlineFile = submitOnlineFile; - } - - /** - * @return Returns the dispatch. - */ - public String getDispatch() { - return dispatch; - } - /** - * @param dispatch The dispatch to set. - */ - public void setDispatch(String dispatch) { - this.dispatch = dispatch; - } - - /** - * @return Returns the toolContentID. - */ - public String getToolContentID() { - return toolContentID; - } - /** - * @param toolContentID The toolContentID to set. - */ - public void setToolContentID(String toolContentID) { - this.toolContentID = toolContentID; - } - - - /** - * @return Returns the currentTab. - */ - public String getCurrentTab() { - return currentTab; - } - /** - * @param currentTab The currentTab to set. - */ - public void setCurrentTab(String currentTab) { - this.currentTab = currentTab; - } - - /** + public String toString() { + return new ToStringBuilder(this).append("Listing current QaAuthoringForm properties: ").append( + "toolContentID: ", toolContentID).append("currentTab: ", currentTab).append("activeModule: ", + activeModule).append("defaultContentIdStr: ", defaultContentIdStr).append("title: ", title).append( + "instructions: ", instructions).append("reportTitle: ", reportTitle).append("monitoringReportTitle: ", + monitoringReportTitle).append("endLearningMessage: ", endLearningMessage).append( + "onlineInstructions: ", onlineInstructions).append("offlineInstructions: ", offlineInstructions) + .append("usernameVisible: ", usernameVisible).append("showOtherAnswers: ", showOtherAnswers).append( + "synchInMonitor: ", synchInMonitor).append("questionsSequenced: ", questionsSequenced).append( + "lockWhenFinished: ", lockWhenFinished).append("reflect: ", reflect).append( + "defineLaterInEditMode: ", defineLaterInEditMode).toString(); + } + + /** + * @return Returns the isRemoveContent. + */ + public String getIsRemoveContent() { + return isRemoveContent; + } + + /** + * @param isRemoveContent + * The isRemoveContent to set. + */ + public void setIsRemoveContent(String isRemoveContent) { + this.isRemoveContent = isRemoveContent; + } + + /** + * @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 addContent. + */ + public String getAddContent() { + return addContent; + } + + /** + * @param addContent + * The addContent to set. + */ + public void setAddContent(String addContent) { + this.addContent = addContent; + } + + /** + * @return Returns the removeContent. + */ + public String getRemoveContent() { + return removeContent; + } + + /** + * @param removeContent + * The removeContent to set. + */ + public void setRemoveContent(String removeContent) { + this.removeContent = removeContent; + } + + /** + * @return Returns the removeAllContent. + */ + public String getRemoveAllContent() { + return removeAllContent; + } + + /** + * @param removeAllContent + * The removeAllContent to set. + */ + public void setRemoveAllContent(String removeAllContent) { + this.removeAllContent = removeAllContent; + } + + /** + * @return Returns the submitAllContent. + */ + public String getSubmitAllContent() { + return submitAllContent; + } + + /** + * @param submitAllContent + * The submitAllContent to set. + */ + public void setSubmitAllContent(String submitAllContent) { + this.submitAllContent = submitAllContent; + } + + /** + * @return Returns the instructions. + */ + public String getInstructions() { + return instructions; + } + + /** + * @param instructions + * The instructions to set. + */ + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + /** + * @return Returns the title. + */ + public String getTitle() { + return title; + } + + /** + * @param title + * The title to set. + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * @return Returns the offlineInstructions. + */ + public String getOfflineInstructions() { + return offlineInstructions; + } + + /** + * @param offlineInstructions + * The offlineInstructions to set. + */ + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } + + /** + * @return Returns the onlineInstructions. + */ + public String getOnlineInstructions() { + return onlineInstructions; + } + + /** + * @param onlineInstructions + * The onlineInstructions to set. + */ + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } + + /** + * @return Returns the syncInMonitor. + */ + public String getSynchInMonitor() { + return synchInMonitor; + } + + /** + * @param syncInMonitor + * The syncInMonitor to set. + */ + public void setSynchInMonitor(String synchInMonitor) { + this.synchInMonitor = synchInMonitor; + } + + /** + * @return Returns the choiceAdvanced. + */ + public String getChoiceAdvanced() { + return choiceAdvanced; + } + + /** + * @param choiceAdvanced + * The choiceAdvanced to set. + */ + public void setChoiceAdvanced(String choiceAdvanced) { + this.choiceAdvanced = choiceAdvanced; + } + + /** + * @return Returns the choiceBasic. + */ + public String getChoiceBasic() { + return choiceBasic; + } + + /** + * @param choiceBasic + * The choiceBasic to set. + */ + public void setChoiceBasic(String choiceBasic) { + this.choiceBasic = choiceBasic; + } + + /** + * @return Returns the choiceInstructions. + */ + public String getChoiceInstructions() { + return choiceInstructions; + } + + /** + * @param choiceInstructions + * The choiceInstructions to set. + */ + public void setChoiceInstructions(String choiceInstructions) { + this.choiceInstructions = choiceInstructions; + } + + /** + * @return Returns the choice. + */ + public String getChoice() { + return choice; + } + + /** + * @param choice + * The choice to set. + */ + public void setChoice(String choice) { + this.choice = choice; + } + + /** + * @return Returns the reportTitle. + */ + public String getReportTitle() { + return reportTitle; + } + + /** + * @param reportTitle + * The reportTitle to set. + */ + public void setReportTitle(String reportTitle) { + this.reportTitle = reportTitle; + } + + /** + * @return Returns the usernameVisible. + */ + public String getUsernameVisible() { + return usernameVisible; + } + + /** + * @param usernameVisible + * The usernameVisible to set. + */ + public void setUsernameVisible(String usernameVisible) { + this.usernameVisible = usernameVisible; + } + + /** + * @return Returns the submitTabDone. + */ + public String getSubmitTabDone() { + return submitTabDone; + } + + /** + * @param submitTabDone + * The submitTabDone to set. + */ + public void setSubmitTabDone(String submitTabDone) { + this.submitTabDone = submitTabDone; + } + + /** + * @return Returns the questionsSequenced. + */ + public String getQuestionsSequenced() { + return questionsSequenced; + } + + /** + * @param questionsSequenced + * The questionsSequenced to set. + */ + public void setQuestionsSequenced(String questionsSequenced) { + this.questionsSequenced = questionsSequenced; + } + + /** + * @return Returns the endLearningMessage. + */ + public String getEndLearningMessage() { + return endLearningMessage; + } + + /** + * @param endLearningMessage + * The endLearningMessage to set. + */ + public void setEndLearningMessage(String endLearningMessage) { + this.endLearningMessage = endLearningMessage; + } + + /** + * @return Returns the monitoringReportTitle. + */ + public String getMonitoringReportTitle() { + return monitoringReportTitle; + } + + /** + * @param monitoringReportTitle + * The monitoringReportTitle to set. + */ + public void setMonitoringReportTitle(String monitoringReportTitle) { + this.monitoringReportTitle = monitoringReportTitle; + } + + /** + * @return Returns the editActivityMonitoring. + */ + public String getEditActivityMonitoring() { + return editActivityMonitoring; + } + + /** + * @param editActivityMonitoring + * The editActivityMonitoring to set. + */ + public void setEditActivityMonitoring(String editActivityMonitoring) { + this.editActivityMonitoring = editActivityMonitoring; + } + + /** + * @return Returns the instructionsMonitoring. + */ + public String getInstructionsMonitoring() { + return instructionsMonitoring; + } + + /** + * @param instructionsMonitoring + * The instructionsMonitoring to set. + */ + public void setInstructionsMonitoring(String instructionsMonitoring) { + this.instructionsMonitoring = instructionsMonitoring; + } + + /** + * @return Returns the statsMonitoring. + */ + public String getStatsMonitoring() { + return statsMonitoring; + } + + /** + * @param statsMonitoring + * The statsMonitoring to set. + */ + public void setStatsMonitoring(String statsMonitoring) { + this.statsMonitoring = statsMonitoring; + } + + /** + * @return Returns the summaryMonitoring. + */ + public String getSummaryMonitoring() { + return summaryMonitoring; + } + + /** + * @param summaryMonitoring + * The summaryMonitoring to set. + */ + public void setSummaryMonitoring(String summaryMonitoring) { + this.summaryMonitoring = summaryMonitoring; + } + + /** + * @return Returns the edit. + */ + public String getEdit() { + return edit; + } + + /** + * @param edit + * The edit to set. + */ + public void setEdit(String edit) { + this.edit = edit; + } + + /** + * @return Returns the submitOfflineFile. + */ + public String getSubmitOfflineFile() { + return submitOfflineFile; + } + + /** + * @param submitOfflineFile + * The submitOfflineFile to set. + */ + public void setSubmitOfflineFile(String submitOfflineFile) { + this.submitOfflineFile = submitOfflineFile; + } + + /** + * @param theOfflineFile + * The theOfflineFile to set. + */ + public void setTheOfflineFile(FormFile theOfflineFile) { + this.theOfflineFile = theOfflineFile; + } + + /** + * @param theOnlineFile + * The theOnlineFile to set. + */ + public void setTheOnlineFile(FormFile theOnlineFile) { + this.theOnlineFile = theOnlineFile; + } + + /** + * @return Returns the theOfflineFile. + */ + public FormFile getTheOfflineFile() { + return theOfflineFile; + } + + /** + * @return Returns the theOnlineFile. + */ + public FormFile getTheOnlineFile() { + return theOnlineFile; + } + + /** + * @return Returns the submitOnlineFile. + */ + public String getSubmitOnlineFile() { + return submitOnlineFile; + } + + /** + * @param submitOnlineFile + * The submitOnlineFile to set. + */ + public void setSubmitOnlineFile(String submitOnlineFile) { + this.submitOnlineFile = submitOnlineFile; + } + + /** + * @return Returns the dispatch. + */ + public String getDispatch() { + return dispatch; + } + + /** + * @param dispatch + * The dispatch to set. + */ + public void setDispatch(String dispatch) { + this.dispatch = dispatch; + } + + /** + * @return Returns the toolContentID. + */ + public String getToolContentID() { + return toolContentID; + } + + /** + * @param toolContentID + * The toolContentID to set. + */ + public void setToolContentID(String toolContentID) { + this.toolContentID = toolContentID; + } + + /** + * @return Returns the currentTab. + */ + public String getCurrentTab() { + return currentTab; + } + + /** + * @param currentTab + * The currentTab to set. + */ + public void setCurrentTab(String currentTab) { + this.currentTab = currentTab; + } + + /** * @return Returns the activeModule. */ public String getActiveModule() { - return activeModule; + return activeModule; } + /** - * @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 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 qaService. */ public IQaService getQaService() { - return qaService; + return qaService; } + /** - * @param qaService The qaService to set. + * @param qaService + * The qaService to set. */ public void setQaService(IQaService qaService) { - this.qaService = qaService; + this.qaService = qaService; } - + /** * @return Returns the mapQuestionContent. */ public Map getMapQuestionContent() { - return mapQuestionContent; + return mapQuestionContent; } + /** - * @param mapQuestionContent The mapQuestionContent to set. + * @param mapQuestionContent + * The mapQuestionContent to set. */ public void setMapQuestionContent(Map mapQuestionContent) { - this.mapQuestionContent = mapQuestionContent; + this.mapQuestionContent = mapQuestionContent; } - - + /** * @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 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 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 addSingleQuestion. */ public String getAddSingleQuestion() { - return addSingleQuestion; + return addSingleQuestion; } + /** - * @param addSingleQuestion The addSingleQuestion to set. + * @param addSingleQuestion + * The addSingleQuestion to set. */ public void setAddSingleQuestion(String addSingleQuestion) { - this.addSingleQuestion = addSingleQuestion; + this.addSingleQuestion = addSingleQuestion; } + /** * @return Returns the editableQuestionIndex. */ public String getEditableQuestionIndex() { - return editableQuestionIndex; + return editableQuestionIndex; } + /** - * @param editableQuestionIndex The editableQuestionIndex to set. + * @param editableQuestionIndex + * The editableQuestionIndex to set. */ public void setEditableQuestionIndex(String editableQuestionIndex) { - this.editableQuestionIndex = editableQuestionIndex; + this.editableQuestionIndex = editableQuestionIndex; } - + /** * @return Returns the feedback. */ public String getFeedback() { - return feedback; + return feedback; } + /** - * @param feedback The feedback to set. + * @param feedback + * The feedback to set. */ public void setFeedback(String feedback) { - this.feedback = feedback; + this.feedback = feedback; } - + /** * @return Returns the editQuestionBoxRequest. */ public String getEditQuestionBoxRequest() { - return editQuestionBoxRequest; + return editQuestionBoxRequest; } + /** - * @param editQuestionBoxRequest The editQuestionBoxRequest to set. + * @param editQuestionBoxRequest + * The editQuestionBoxRequest to set. */ public void setEditQuestionBoxRequest(String editQuestionBoxRequest) { - this.editQuestionBoxRequest = editQuestionBoxRequest; + this.editQuestionBoxRequest = editQuestionBoxRequest; } + /** * @return Returns the lockWhenFinished. */ public String getLockWhenFinished() { - return lockWhenFinished; + return lockWhenFinished; } + /** - * @param lockWhenFinished The lockWhenFinished to set. + * @param lockWhenFinished + * The lockWhenFinished to set. */ public void setLockWhenFinished(String lockWhenFinished) { - this.lockWhenFinished = lockWhenFinished; + this.lockWhenFinished = lockWhenFinished; } + /** * @return Returns the showOtherAnswers. */ public String getShowOtherAnswers() { - return showOtherAnswers; + return showOtherAnswers; } + /** - * @param showOtherAnswers The showOtherAnswers to set. + * @param showOtherAnswers + * The showOtherAnswers to set. */ public void setShowOtherAnswers(String showOtherAnswers) { - this.showOtherAnswers = showOtherAnswers; + this.showOtherAnswers = showOtherAnswers; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaDLStarterAction.java,v diff -u -r1.8 -r1.9 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java 23 Sep 2006 15:11:02 -0000 1.8 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java 19 Feb 2009 04:25:02 -0000 1.9 @@ -17,44 +17,45 @@ USA http://www.gnu.org/licenses/gpl.txt -* ***********************************************************************/ + * ***********************************************************************/ /** * @author Ozgur Demirtas * * QaDLStarterAction activates the Define Later module. * It reuses majority of the functionality from existing authoring module. * - + - - - - - - - + + + + + + + * */ /* $$Id$$ */ package org.lamsfoundation.lams.tool.qa.web; + import java.io.IOException; import javax.servlet.ServletException; @@ -72,23 +73,21 @@ import org.lamsfoundation.lams.tool.qa.service.IQaService; import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; - public class QaDLStarterAction extends Action implements QaAppConstants { - static Logger logger = Logger.getLogger(QaDLStarterAction.class.getName()); + static Logger logger = Logger.getLogger(QaDLStarterAction.class.getName()); - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException, QaApplicationException { - QaUtils.cleanUpSessionAbsolute(request); - logger.debug("init defineLater mode. removed attributes..."); - - QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form; - logger.debug("qaAuthoringForm: " + qaAuthoringForm); - - IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); - qaAuthoringForm.setQaService(qaService); - - - QaStarterAction qaStarterAction= new QaStarterAction(); - return qaStarterAction.executeDefineLater(mapping, qaAuthoringForm, request, response, qaService); - } + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException, QaApplicationException { + QaUtils.cleanUpSessionAbsolute(request); + logger.debug("init defineLater mode. removed attributes..."); + + QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form; + logger.debug("qaAuthoringForm: " + qaAuthoringForm); + + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + qaAuthoringForm.setQaService(qaService); + + QaStarterAction qaStarterAction = new QaStarterAction(); + return qaStarterAction.executeDefineLater(mapping, qaAuthoringForm, request, response, qaService); + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaEmptyForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaEmptyForm.java,v diff -u -r1.10 -r1.11 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaEmptyForm.java 20 Sep 2006 15:15:42 -0000 1.10 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaEmptyForm.java 19 Feb 2009 04:25:02 -0000 1.11 @@ -28,9 +28,9 @@ /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ public class QaEmptyForm extends ActionForm { } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java,v diff -u -r1.35 -r1.36 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java 19 Feb 2009 04:04:31 -0000 1.35 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java 19 Feb 2009 04:25:02 -0000 1.36 @@ -22,74 +22,74 @@ /** * @author Ozgur Demirtas * - + - - - - - - - - - + - - + - + + - + - - - + + + + + + + + + + + * */ Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaLearningForm.java,v diff -u -r1.22 -r1.23 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java 26 Nov 2006 22:25:37 -0000 1.22 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java 19 Feb 2009 04:25:02 -0000 1.23 @@ -32,440 +32,514 @@ * @author Ozgur Demirtas */ public class QaLearningForm extends ActionForm implements QaAppConstants { - - //controls which method is called by the Lookup map */ - protected String method; - protected String answer; - protected String currentQuestionIndex; - protected String submitAnswersContent; - protected String getNextQuestion; - protected String getPreviousQuestion; - protected String endLearning; - protected String refreshAnswers; - protected String submitReflection; - protected String updateReflection; - protected String forwardtoReflection; - - protected String totalQuestionCount; - protected String httpSessionID; + //controls which method is called by the Lookup map */ + protected String method; + + protected String answer; + protected String currentQuestionIndex; + protected String submitAnswersContent; + protected String getNextQuestion; + protected String getPreviousQuestion; + protected String endLearning; + protected String refreshAnswers; + protected String submitReflection; + protected String updateReflection; + protected String forwardtoReflection; + + protected String totalQuestionCount; + protected String httpSessionID; protected String toolSessionID; - protected String questionIndex; - protected String userID; - protected String entryText; - protected String viewAllResults; - protected String viewAll; - protected String redoQuestions; - protected String responseId; - - protected String btnCombined; - protected String btnGetPrevious; - protected String btnDone; - protected String btnGetNext; - - protected String requestLearningReport; - protected String requestLearningReportProgress; - protected String requestLearningReportViewOnly; - - + protected String questionIndex; + protected String userID; + protected String entryText; + protected String viewAllResults; + protected String viewAll; + protected String redoQuestions; + protected String responseId; + + protected String btnCombined; + protected String btnGetPrevious; + protected String btnDone; + protected String btnGetNext; + + protected String requestLearningReport; + protected String requestLearningReportProgress; + protected String requestLearningReportViewOnly; + /** * @return Returns the btnCombined. */ public String getBtnCombined() { - return btnCombined; + return btnCombined; } + /** - * @param btnCombined The btnCombined to set. + * @param btnCombined + * The btnCombined to set. */ public void setBtnCombined(String btnCombined) { - this.btnCombined = btnCombined; + this.btnCombined = btnCombined; } + /** * @return Returns the btnDone. */ public String getBtnDone() { - return btnDone; + return btnDone; } + /** - * @param btnDone The btnDone to set. + * @param btnDone + * The btnDone to set. */ public void setBtnDone(String btnDone) { - this.btnDone = btnDone; + this.btnDone = btnDone; } + /** * @return Returns the btnGetNext. */ public String getBtnGetNext() { - return btnGetNext; + return btnGetNext; } + /** - * @param btnGetNext The btnGetNext to set. + * @param btnGetNext + * The btnGetNext to set. */ public void setBtnGetNext(String btnGetNext) { - this.btnGetNext = btnGetNext; + this.btnGetNext = btnGetNext; } + /** * @return Returns the btnGetPrevious. */ public String getBtnGetPrevious() { - return btnGetPrevious; + return btnGetPrevious; } + /** - * @param btnGetPrevious The btnGetPrevious to set. + * @param btnGetPrevious + * The btnGetPrevious to set. */ public void setBtnGetPrevious(String btnGetPrevious) { - this.btnGetPrevious = btnGetPrevious; + this.btnGetPrevious = btnGetPrevious; } - /** + + /** * reset user actions in learning mode + * * @param qaAuthoringForm - * return void + * return void */ - - protected void resetUserActions() - { - this.getNextQuestion=null; - this.getPreviousQuestion=null; - this.endLearning=null; - this.submitReflection=null; - this.forwardtoReflection=null; + + protected void resetUserActions() { + this.getNextQuestion = null; + this.getPreviousQuestion = null; + this.endLearning = null; + this.submitReflection = null; + this.forwardtoReflection = null; } - - protected void resetAll() - { - this.submitAnswersContent=null; - this.getNextQuestion =null; - this.getPreviousQuestion =null; - this.endLearning =null; - this.refreshAnswers =null; - this.submitReflection =null; - this.forwardtoReflection =null; - this.viewAllResults =null; - this.viewAll =null; - this.redoQuestions =null; + protected void resetAll() { + this.submitAnswersContent = null; + this.getNextQuestion = null; + this.getPreviousQuestion = null; + this.endLearning = null; + this.refreshAnswers = null; + this.submitReflection = null; + this.forwardtoReflection = null; - this.btnCombined=null; - this.btnGetPrevious=null; - this.btnDone=null; - this.btnGetNext=null; - - this.requestLearningReport =null; - this.requestLearningReportProgress =null; - this.requestLearningReportViewOnly =null; + this.viewAllResults = null; + this.viewAll = null; + this.redoQuestions = null; + + this.btnCombined = null; + this.btnGetPrevious = null; + this.btnDone = null; + this.btnGetNext = null; + + this.requestLearningReport = null; + this.requestLearningReportProgress = null; + this.requestLearningReportViewOnly = null; } - - - - /** - * @return Returns the currentQuestionIndex. - */ - public String getCurrentQuestionIndex() { - return currentQuestionIndex; - } - /** - * @param currentQuestionIndex The currentQuestionIndex to set. - */ - public void setCurrentQuestionIndex(String currentQuestionIndex) { - this.currentQuestionIndex = currentQuestionIndex; - } - /** - * @return Returns the answer. - */ - public String getAnswer() { - return answer; - } - /** - * @param answer The answer to set. - */ - public void setAnswer(String answer) { - this.answer = answer; - } - /** - * @return Returns the getNextQuestion. - */ - public String getGetNextQuestion() { - return getNextQuestion; - } - /** - * @param getNextQuestion The getNextQuestion to set. - */ - public void setGetNextQuestion(String getNextQuestion) { - this.getNextQuestion = getNextQuestion; - } - /** - * @return Returns the getPreviousQuestion. - */ - public String getGetPreviousQuestion() { - return getPreviousQuestion; - } - /** - * @param getPreviousQuestion The getPreviousQuestion to set. - */ - public void setGetPreviousQuestion(String getPreviousQuestion) { - this.getPreviousQuestion = getPreviousQuestion; - } - /** - * @return Returns the submitAnswersContent. - */ - public String getSubmitAnswersContent() { - return submitAnswersContent; - } - /** - * @param submitAnswersContent The submitAnswersContent to set. - */ - public void setSubmitAnswersContent(String submitAnswersContent) { - this.submitAnswersContent = submitAnswersContent; - } - /** - * @return Returns the endLearning. - */ - public String getEndLearning() { - return endLearning; - } - /** - * @param endLearning The endLearning to set. - */ - public void setEndLearning(String endLearning) { - this.endLearning = endLearning; - } - /** - * @return Returns the responseId. - */ - public String getResponseId() { - return responseId; - } - /** - * @param responseId The responseId to set. - */ - public void setResponseId(String responseId) { - this.responseId = responseId; - } - /** - * @return Returns the method. - */ - public String getMethod() { - return method; - } - /** - * @param method The method to set. - */ - public void setMethod(String method) { - this.method = method; - } - + /** + * @return Returns the currentQuestionIndex. + */ + public String getCurrentQuestionIndex() { + return currentQuestionIndex; + } + + /** + * @param currentQuestionIndex + * The currentQuestionIndex to set. + */ + public void setCurrentQuestionIndex(String currentQuestionIndex) { + this.currentQuestionIndex = currentQuestionIndex; + } + + /** + * @return Returns the answer. + */ + public String getAnswer() { + return answer; + } + + /** + * @param answer + * The answer to set. + */ + public void setAnswer(String answer) { + this.answer = answer; + } + + /** + * @return Returns the getNextQuestion. + */ + public String getGetNextQuestion() { + return getNextQuestion; + } + + /** + * @param getNextQuestion + * The getNextQuestion to set. + */ + public void setGetNextQuestion(String getNextQuestion) { + this.getNextQuestion = getNextQuestion; + } + + /** + * @return Returns the getPreviousQuestion. + */ + public String getGetPreviousQuestion() { + return getPreviousQuestion; + } + + /** + * @param getPreviousQuestion + * The getPreviousQuestion to set. + */ + public void setGetPreviousQuestion(String getPreviousQuestion) { + this.getPreviousQuestion = getPreviousQuestion; + } + + /** + * @return Returns the submitAnswersContent. + */ + public String getSubmitAnswersContent() { + return submitAnswersContent; + } + + /** + * @param submitAnswersContent + * The submitAnswersContent to set. + */ + public void setSubmitAnswersContent(String submitAnswersContent) { + this.submitAnswersContent = submitAnswersContent; + } + + /** + * @return Returns the endLearning. + */ + public String getEndLearning() { + return endLearning; + } + + /** + * @param endLearning + * The endLearning to set. + */ + public void setEndLearning(String endLearning) { + this.endLearning = endLearning; + } + + /** + * @return Returns the responseId. + */ + public String getResponseId() { + return responseId; + } + + /** + * @param responseId + * The responseId to set. + */ + public void setResponseId(String responseId) { + this.responseId = responseId; + } + + /** + * @return Returns the method. + */ + public String getMethod() { + return method; + } + + /** + * @param method + * The method to set. + */ + public void setMethod(String method) { + this.method = method; + } + + /** * @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 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 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 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; } - protected String mode; - + + protected String mode; + /** * @return Returns the mode. */ public String getMode() { - return mode; + return mode; } + /** - * @param mode The mode to set. + * @param mode + * The mode to set. */ public void setMode(String mode) { - this.mode = mode; - } + this.mode = mode; + } + /** * @return Returns the questionIndex. */ public String getQuestionIndex() { - return questionIndex; + return questionIndex; } + /** - * @param questionIndex The questionIndex to set. + * @param questionIndex + * The questionIndex to set. */ public void setQuestionIndex(String questionIndex) { - this.questionIndex = questionIndex; + this.questionIndex = questionIndex; } + /** * @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 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 requestLearningReportViewOnly. */ public String getRequestLearningReportViewOnly() { - return requestLearningReportViewOnly; + return requestLearningReportViewOnly; } + /** - * @param requestLearningReportViewOnly The requestLearningReportViewOnly to set. + * @param requestLearningReportViewOnly + * The requestLearningReportViewOnly to set. */ - public void setRequestLearningReportViewOnly( - String requestLearningReportViewOnly) { - this.requestLearningReportViewOnly = requestLearningReportViewOnly; + public void setRequestLearningReportViewOnly(String requestLearningReportViewOnly) { + this.requestLearningReportViewOnly = requestLearningReportViewOnly; } - + /** * @return Returns the redoQuestions. */ public String getRedoQuestions() { - return redoQuestions; + return redoQuestions; } + /** - * @param redoQuestions The redoQuestions to set. + * @param redoQuestions + * The redoQuestions to set. */ public void setRedoQuestions(String redoQuestions) { - this.redoQuestions = redoQuestions; + this.redoQuestions = redoQuestions; } + /** * @return Returns the refreshAnswers. */ public String getRefreshAnswers() { - return refreshAnswers; + return refreshAnswers; } + /** - * @param refreshAnswers The refreshAnswers to set. + * @param refreshAnswers + * The refreshAnswers to set. */ public void setRefreshAnswers(String refreshAnswers) { - this.refreshAnswers = refreshAnswers; + this.refreshAnswers = refreshAnswers; } + /** * @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 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; } + /** * @return Returns the viewAll. */ public String getViewAll() { - return viewAll; + return viewAll; } + /** - * @param viewAll The viewAll to set. + * @param viewAll + * The viewAll to set. */ public void setViewAll(String viewAll) { - this.viewAll = viewAll; + this.viewAll = viewAll; } + /** * @return Returns the updateReflection. */ public String getUpdateReflection() { - return updateReflection; + return updateReflection; } + /** - * @param updateReflection The updateReflection to set. + * @param updateReflection + * The updateReflection to set. */ public void setUpdateReflection(String updateReflection) { - this.updateReflection = updateReflection; + this.updateReflection = updateReflection; } - + } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java,v diff -u -r1.68 -r1.69 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 8 Feb 2007 02:23:27 -0000 1.68 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 19 Feb 2009 04:25:02 -0000 1.69 @@ -23,6 +23,7 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.qa.web; + import java.io.IOException; import java.util.HashMap; import java.util.Iterator; @@ -64,681 +65,595 @@ /** * * @author Ozgur Demirtas - * - * /&userId=&toolSessionId=123&mode=teacher * - * Since the toolSessionId is passed, we will derive toolContentId from the toolSessionId - * - * This class is used to load the default content and initialize the presentation Map for Learner mode + * /&userId=&toolSessionId=123&mode=teacher * + * Since the toolSessionId is passed, we will derive toolContentId from the + * toolSessionId + * + * This class is used to load the default content and initialize the + * presentation Map for Learner mode + * * createToolSession will not be called once the tool is deployed. * - * It is important that ALL the session attributes created in this action gets removed by: QaUtils.cleanupSession(request) + * It is important that ALL the session attributes created in this action gets + * removed by: QaUtils.cleanupSession(request) * */ /** * Tool Session: - * - * A tool session is the concept by which which the tool and the LAMS core manage a set of learners interacting with the tool. - * The tool session id (toolSessionId) is generated by the LAMS core and given to the tool. - * A tool session represents the use of a tool for a particulate activity for a group of learners. - * So if an activity is ungrouped, then one tool session exist for for a tool activity in a learning design. - * - * More details on the tool session id are covered under monitoring. - * When thinking about the tool content id and the tool session id, it might be helpful to think about the tool content id - * relating to the definition of an activity, whereas the tool session id relates to the runtime participation in the activity. * + * A tool session is the concept by which which the tool and the LAMS core + * manage a set of learners interacting with the tool. The tool session id + * (toolSessionId) is generated by the LAMS core and given to the tool. A tool + * session represents the use of a tool for a particulate activity for a group + * of learners. So if an activity is ungrouped, then one tool session exist for + * for a tool activity in a learning design. + * + * More details on the tool session id are covered under monitoring. When + * thinking about the tool content id and the tool session id, it might be + * helpful to think about the tool content id relating to the definition of an + * activity, whereas the tool session id relates to the runtime participation in + * the activity. + * */ /** * - * Learner URL: - * The learner url display the screen(s) that the learner uses to participate in the activity. - * When the learner accessed this user, it will have a tool access mode ToolAccessMode.LEARNER. - * - * It is the responsibility of the tool to record the progress of the user. - * If the tool is a multistage tool, for example asking a series of questions, the tool must keep track of what the learner has already done. - * If the user logs out and comes back to the tool later, then the tool should resume from where the learner stopped. - * When the user is completed with tool, then the tool notifies the progress engine by calling - * org.lamsfoundation.lams.learning.service.completeToolSession(Long toolSessionId, User learner). - * - * If the tool's content DefineLater flag is set to true, then the learner should see a "Please wait for the teacher to define this part...." - * style message. - * If the tool's content RunOffline flag is set to true, then the learner should see a "This activity is not being done on the computer. - * Please see your instructor for details." - * - * ?? Would it be better to define a run offline message in the tool? We have instructions for the teacher but not the learner. ?? - * If the tool has a LockOnFinish flag, then the tool should lock learner's entries once they have completed the activity. - * If they return to the activity (e.g. via the progress bar) then the entries should be read only. - * + * Learner URL: The learner url display the screen(s) that the learner uses to + * participate in the activity. When the learner accessed this user, it will + * have a tool access mode ToolAccessMode.LEARNER. + * + * It is the responsibility of the tool to record the progress of the user. If + * the tool is a multistage tool, for example asking a series of questions, the + * tool must keep track of what the learner has already done. If the user logs + * out and comes back to the tool later, then the tool should resume from where + * the learner stopped. When the user is completed with tool, then the tool + * notifies the progress engine by calling + * org.lamsfoundation.lams.learning.service.completeToolSession(Long + * toolSessionId, User learner). + * + * If the tool's content DefineLater flag is set to true, then the learner + * should see a "Please wait for the teacher to define this part...." style + * message. If the tool's content RunOffline flag is set to true, then the + * learner should see a "This activity is not being done on the computer. Please + * see your instructor for details." + * ?? Would it be better to define a run offline message in the tool? We have + * instructions for the teacher but not the learner. ?? If the tool has a + * LockOnFinish flag, then the tool should lock learner's entries once they have + * completed the activity. If they return to the activity (e.g. via the progress + * bar) then the entries should be read only. + * */ /** - - - - - - + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ - +public class QaLearningStarterAction extends Action implements QaAppConstants { + static Logger logger = Logger.getLogger(QaLearningStarterAction.class.getName()); - + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException, QaApplicationException { - - - - - - - - + QaUtils.cleanUpSessionAbsolute(request); - - - - * */ + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("retrieving qaService: " + qaService); -public class QaLearningStarterAction extends Action implements QaAppConstants { - static Logger logger = Logger.getLogger(QaLearningStarterAction.class.getName()); + /* holds the question contents for a given tool session and relevant content */ + Map mapQuestions = new TreeMap(new QaComparator()); - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException, QaApplicationException { - - QaUtils.cleanUpSessionAbsolute(request); + /*holds the answers */ + Map mapAnswers = new TreeMap(new QaComparator()); - IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); - logger.debug("retrieving qaService: " + qaService); + QaLearningForm qaLearningForm = (QaLearningForm) form; - /* holds the question contents for a given tool session and relevant content */ - Map mapQuestions= new TreeMap(new QaComparator()); - - /*holds the answers */ - Map mapAnswers= new TreeMap(new QaComparator()); - - QaLearningForm qaLearningForm = (QaLearningForm) form; - - GeneralLearnerFlowDTO generalLearnerFlowDTO= new GeneralLearnerFlowDTO(); - generalLearnerFlowDTO.setCurrentQuestionIndex(new Integer(1)); - generalLearnerFlowDTO.setCurrentAnswer(""); - + GeneralLearnerFlowDTO generalLearnerFlowDTO = new GeneralLearnerFlowDTO(); + generalLearnerFlowDTO.setCurrentQuestionIndex(new Integer(1)); + generalLearnerFlowDTO.setCurrentAnswer(""); - logger.debug("reading httpSessionID"); - - String httpSessionID=qaLearningForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); + logger.debug("reading httpSessionID"); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); - logger.debug("sessionMap: " + sessionMap); + String httpSessionID = qaLearningForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); - if (sessionMap == null) - { - sessionMap = new SessionMap(); - Map mapSequentialAnswers= new HashMap(); - sessionMap.put(MAP_SEQUENTIAL_ANSWERS_KEY, mapSequentialAnswers); - request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); - } - - qaLearningForm.setHttpSessionID(sessionMap.getSessionID()); - generalLearnerFlowDTO.setHttpSessionID(sessionMap.getSessionID()); - - /*validate learning mode parameters*/ - boolean validateParameters=validateParameters(request, mapping, qaLearningForm); - logger.debug("validateParamaters: " + validateParameters); - if (!validateParameters) - { - logger.debug("error during validation"); - } - - // this is the user id of the current user, set up in validateParameters - String userID=qaLearningForm.getUserID(); - logger.debug("userID: " + userID); - - /* - * use the incoming tool session id and later derive toolContentId from it. - */ - String toolSessionID=qaLearningForm.getToolSessionID(); - logger.debug("toolSessionID: " + toolSessionID); - generalLearnerFlowDTO.setToolSessionID(toolSessionID); - qaLearningForm.setToolSessionID(toolSessionID); - - /* - * By now, the passed tool session id MUST exist in the db by calling: - * public void createToolSession(Long toolSessionId, Long toolContentId) by the core. - * - * make sure this session exists in tool's session table by now. - */ - - if (!QaUtils.existsSession(new Long(toolSessionID).longValue(), qaService)) - { - QaUtils.cleanUpSessionAbsolute(request); - logger.debug("error: The tool expects mcSession."); - return (mapping.findForward(ERROR_LIST_LEARNER)); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + if (sessionMap == null) { + sessionMap = new SessionMap(); + Map mapSequentialAnswers = new HashMap(); + sessionMap.put(MAP_SEQUENTIAL_ANSWERS_KEY, mapSequentialAnswers); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + } + + qaLearningForm.setHttpSessionID(sessionMap.getSessionID()); + generalLearnerFlowDTO.setHttpSessionID(sessionMap.getSessionID()); + + /*validate learning mode parameters*/ + boolean validateParameters = validateParameters(request, mapping, qaLearningForm); + logger.debug("validateParamaters: " + validateParameters); + if (!validateParameters) { + logger.debug("error during validation"); + } + + // this is the user id of the current user, set up in validateParameters + String userID = qaLearningForm.getUserID(); + logger.debug("userID: " + userID); + + /* + * use the incoming tool session id and later derive toolContentId from it. + */ + String toolSessionID = qaLearningForm.getToolSessionID(); + logger.debug("toolSessionID: " + toolSessionID); + generalLearnerFlowDTO.setToolSessionID(toolSessionID); + qaLearningForm.setToolSessionID(toolSessionID); + + /* + * By now, the passed tool session id MUST exist in the db by calling: + * public void createToolSession(Long toolSessionId, Long toolContentId) by the core. + * + * make sure this session exists in tool's session table by now. + */ + + if (!QaUtils.existsSession(new Long(toolSessionID).longValue(), qaService)) { + QaUtils.cleanUpSessionAbsolute(request); + logger.debug("error: The tool expects mcSession."); + return (mapping.findForward(ERROR_LIST_LEARNER)); + } + + /* + * by now, we made sure that the passed tool session id exists in the db as a new record + * Make sure we can retrieve it and relavent content + */ + + QaSession qaSession = qaService.retrieveQaSessionOrNullById(new Long(toolSessionID).longValue()); + logger.debug("retrieving qaSession: " + qaSession); + /* + * find out what content this tool session is referring to + * get the content for this tool session (many to one mapping) + */ + + /* + * Each passed tool session id points to a particular content. Many to one mapping. + */ + QaContent qaContent = qaSession.getQaContent(); + logger.debug("using qaContent: " + qaContent); + if (qaContent == null) { + QaUtils.cleanUpSessionAbsolute(request); + logger.debug("error: The tool expects qaContent."); + return (mapping.findForward(ERROR_LIST_LEARNER)); + } + + generalLearnerFlowDTO.setActivityTitle(qaContent.getTitle()); + generalLearnerFlowDTO.setActivityInstructions(qaContent.getInstructions()); + + logger.debug("is tool reflective: " + qaContent.isReflect()); + generalLearnerFlowDTO.setReflection(new Boolean(qaContent.isReflect()).toString()); + logger.debug("reflection subject: " + qaContent.getReflectionSubject()); + generalLearnerFlowDTO.setReflectionSubject(qaContent.getReflectionSubject()); + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntry = qaService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(userID)); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + String notebookEntryPresentable = QaUtils.replaceNewLines(notebookEntry.getEntry()); + //String notebookEntryPresentable=notebookEntry.getEntry(); + logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); + generalLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); + } + + logger.debug("using TOOL_CONTENT_ID: " + qaContent.getQaContentId()); + generalLearnerFlowDTO.setToolContentID(qaContent.getQaContentId().toString()); + + /* + * The content we retrieved above must have been created before in Authoring time. + * And the passed tool session id refers to it. + */ + + logger.debug("REPORT_TITLE_LEARNER: " + qaContent.getReportTitle()); + generalLearnerFlowDTO.setReportTitleLearner(qaContent.getReportTitle()); + + /* + * Is the tool activity been checked as Run Offline in the property inspector? + */ + logger.debug("IS_TOOL_ACTIVITY_OFFLINE: " + qaContent.isRunOffline()); + generalLearnerFlowDTO.setActivityOffline(new Boolean(qaContent.isRunOffline()).toString()); + + logger.debug("IS_USERNAME_VISIBLE: " + qaContent.isUsernameVisible()); + generalLearnerFlowDTO.setUserNameVisible(new Boolean(qaContent.isUsernameVisible()).toString()); + generalLearnerFlowDTO.setShowOtherAnswers(new Boolean(qaContent.isShowOtherAnswers()).toString()); + + /* + * Is the tool activity been checked as Define Later in the property inspector? + */ + logger.debug("IS_DEFINE_LATER: " + qaContent.isDefineLater()); + if (qaContent.isDefineLater()) { + QaUtils.cleanUpSessionAbsolute(request); + return (mapping.findForward(DEFINE_LATER)); + } + + /* + * Learning mode requires this setting for jsp to generate the user's report + */ + logger.debug("IS_QUESTIONS_SEQUENCED: " + qaContent.isQuestionsSequenced()); + String feedBackType = ""; + if (qaContent.isQuestionsSequenced()) { + generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_SEQUENTIAL); + feedBackType = FEEDBACK_TYPE_SEQUENTIAL; + } else { + generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_COMBINED); + feedBackType = FEEDBACK_TYPE_COMBINED; + } + logger.debug("QUESTION_LISTING_MODE: " + generalLearnerFlowDTO.getQuestionListingMode()); + + /* + * fetch question content from content + */ + Iterator contentIterator = qaContent.getQaQueContents().iterator(); + while (contentIterator.hasNext()) { + QaQueContent qaQueContent = (QaQueContent) contentIterator.next(); + logger.debug("qaQueContent: " + qaQueContent); + logger.debug("question: " + qaQueContent.getQuestion()); + if (qaQueContent != null) { + int displayOrder = qaQueContent.getDisplayOrder(); + logger.debug("displayOrder: " + displayOrder); + + if (displayOrder != 0) { + /* + * add the question to the questions Map in the displayOrder + */ + mapQuestions.put(new Integer(displayOrder).toString(), qaQueContent.getQuestion()); } - - - /* - * by now, we made sure that the passed tool session id exists in the db as a new record - * Make sure we can retrieve it and relavent content - */ - - - QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(toolSessionID).longValue()); - logger.debug("retrieving qaSession: " + qaSession); - /* - * find out what content this tool session is referring to - * get the content for this tool session (many to one mapping) - */ - - /* - * Each passed tool session id points to a particular content. Many to one mapping. - */ - QaContent qaContent=qaSession.getQaContent(); - logger.debug("using qaContent: " + qaContent); - if (qaContent == null) - { - QaUtils.cleanUpSessionAbsolute(request); - logger.debug("error: The tool expects qaContent."); - return (mapping.findForward(ERROR_LIST_LEARNER)); } - - generalLearnerFlowDTO.setActivityTitle(qaContent.getTitle()); - generalLearnerFlowDTO.setActivityInstructions(qaContent.getInstructions()); - - logger.debug("is tool reflective: " + qaContent.isReflect()); - generalLearnerFlowDTO.setReflection(new Boolean(qaContent.isReflect()).toString()); - logger.debug("reflection subject: " + qaContent.getReflectionSubject()); - generalLearnerFlowDTO.setReflectionSubject(qaContent.getReflectionSubject()); - - - logger.debug("attempt getting notebookEntry: "); - NotebookEntry notebookEntry = qaService.getEntry(new Long(toolSessionID), - CoreNotebookConstants.NOTEBOOK_TOOL, - MY_SIGNATURE, new Integer(userID)); - - logger.debug("notebookEntry: " + notebookEntry); - - if (notebookEntry != null) { - String notebookEntryPresentable=QaUtils.replaceNewLines(notebookEntry.getEntry()); - //String notebookEntryPresentable=notebookEntry.getEntry(); - logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); - generalLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); - } - - + } + logger.debug("mapQuestions: " + mapQuestions); + generalLearnerFlowDTO.setMapQuestions(mapQuestions); + generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions); - logger.debug("using TOOL_CONTENT_ID: " + qaContent.getQaContentId()); - generalLearnerFlowDTO.setToolContentID(qaContent.getQaContentId().toString()); - - - /* - * The content we retrieved above must have been created before in Authoring time. - * And the passed tool session id refers to it. - */ - - - logger.debug("REPORT_TITLE_LEARNER: " + qaContent.getReportTitle()); - generalLearnerFlowDTO.setReportTitleLearner(qaContent.getReportTitle()); - - /* - * Is the tool activity been checked as Run Offline in the property inspector? - */ - logger.debug("IS_TOOL_ACTIVITY_OFFLINE: " + qaContent.isRunOffline()); - generalLearnerFlowDTO.setActivityOffline(new Boolean(qaContent.isRunOffline()).toString()); - - logger.debug("IS_USERNAME_VISIBLE: " + qaContent.isUsernameVisible()); - generalLearnerFlowDTO.setUserNameVisible(new Boolean(qaContent.isUsernameVisible()).toString()); - generalLearnerFlowDTO.setShowOtherAnswers(new Boolean(qaContent.isShowOtherAnswers()).toString()); - - /* - * Is the tool activity been checked as Define Later in the property inspector? - */ - logger.debug("IS_DEFINE_LATER: " + qaContent.isDefineLater()); - if ( qaContent.isDefineLater() ) { - QaUtils.cleanUpSessionAbsolute(request); - return (mapping.findForward(DEFINE_LATER)); - } - - /* - * Learning mode requires this setting for jsp to generate the user's report - */ - logger.debug("IS_QUESTIONS_SEQUENCED: " + qaContent.isQuestionsSequenced()); - String feedBackType=""; - if (qaContent.isQuestionsSequenced()) - { - generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_SEQUENTIAL); - feedBackType=FEEDBACK_TYPE_SEQUENTIAL; - } - else - { - generalLearnerFlowDTO.setQuestionListingMode(QUESTION_LISTING_MODE_COMBINED); - feedBackType=FEEDBACK_TYPE_COMBINED; - } - logger.debug("QUESTION_LISTING_MODE: " + generalLearnerFlowDTO.getQuestionListingMode()); - - /* - * fetch question content from content - */ - Iterator contentIterator=qaContent.getQaQueContents().iterator(); - while (contentIterator.hasNext()) - { - QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); - logger.debug("qaQueContent: " + qaQueContent); - logger.debug("question: " + qaQueContent.getQuestion()); - if (qaQueContent != null) - { - int displayOrder=qaQueContent.getDisplayOrder(); - logger.debug("displayOrder: " + displayOrder); - - if (displayOrder != 0) - { - /* - * add the question to the questions Map in the displayOrder - */ - mapQuestions.put(new Integer(displayOrder).toString(),qaQueContent.getQuestion()); - } - } - } - logger.debug("mapQuestions: " + mapQuestions); - generalLearnerFlowDTO.setMapQuestions(mapQuestions); - generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions); - - Iterator itMapQuestions = mapQuestions.entrySet().iterator(); - - while (itMapQuestions.hasNext()) - { - Map.Entry pairs = (Map.Entry)itMapQuestions.next(); - mapAnswers.put(pairs.getKey(), ""); + Iterator itMapQuestions = mapQuestions.entrySet().iterator(); - } - logger.debug("mapAnswers : " + mapAnswers); - generalLearnerFlowDTO.setMapAnswers(mapAnswers); - logger.debug("mapQuestions: " + mapQuestions); + while (itMapQuestions.hasNext()) { + Map.Entry pairs = (Map.Entry) itMapQuestions.next(); + mapAnswers.put(pairs.getKey(), ""); - logger.debug("mapQuestions has : " + mapQuestions.size() + " entries."); - - generalLearnerFlowDTO.setTotalQuestionCount(new Integer(mapQuestions.size())); - qaLearningForm.setTotalQuestionCount(new Integer(mapQuestions.size()).toString()); - - String userFeedback= feedBackType + generalLearnerFlowDTO.getTotalQuestionCount() + QUESTIONS; - - generalLearnerFlowDTO.setUserFeedback(userFeedback); - - logger.debug("remaining question count: " + generalLearnerFlowDTO.getTotalQuestionCount().toString()); - generalLearnerFlowDTO.setRemainingQuestionCount(generalLearnerFlowDTO.getTotalQuestionCount().toString()); - generalLearnerFlowDTO.setInitialScreen(new Boolean(true).toString()); - - - request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); - /* 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 - */ - /*handling PREVIEW mode*/ - String mode=qaLearningForm.getMode(); - logger.debug("mode: " + mode); - if ((mode != null) && (mode.equals("author"))) - { - logger.debug("Author requests for a preview of the content."); - } - - - int sessionUserCount=0; - if (qaSession.getQaQueUsers() != null) - { - sessionUserCount=qaSession.getQaQueUsers().size(); - } - - if (sessionUserCount > 1) - { - logger.debug("there are multiple user responses"); - generalLearnerFlowDTO.setExistMultipleUserResponses(new Boolean(true).toString()); - } + } + logger.debug("mapAnswers : " + mapAnswers); + generalLearnerFlowDTO.setMapAnswers(mapAnswers); + logger.debug("mapQuestions: " + mapQuestions); - - - - /* by now, we know that the mode is either teacher or learner - * check if the mode is teacher and request is for Learner Progress - */ - logger.debug("current userID: " + userID); - String learnerProgressUserIdString = WebUtil.readStrParam(request, AttributeNames.PARAM_USER_ID, true); - logger.debug("learnerProgressUserId: " + learnerProgressUserIdString); - - if ((learnerProgressUserIdString != null) && (mode.equals("teacher"))) - { - logger.debug("start generating learner progress report for toolSessionID: " + toolSessionID); - - /* the report should have the all entries for the users in this tool session, - * and display under the "my answers" section the answers for the user id in the url */ - qaLearningForm.setUserID(learnerProgressUserIdString); - Long learnerProgressUserId = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, false); - QaMonitoringAction qaMonitoringAction= new QaMonitoringAction(); - logger.debug("using generalLearnerFlowDTO: " + generalLearnerFlowDTO); - generalLearnerFlowDTO.setRequestLearningReport(new Boolean(true).toString()); - generalLearnerFlowDTO.setRequestLearningReportProgress(new Boolean(true).toString()); - generalLearnerFlowDTO.setTeacherViewOnly(new Boolean(true).toString()); - - qaMonitoringAction.refreshSummaryData(request, qaContent, qaService, qaContent.isUsernameVisible(), true, - toolSessionID, learnerProgressUserIdString, - generalLearnerFlowDTO, false, toolSessionID); - - logger.debug("presenting teacher's report"); - - QaQueUsr qaQueUsrLocal=qaService.getQaUserBySession(learnerProgressUserId, qaSession.getUid()); - - if ( qaQueUsrLocal != null ) { - logger.debug("qaQueUsrLocal uid : " + qaQueUsrLocal.getUid()); - generalLearnerFlowDTO.setUserUid(qaQueUsrLocal.getUid().toString()); - } else { - generalLearnerFlowDTO.setUserUid(null); - } - - logger.debug("fwd'ing to for learner progress" + INDIVIDUAL_LEARNER_REPORT); - - return (mapping.findForward(INDIVIDUAL_LEARNER_REPORT)); - } - - /* by now, we know that the mode is learner*/ - /* 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=QaUtils.isRunOffline(qaContent); - logger.debug("isRunOffline: " + isRunOffline); - if (isRunOffline == true) - { - QaUtils.cleanUpSessionAbsolute(request); - logger.debug("warning to learner: the activity is offline."); - logger.debug("fwding to :" + RUN_OFFLINE); - return (mapping.findForward(RUN_OFFLINE)); - } + logger.debug("mapQuestions has : " + mapQuestions.size() + " entries."); - - - /* - * Verify that userId does not already exist in the db. - * If it does exist and the passed tool session id exists in the db, that means the user already responded to the content and - * his answers must be displayed read-only - * - * if the user's tool session id AND user id exists in the tool tables go to learner's report. - */ - /* if the 'All Responses' has been clicked no more user entry is accepted, and isResponseFinalized() returns true*/ - logger.debug("userID:" + userID); - Long currentToolSessionID=new Long(qaLearningForm.getToolSessionID()); - logger.debug("currentToolSessionID: " + currentToolSessionID); - logger.debug("current session uid: " + qaSession.getUid()); - - boolean lockWhenFinished=qaContent.isLockWhenFinished(); - logger.debug("lockWhenFinished: " + lockWhenFinished); - - String sessionStatus=qaSession.getSession_status(); - logger.debug("sessionStatus: " + sessionStatus); - - - if (userID != null) - { - QaQueUsr qaQueUsr=qaService.getQaUserBySession(new Long(userID), qaSession.getUid()); - logger.debug("QaQueUsr:" + qaQueUsr); - - if ((qaQueUsr != null) && (qaQueUsr.isResponseFinalized())) - { - logger.debug("is current user's response finalised: " + qaQueUsr.isResponseFinalized()); - QaSession checkSession=qaQueUsr.getQaSession(); - logger.debug("checkSession:" + checkSession); - - if (checkSession != null) - { - Long checkQaSessionId=checkSession.getQaSessionId(); - logger.debug("checkQaSessionId:" + checkQaSessionId); - - if (checkQaSessionId.toString().equals(currentToolSessionID.toString())) - { - - logger.debug("the learner is in the same session and has already responsed to this content"); - logger.debug("lockWhenFinished: " + lockWhenFinished); + generalLearnerFlowDTO.setTotalQuestionCount(new Integer(mapQuestions.size())); + qaLearningForm.setTotalQuestionCount(new Integer(mapQuestions.size()).toString()); - boolean isLearnerFinished=qaQueUsr.isLearnerFinished(); - logger.debug("isLearnerFinished: " + isLearnerFinished); + String userFeedback = feedBackType + generalLearnerFlowDTO.getTotalQuestionCount() + QUESTIONS; - generalLearnerFlowDTO.setLockWhenFinished(new Boolean(lockWhenFinished).toString()); + generalLearnerFlowDTO.setUserFeedback(userFeedback); - logger.debug("isUserNamesVisible: " + qaContent.isUsernameVisible()); - Boolean isUserNamesVisibleBoolean=new Boolean(qaContent.isUsernameVisible()); - boolean isUserNamesVisible=isUserNamesVisibleBoolean.booleanValue(); - - QaMonitoringAction qaMonitoringAction= new QaMonitoringAction(); - /*the report should have all the users' entries OR - * the report should have only the current session's entries*/ - - generalLearnerFlowDTO.setRequestLearningReport(new Boolean(true).toString()); + logger.debug("remaining question count: " + generalLearnerFlowDTO.getTotalQuestionCount().toString()); + generalLearnerFlowDTO.setRemainingQuestionCount(generalLearnerFlowDTO.getTotalQuestionCount().toString()); + generalLearnerFlowDTO.setInitialScreen(new Boolean(true).toString()); - logger.debug("using generalLearnerFlowDTO: " + generalLearnerFlowDTO); - qaMonitoringAction.refreshSummaryData(request, qaContent, qaService, isUserNamesVisible, true, - currentToolSessionID.toString(), userID, generalLearnerFlowDTO, false, toolSessionID); - logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + /* 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 + */ + /*handling PREVIEW mode*/ + String mode = qaLearningForm.getMode(); + logger.debug("mode: " + mode); + if ((mode != null) && (mode.equals("author"))) { + logger.debug("Author requests for a preview of the content."); + } - logger.debug("current sessionMap: " + sessionMap); - - mapAnswers=(Map)sessionMap.get(MAP_ALL_RESULTS_KEY); - logger.debug("mapAnswers: " + mapAnswers); - - HttpSession ss = SessionManager.getSession(); - /* get back login user DTO */ - UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); - Long userId=new Long(toolUser.getUserID().longValue()); - - QaQueUsr qaQueUsrLocal=qaService.getQaUserBySession(userId, qaSession.getUid()); - logger.debug("qaQueUsrLocal: " + qaQueUsrLocal); - logger.debug("qaQueUsrLocal uid : " + qaQueUsrLocal.getUid()); - - generalLearnerFlowDTO.setUserUid(qaQueUsrLocal.getUid().toString()); - String noteBookEntry=generalLearnerFlowDTO.getNotebookEntry(); - logger.debug("noteBookEntry : " + noteBookEntry); - qaLearningForm.setEntryText(noteBookEntry); + int sessionUserCount = 0; + if (qaSession.getQaQueUsers() != null) { + sessionUserCount = qaSession.getQaQueUsers().size(); + } - - logger.debug("attempt getting notebookEntry: "); - NotebookEntry notebookEntryLocal = qaService.getEntry(new Long(toolSessionID), - CoreNotebookConstants.NOTEBOOK_TOOL, - MY_SIGNATURE, new Integer(userID)); - - logger.debug("notebookEntryLocal: " + notebookEntryLocal); - - if (notebookEntryLocal != null) { - String notebookEntryPresentable=QaUtils.replaceNewLines(notebookEntryLocal.getEntry()); - logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); - generalLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); - qaLearningForm.setEntryText(notebookEntryPresentable); - } - - - - if (isLearnerFinished) - { - logger.debug("isLearnerFinished is true"); - generalLearnerFlowDTO.setRequestLearningReportViewOnly(new Boolean(true).toString()); - - request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); - logger.debug("before fwd, GENERAL_LEARNER_FLOW_DTO: " + request.getAttribute(GENERAL_LEARNER_FLOW_DTO)); - - logger.debug("fwd'ing to." + REVISITED_LEARNER_REP); - return (mapping.findForward(REVISITED_LEARNER_REP)); - } - else - { - logger.debug("NOT true both isLearnerFinished and lockWhenFinished"); - generalLearnerFlowDTO.setRequestLearningReportViewOnly(new Boolean(false).toString()); - - request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); - logger.debug("before fwd, GENERAL_LEARNER_FLOW_DTO: " + request.getAttribute(GENERAL_LEARNER_FLOW_DTO)); - } + if (sessionUserCount > 1) { + logger.debug("there are multiple user responses"); + generalLearnerFlowDTO.setExistMultipleUserResponses(new Boolean(true).toString()); + } + /* by now, we know that the mode is either teacher or learner + * check if the mode is teacher and request is for Learner Progress + */ + logger.debug("current userID: " + userID); + String learnerProgressUserIdString = WebUtil.readStrParam(request, AttributeNames.PARAM_USER_ID, true); + logger.debug("learnerProgressUserId: " + learnerProgressUserIdString); - - logger.debug("fwd'ing to." + INDIVIDUAL_LEARNER_REPORT); - return (mapping.findForward(INDIVIDUAL_LEARNER_REPORT)); - } - } - } + if ((learnerProgressUserIdString != null) && (mode.equals("teacher"))) { + logger.debug("start generating learner progress report for toolSessionID: " + toolSessionID); + + /* the report should have the all entries for the users in this tool session, + * and display under the "my answers" section the answers for the user id in the url */ + qaLearningForm.setUserID(learnerProgressUserIdString); + Long learnerProgressUserId = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, false); + QaMonitoringAction qaMonitoringAction = new QaMonitoringAction(); + logger.debug("using generalLearnerFlowDTO: " + generalLearnerFlowDTO); + generalLearnerFlowDTO.setRequestLearningReport(new Boolean(true).toString()); + generalLearnerFlowDTO.setRequestLearningReportProgress(new Boolean(true).toString()); + generalLearnerFlowDTO.setTeacherViewOnly(new Boolean(true).toString()); + + qaMonitoringAction.refreshSummaryData(request, qaContent, qaService, qaContent.isUsernameVisible(), true, + toolSessionID, learnerProgressUserIdString, generalLearnerFlowDTO, false, toolSessionID); + + logger.debug("presenting teacher's report"); + + QaQueUsr qaQueUsrLocal = qaService.getQaUserBySession(learnerProgressUserId, qaSession.getUid()); + + if (qaQueUsrLocal != null) { + logger.debug("qaQueUsrLocal uid : " + qaQueUsrLocal.getUid()); + generalLearnerFlowDTO.setUserUid(qaQueUsrLocal.getUid().toString()); + } else { + generalLearnerFlowDTO.setUserUid(null); } - else - { - logger.debug("userId is null, it should not be, report this."); - } - - /* - * present user with the questions. - */ - request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); - logger.debug("GENERAL_LEARNER_FLOW_DTO: " + request.getAttribute(GENERAL_LEARNER_FLOW_DTO)); - logger.debug("forwarding to: " + LOAD_LEARNER); - return (mapping.findForward(LOAD_LEARNER)); + + logger.debug("fwd'ing to for learner progress" + INDIVIDUAL_LEARNER_REPORT); + + return (mapping.findForward(INDIVIDUAL_LEARNER_REPORT)); } - - /** - * validates the learning mode parameters - * @param request - * @param mapping - * @return ActionForward + /* by now, we know that the mode is learner*/ + /* 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 = QaUtils.isRunOffline(qaContent); + logger.debug("isRunOffline: " + isRunOffline); + if (isRunOffline == true) { + QaUtils.cleanUpSessionAbsolute(request); + logger.debug("warning to learner: the activity is offline."); + logger.debug("fwding to :" + RUN_OFFLINE); + return (mapping.findForward(RUN_OFFLINE)); + } + + /* + * Verify that userId does not already exist in the db. + * If it does exist and the passed tool session id exists in the db, that means the user already responded to the content and + * his answers must be displayed read-only + * + * if the user's tool session id AND user id exists in the tool tables go to learner's report. */ - protected boolean validateParameters(HttpServletRequest request, ActionMapping mapping, QaLearningForm qaLearningForm) - { - /* - * obtain and setup the current user's data - */ - String userID = ""; - HttpSession ss = SessionManager.getSession(); - logger.debug("ss: " + ss); - - if (ss != null) - { - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - if ((user != null) && (user.getUserID() != null)) - { - userID = user.getUserID().toString(); - logger.debug("retrieved userId: " + userID); - qaLearningForm.setUserID(userID); - } - } - - - /* - * process incoming tool session id and later derive toolContentId from it. - */ - String strToolSessionId=request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); - long toolSessionId=0; - if ((strToolSessionId == null) || (strToolSessionId.length() == 0)) - { - persistError(request, "error.toolSessionId.required"); - return false; - } - else - { - try - { - toolSessionId=new Long(strToolSessionId).longValue(); - logger.debug("passed TOOL_SESSION_ID : " + new Long(toolSessionId)); - qaLearningForm.setToolSessionID(new Long(toolSessionId).toString()); + /* if the 'All Responses' has been clicked no more user entry is accepted, and isResponseFinalized() returns true*/ + logger.debug("userID:" + userID); + Long currentToolSessionID = new Long(qaLearningForm.getToolSessionID()); + logger.debug("currentToolSessionID: " + currentToolSessionID); + logger.debug("current session uid: " + qaSession.getUid()); + + boolean lockWhenFinished = qaContent.isLockWhenFinished(); + logger.debug("lockWhenFinished: " + lockWhenFinished); + + String sessionStatus = qaSession.getSession_status(); + logger.debug("sessionStatus: " + sessionStatus); + + if (userID != null) { + QaQueUsr qaQueUsr = qaService.getQaUserBySession(new Long(userID), qaSession.getUid()); + logger.debug("QaQueUsr:" + qaQueUsr); + + if ((qaQueUsr != null) && (qaQueUsr.isResponseFinalized())) { + logger.debug("is current user's response finalised: " + qaQueUsr.isResponseFinalized()); + QaSession checkSession = qaQueUsr.getQaSession(); + logger.debug("checkSession:" + checkSession); + + if (checkSession != null) { + Long checkQaSessionId = checkSession.getQaSessionId(); + logger.debug("checkQaSessionId:" + checkQaSessionId); + + if (checkQaSessionId.toString().equals(currentToolSessionID.toString())) { + + logger.debug("the learner is in the same session and has already responsed to this content"); + logger.debug("lockWhenFinished: " + lockWhenFinished); + + boolean isLearnerFinished = qaQueUsr.isLearnerFinished(); + logger.debug("isLearnerFinished: " + isLearnerFinished); + + generalLearnerFlowDTO.setLockWhenFinished(new Boolean(lockWhenFinished).toString()); + + logger.debug("isUserNamesVisible: " + qaContent.isUsernameVisible()); + Boolean isUserNamesVisibleBoolean = new Boolean(qaContent.isUsernameVisible()); + boolean isUserNamesVisible = isUserNamesVisibleBoolean.booleanValue(); + + QaMonitoringAction qaMonitoringAction = new QaMonitoringAction(); + /*the report should have all the users' entries OR + * the report should have only the current session's entries*/ + + generalLearnerFlowDTO.setRequestLearningReport(new Boolean(true).toString()); + + logger.debug("using generalLearnerFlowDTO: " + generalLearnerFlowDTO); + qaMonitoringAction.refreshSummaryData(request, qaContent, qaService, isUserNamesVisible, true, + currentToolSessionID.toString(), userID, generalLearnerFlowDTO, false, toolSessionID); + logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); + + logger.debug("current sessionMap: " + sessionMap); + + mapAnswers = (Map) sessionMap.get(MAP_ALL_RESULTS_KEY); + logger.debug("mapAnswers: " + mapAnswers); + + HttpSession ss = SessionManager.getSession(); + /* get back login user DTO */ + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + Long userId = new Long(toolUser.getUserID().longValue()); + + QaQueUsr qaQueUsrLocal = qaService.getQaUserBySession(userId, qaSession.getUid()); + logger.debug("qaQueUsrLocal: " + qaQueUsrLocal); + logger.debug("qaQueUsrLocal uid : " + qaQueUsrLocal.getUid()); + + generalLearnerFlowDTO.setUserUid(qaQueUsrLocal.getUid().toString()); + String noteBookEntry = generalLearnerFlowDTO.getNotebookEntry(); + logger.debug("noteBookEntry : " + noteBookEntry); + qaLearningForm.setEntryText(noteBookEntry); + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntryLocal = qaService.getEntry(new Long(toolSessionID), + CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(userID)); + + logger.debug("notebookEntryLocal: " + notebookEntryLocal); + + if (notebookEntryLocal != null) { + String notebookEntryPresentable = QaUtils.replaceNewLines(notebookEntryLocal.getEntry()); + logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); + generalLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); + qaLearningForm.setEntryText(notebookEntryPresentable); } - catch(NumberFormatException e) - { - logger.debug("add error.sessionId.numberFormatException to ActionMessages."); - return false; + + if (isLearnerFinished) { + logger.debug("isLearnerFinished is true"); + generalLearnerFlowDTO.setRequestLearningReportViewOnly(new Boolean(true).toString()); + + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + logger.debug("before fwd, GENERAL_LEARNER_FLOW_DTO: " + + request.getAttribute(GENERAL_LEARNER_FLOW_DTO)); + + logger.debug("fwd'ing to." + REVISITED_LEARNER_REP); + return (mapping.findForward(REVISITED_LEARNER_REP)); + } else { + logger.debug("NOT true both isLearnerFinished and lockWhenFinished"); + generalLearnerFlowDTO.setRequestLearningReportViewOnly(new Boolean(false).toString()); + + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + logger.debug("before fwd, GENERAL_LEARNER_FLOW_DTO: " + + request.getAttribute(GENERAL_LEARNER_FLOW_DTO)); } + + logger.debug("fwd'ing to." + INDIVIDUAL_LEARNER_REPORT); + return (mapping.findForward(INDIVIDUAL_LEARNER_REPORT)); + } + } } - - /*mode can be learner, teacher or author */ - String mode=request.getParameter(MODE); - logger.debug("mode: " + mode); - - if ((mode == null) || (mode.length() == 0)) - { - return false; + } else { + logger.debug("userId is null, it should not be, report this."); + } + + /* + * present user with the questions. + */ + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + logger.debug("GENERAL_LEARNER_FLOW_DTO: " + request.getAttribute(GENERAL_LEARNER_FLOW_DTO)); + logger.debug("forwarding to: " + LOAD_LEARNER); + return (mapping.findForward(LOAD_LEARNER)); + } + + /** + * validates the learning mode parameters + * + * @param request + * @param mapping + * @return ActionForward + */ + protected boolean validateParameters(HttpServletRequest request, ActionMapping mapping, + QaLearningForm qaLearningForm) { + /* + * obtain and setup the current user's data + */ + String userID = ""; + HttpSession ss = SessionManager.getSession(); + logger.debug("ss: " + ss); + + if (ss != null) { + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user != null) && (user.getUserID() != null)) { + userID = user.getUserID().toString(); + logger.debug("retrieved userId: " + userID); + qaLearningForm.setUserID(userID); } - - if ((!mode.equals("learner")) && (!mode.equals("teacher")) && (!mode.equals("author"))) - { - return false; + } + + /* + * process incoming tool session id and later derive toolContentId from it. + */ + String strToolSessionId = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); + long toolSessionId = 0; + if ((strToolSessionId == null) || (strToolSessionId.length() == 0)) { + persistError(request, "error.toolSessionId.required"); + return false; + } else { + try { + toolSessionId = new Long(strToolSessionId).longValue(); + logger.debug("passed TOOL_SESSION_ID : " + new Long(toolSessionId)); + qaLearningForm.setToolSessionID(new Long(toolSessionId).toString()); + } catch (NumberFormatException e) { + logger.debug("add error.sessionId.numberFormatException to ActionMessages."); + return false; } + } - logger.debug("session LEARNING_MODE set to:" + mode); - qaLearningForm.setMode(mode); - return true; + /*mode can be learner, teacher or author */ + String mode = request.getParameter(MODE); + logger.debug("mode: " + mode); + + if ((mode == null) || (mode.length() == 0)) { + return false; } - - - boolean isSessionCompleted(String userSessionId, IQaService qaService) - { - logger.debug("userSessionId:" + userSessionId); - QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(userSessionId).longValue()); - logger.debug("retrieving qaSession: " + qaSession); - logger.debug("voteSession status : " + qaSession.getSession_status()); - if ((qaSession.getSession_status() != null) && (qaSession.getSession_status().equals(COMPLETED))) - { - logger.debug("this session is COMPLETED voteSession status : " + userSessionId); - return true; - } + + if ((!mode.equals("learner")) && (!mode.equals("teacher")) && (!mode.equals("author"))) { return false; } - - /** + logger.debug("session LEARNING_MODE set to:" + mode); + qaLearningForm.setMode(mode); + return true; + } + + boolean isSessionCompleted(String userSessionId, IQaService qaService) { + logger.debug("userSessionId:" + userSessionId); + QaSession qaSession = qaService.retrieveQaSessionOrNullById(new Long(userSessionId).longValue()); + logger.debug("retrieving qaSession: " + qaSession); + logger.debug("voteSession status : " + qaSession.getSession_status()); + if ((qaSession.getSession_status() != null) && (qaSession.getSession_status().equals(COMPLETED))) { + logger.debug("this session is COMPLETED voteSession status : " + userSessionId); + return true; + } + return false; + } + + /** * persists error messages to request scope + * * @param request * @param message */ - public void persistError(HttpServletRequest request, String message) - { - ActionMessages errors= new ActionMessages(); - errors.add(Globals.ERROR_KEY, new ActionMessage(message)); - logger.debug("add " + message +" to ActionMessages:"); - saveErrors(request,errors); - } -} + public void persistError(HttpServletRequest request, String message) { + ActionMessages errors = new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message + " to ActionMessages:"); + saveErrors(request, errors); + } +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaMonitoringForm.java,v diff -u -r1.20 -r1.21 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringForm.java 23 Sep 2006 15:11:01 -0000 1.20 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringForm.java 19 Feb 2009 04:25:02 -0000 1.21 @@ -32,145 +32,163 @@ /** * @author Ozgur Demirtas - * + * */ public class QaMonitoringForm extends QaAuthoringForm implements QaAppConstants { - //controls which method is called by the Lookup map */ - protected String method; - protected String selectedToolSessionId; - protected String isToolSessionChanged; - - protected String editResponse; - protected String hideResponse; - protected String showResponse; - protected String currentUid; - - protected String sessionId; - - protected IQaService qaService; - - - public String toString() { - super.toString(); - return new ToStringBuilder(this) - .append("Listing current QaMonitoringForm properties: ") - .append("method: ", method) - .append("selectedToolSessionId: ", selectedToolSessionId) - .append("isToolSessionChanged: ", isToolSessionChanged) - .append("editResponse: ", editResponse) - .append("hideResponse: ", hideResponse) - .append("showResponse: ", showResponse) - .append("currentUid: ", currentUid) - .toString(); + //controls which method is called by the Lookup map */ + protected String method; + protected String selectedToolSessionId; + protected String isToolSessionChanged; + + protected String editResponse; + protected String hideResponse; + protected String showResponse; + protected String currentUid; + + protected String sessionId; + + protected IQaService qaService; + + public String toString() { + super.toString(); + return new ToStringBuilder(this).append("Listing current QaMonitoringForm properties: ").append("method: ", + method).append("selectedToolSessionId: ", selectedToolSessionId).append("isToolSessionChanged: ", + isToolSessionChanged).append("editResponse: ", editResponse).append("hideResponse: ", hideResponse) + .append("showResponse: ", showResponse).append("currentUid: ", currentUid).toString(); } - + /** * @return Returns the editResponse. */ public String getEditResponse() { - return editResponse; + return editResponse; } + /** - * @param editResponse The editResponse to set. + * @param editResponse + * The editResponse to set. */ public void setEditResponse(String editResponse) { - this.editResponse = editResponse; + this.editResponse = editResponse; } + /** * @return Returns the qaService. */ public IQaService getQaService() { - return qaService; + return qaService; } + /** - * @param qaService The qaService to set. + * @param qaService + * The qaService to set. */ public void setQaService(IQaService qaService) { - this.qaService = qaService; + this.qaService = qaService; } + /** * @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 hideResponse. */ public String getHideResponse() { - return hideResponse; + return hideResponse; } + /** - * @param hideResponse The hideResponse to set. + * @param hideResponse + * The hideResponse to set. */ public void setHideResponse(String hideResponse) { - this.hideResponse = hideResponse; + this.hideResponse = hideResponse; } + /** * @return Returns the showResponse. */ public String getShowResponse() { - return showResponse; + return showResponse; } + /** - * @param showResponse The showResponse to set. + * @param showResponse + * The showResponse to set. */ public void setShowResponse(String showResponse) { - this.showResponse = showResponse; + this.showResponse = showResponse; } - /** - * @return Returns the isToolSessionChanged. - */ - public String getIsToolSessionChanged() { - return isToolSessionChanged; - } - /** - * @param isToolSessionChanged The isToolSessionChanged to set. - */ - public void setIsToolSessionChanged(String isToolSessionChanged) { - this.isToolSessionChanged = isToolSessionChanged; - } - /** - * @return Returns the selectedToolSessionId. - */ - public String getSelectedToolSessionId() { - return selectedToolSessionId; - } - /** - * @param selectedToolSessionId The selectedToolSessionId to set. - */ - public void setSelectedToolSessionId(String selectedToolSessionId) { - this.selectedToolSessionId = selectedToolSessionId; - } - - /** - * @return Returns the method. - */ - public String getMethod() { - return method; - } - /** - * @param method The method to set. - */ - public void setMethod(String method) { - this.method = method; - } + /** + * @return Returns the isToolSessionChanged. + */ + public String getIsToolSessionChanged() { + return isToolSessionChanged; + } + + /** + * @param isToolSessionChanged + * The isToolSessionChanged to set. + */ + public void setIsToolSessionChanged(String isToolSessionChanged) { + this.isToolSessionChanged = isToolSessionChanged; + } + + /** + * @return Returns the selectedToolSessionId. + */ + public String getSelectedToolSessionId() { + return selectedToolSessionId; + } + + /** + * @param selectedToolSessionId + * The selectedToolSessionId to set. + */ + public void setSelectedToolSessionId(String selectedToolSessionId) { + this.selectedToolSessionId = selectedToolSessionId; + } + + /** + * @return Returns the method. + */ + public String getMethod() { + return method; + } + + /** + * @param method + * The method to set. + */ + public void setMethod(String method) { + this.method = method; + } + + /** * @return Returns the sessionId. */ public String getSessionId() { - return sessionId; + return sessionId; } + /** - * @param sessionId The sessionId to set. + * @param sessionId + * The sessionId to set. */ public void setSessionId(String sessionId) { - this.sessionId = sessionId; + this.sessionId = sessionId; } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java,v diff -u -r1.51 -r1.52 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 3 Dec 2006 14:58:02 -0000 1.51 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 19 Feb 2009 04:25:02 -0000 1.52 @@ -59,305 +59,260 @@ /** * - * @author Ozgur Demirtas - * starts up the monitoring module + * @author Ozgur Demirtas starts up the monitoring module * - * - - - - - - - * + * + * + * + * + * + * + * */ public class QaMonitoringStarterAction extends Action implements QaAppConstants { - static Logger logger = Logger.getLogger(QaMonitoringStarterAction.class.getName()); + static Logger logger = Logger.getLogger(QaMonitoringStarterAction.class.getName()); - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException, QaApplicationException - { - logger.debug("init QaMonitoringStarterAction..."); - QaUtils.cleanUpSessionAbsolute(request); - - QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; - logger.debug("qaMonitoringForm: " + qaMonitoringForm); + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException, QaApplicationException { + logger.debug("init QaMonitoringStarterAction..."); + QaUtils.cleanUpSessionAbsolute(request); - IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); - logger.debug("qaService: " + qaService); - qaMonitoringForm.setQaService(qaService); - - String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - logger.debug("contentFolderID: " + contentFolderID); - qaMonitoringForm.setContentFolderID(contentFolderID); + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + logger.debug("qaMonitoringForm: " + qaMonitoringForm); - - - ActionForward validateParameters=validateParameters(request, mapping, qaMonitoringForm); - logger.debug("validateParamaters: " + validateParameters); - if (validateParameters != null) - { - return validateParameters; - } + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("qaService: " + qaService); + qaMonitoringForm.setQaService(qaService); - - GeneralMonitoringDTO generalMonitoringDTO= new GeneralMonitoringDTO(); - boolean initData=initialiseMonitoringData(mapping, qaMonitoringForm, request, response, qaService, generalMonitoringDTO); - logger.debug("initData: " + initData); - if (initData == false) - return (mapping.findForward(ERROR_LIST)); - - qaMonitoringForm.setCurrentTab("1"); - logger.debug("setting current tab to 1: "); - - generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - generalMonitoringDTO.setContentFolderID(contentFolderID); - - - QaMonitoringAction qaMonitoringAction= new QaMonitoringAction(); - logger.debug("calling initSummaryContent."); - qaMonitoringAction.initSummaryContent(mapping, form, request, response); - logger.debug("calling initInstructionsContent."); - qaMonitoringAction.initInstructionsContent(mapping, form, request, response); - logger.debug("calling initStatsContent."); - qaMonitoringAction.initStatsContent(mapping, form, request, response, generalMonitoringDTO); - logger.debug("post initStatsContent." + generalMonitoringDTO); - - String toolContentID=qaMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - QaContent qaContent=qaService.loadQa(new Long(toolContentID).longValue()); - logger.debug("existing qaContent:" + qaContent); - - /*true means there is at least 1 response*/ - if (qaService.studentActivityOccurredGlobal(qaContent)) - { - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - } - else - { - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - } + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + qaMonitoringForm.setContentFolderID(contentFolderID); - request.setAttribute(SELECTION_CASE, new Long(2)); - qaMonitoringForm.setActiveModule(MONITORING); - qaMonitoringForm.setEditResponse(new Boolean(false).toString()); - - - /**getting instructions screen content from here... */ - generalMonitoringDTO.setOnlineInstructions(qaContent.getOnlineInstructions()); - generalMonitoringDTO.setOfflineInstructions(qaContent.getOfflineInstructions()); - - List attachmentList = qaService.retrieveQaUploadedFiles(qaContent); - logger.debug("attachmentList: " + attachmentList); - generalMonitoringDTO.setAttachmentList(attachmentList); - generalMonitoringDTO.setDeletedAttachmentList(new ArrayList()); - /** ...till here **/ + ActionForward validateParameters = validateParameters(request, mapping, qaMonitoringForm); + logger.debug("validateParamaters: " + validateParameters); + if (validateParameters != null) { + return validateParameters; + } - - EditActivityDTO editActivityDTO = new EditActivityDTO(); - boolean isContentInUse=QaUtils.isContentInUse(qaContent); - logger.debug("isContentInUse:" + isContentInUse); - if (isContentInUse == true) - { - editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); - } - request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + GeneralMonitoringDTO generalMonitoringDTO = new GeneralMonitoringDTO(); + boolean initData = initialiseMonitoringData(mapping, qaMonitoringForm, request, response, qaService, + generalMonitoringDTO); + logger.debug("initData: " + initData); + if (initData == false) + return (mapping.findForward(ERROR_LIST)); - - qaMonitoringAction.prepareReflectionData(request, qaContent, qaService, null, false, "All"); - - logger.debug("final qaMonitoringForm: " + qaMonitoringForm); - logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); - request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); - - - /*for Edit Activity screen, BasicTab-ViewOnly*/ - qaMonitoringAction.prepareEditActivityScreenData(request, qaContent); - - - - SessionMap sessionMap = new SessionMap(); - sessionMap.put(ACTIVITY_TITLE_KEY, qaContent.getTitle()); - sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, qaContent.getInstructions()); - - qaMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); - request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + qaMonitoringForm.setCurrentTab("1"); + logger.debug("setting current tab to 1: "); - - List listQuestionContentDTO= new LinkedList(); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + generalMonitoringDTO.setContentFolderID(contentFolderID); - Iterator queIterator=qaContent.getQaQueContents().iterator(); - while (queIterator.hasNext()) - { - QaQuestionContentDTO qaQuestionContentDTO=new QaQuestionContentDTO(); - - QaQueContent qaQueContent=(QaQueContent) queIterator.next(); - if (qaQueContent != null) - { - logger.debug("question: " + qaQueContent.getQuestion()); - logger.debug("displayorder: " + new Integer(qaQueContent.getDisplayOrder()).toString()); - logger.debug("feedback: " + qaQueContent.getFeedback()); - - qaQuestionContentDTO.setQuestion(qaQueContent.getQuestion()); - qaQuestionContentDTO.setDisplayOrder(new Integer(qaQueContent.getDisplayOrder()).toString()); - qaQuestionContentDTO.setFeedback(qaQueContent.getFeedback()); - listQuestionContentDTO.add(qaQuestionContentDTO); - } - } - logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); - request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); - sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - - request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - - boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(qaService, qaContent); - logger.debug("notebookEntriesExist : " + notebookEntriesExist); - - if (notebookEntriesExist) - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - - String userExceptionNoToolSessions=(String)generalMonitoringDTO.getUserExceptionNoToolSessions(); - logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); - - if (userExceptionNoToolSessions.equals("true")) - { - logger.debug("there are no online student activity but there are reflections : "); - request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - } + QaMonitoringAction qaMonitoringAction = new QaMonitoringAction(); + logger.debug("calling initSummaryContent."); + qaMonitoringAction.initSummaryContent(mapping, form, request, response); + logger.debug("calling initInstructionsContent."); + qaMonitoringAction.initInstructionsContent(mapping, form, request, response); + logger.debug("calling initStatsContent."); + qaMonitoringAction.initStatsContent(mapping, form, request, response, generalMonitoringDTO); + logger.debug("post initStatsContent." + generalMonitoringDTO); - } - else - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); - } - - MonitoringUtil.buildQaStatsDTO(request,qaService, qaContent); - - request.setAttribute("currentMonitoredToolSession", "All"); - MonitoringUtil.generateGroupsSessionData(request, qaService, qaContent,false); - - logger.debug("fwding to : " + LOAD_MONITORING); - return (mapping.findForward(LOAD_MONITORING)); + String toolContentID = qaMonitoringForm.getToolContentID(); + logger.debug("toolContentID: " + toolContentID); + + QaContent qaContent = qaService.loadQa(new Long(toolContentID).longValue()); + logger.debug("existing qaContent:" + qaContent); + + /*true means there is at least 1 response*/ + if (qaService.studentActivityOccurredGlobal(qaContent)) { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } else { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); } - - /** - * initialises monitoring data mainly for jsp purposes - * initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - * - * @param mapping - * @param form - * @param request - * @param response - * @return boolean - */ - public boolean initialiseMonitoringData(ActionMapping mapping, QaMonitoringForm qaMonitoringForm, HttpServletRequest request, - HttpServletResponse response, IQaService qaService, GeneralMonitoringDTO generalMonitoringDTO) - { - logger.debug("start initializing monitoring data...: " + qaService); - generalMonitoringDTO.setEditResponse(new Boolean(false).toString()); - generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - - String toolContentID=qaMonitoringForm.getToolContentID(); - logger.debug("toolContentID:" + toolContentID); - - QaContent qaContent=qaService.loadQa(new Long(toolContentID).longValue()); - logger.debug("existing qaContent:" + qaContent); - - if (qaContent == null) - { - QaUtils.cleanUpSessionAbsolute(request); - return false; - } - - QaMonitoringAction qaMonitoringAction= new QaMonitoringAction(); - logger.debug("refreshing summary data..."); - - GeneralLearnerFlowDTO generalLearnerFlowDTO= LearningUtil.buildGeneralLearnerFlowDTO(qaContent); - logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); - - qaMonitoringAction.refreshSummaryData(request, qaContent, qaService, true, false, null, null, - generalLearnerFlowDTO, false , "All"); - - logger.debug("refreshing stats data..."); - qaMonitoringAction.refreshStatsData(request, qaMonitoringForm, qaService, generalMonitoringDTO); - + request.setAttribute(SELECTION_CASE, new Long(2)); + qaMonitoringForm.setActiveModule(MONITORING); + qaMonitoringForm.setEditResponse(new Boolean(false).toString()); - logger.debug("end initialising monitoring data..."); - return true; + /** getting instructions screen content from here... */ + generalMonitoringDTO.setOnlineInstructions(qaContent.getOnlineInstructions()); + generalMonitoringDTO.setOfflineInstructions(qaContent.getOfflineInstructions()); + + List attachmentList = qaService.retrieveQaUploadedFiles(qaContent); + logger.debug("attachmentList: " + attachmentList); + generalMonitoringDTO.setAttachmentList(attachmentList); + generalMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here * */ + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse = QaUtils.isContentInUse(qaContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); - - /** - * validates request paramaters based on tool contract - * validateParameters(HttpServletRequest request, ActionMapping mapping) - * - * @param request - * @param mapping - * @return ActionForward - */ - protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping, QaMonitoringForm qaMonitoringForm) - { - logger.debug("start validating monitoring parameters..."); - - String strToolContentId=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); - logger.debug("strToolContentId: " + strToolContentId); - - if ((strToolContentId == null) || (strToolContentId.length() == 0)) - { - QaUtils.cleanUpSessionAbsolute(request); - return (mapping.findForward(ERROR_LIST)); + qaMonitoringAction.prepareReflectionData(request, qaContent, qaService, null, false, "All"); + + logger.debug("final qaMonitoringForm: " + qaMonitoringForm); + logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO); + request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); + + /*for Edit Activity screen, BasicTab-ViewOnly*/ + qaMonitoringAction.prepareEditActivityScreenData(request, qaContent); + + SessionMap sessionMap = new SessionMap(); + sessionMap.put(ACTIVITY_TITLE_KEY, qaContent.getTitle()); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, qaContent.getInstructions()); + + qaMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + + List listQuestionContentDTO = new LinkedList(); + + Iterator queIterator = qaContent.getQaQueContents().iterator(); + while (queIterator.hasNext()) { + QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO(); + + QaQueContent qaQueContent = (QaQueContent) queIterator.next(); + if (qaQueContent != null) { + logger.debug("question: " + qaQueContent.getQuestion()); + logger.debug("displayorder: " + new Integer(qaQueContent.getDisplayOrder()).toString()); + logger.debug("feedback: " + qaQueContent.getFeedback()); + + qaQuestionContentDTO.setQuestion(qaQueContent.getQuestion()); + qaQuestionContentDTO.setDisplayOrder(new Integer(qaQueContent.getDisplayOrder()).toString()); + qaQuestionContentDTO.setFeedback(qaQueContent.getFeedback()); + listQuestionContentDTO.add(qaQuestionContentDTO); } - else - { - try - { - long toolContentId=new Long(strToolContentId).longValue(); - logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); + } + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); + sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - qaMonitoringForm.setToolContentID(new Long(toolContentId).toString()); - } - catch(NumberFormatException e) - { - logger.debug("add error.contentId.numberFormatException to ActionMessages."); - QaUtils.cleanUpSessionAbsolute(request); - return (mapping.findForward(ERROR_LIST)); - } + request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + + boolean notebookEntriesExist = MonitoringUtil.notebookEntriesExist(qaService, qaContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions = (String) generalMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); } - return null; + + } else { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); } - - /** + MonitoringUtil.buildQaStatsDTO(request, qaService, qaContent); + + request.setAttribute("currentMonitoredToolSession", "All"); + MonitoringUtil.generateGroupsSessionData(request, qaService, qaContent, false); + + logger.debug("fwding to : " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } + + /** + * initialises monitoring data mainly for jsp purposes + * initialiseMonitoringData(ActionMapping mapping, ActionForm form, + * HttpServletRequest request, HttpServletResponse response) + * + * @param mapping + * @param form + * @param request + * @param response + * @return boolean + */ + public boolean initialiseMonitoringData(ActionMapping mapping, QaMonitoringForm qaMonitoringForm, + HttpServletRequest request, HttpServletResponse response, IQaService qaService, + GeneralMonitoringDTO generalMonitoringDTO) { + logger.debug("start initializing monitoring data...: " + qaService); + generalMonitoringDTO.setEditResponse(new Boolean(false).toString()); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + + String toolContentID = qaMonitoringForm.getToolContentID(); + logger.debug("toolContentID:" + toolContentID); + + QaContent qaContent = qaService.loadQa(new Long(toolContentID).longValue()); + logger.debug("existing qaContent:" + qaContent); + + if (qaContent == null) { + QaUtils.cleanUpSessionAbsolute(request); + return false; + } + + QaMonitoringAction qaMonitoringAction = new QaMonitoringAction(); + logger.debug("refreshing summary data..."); + + GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(qaContent); + logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); + + qaMonitoringAction.refreshSummaryData(request, qaContent, qaService, true, false, null, null, + generalLearnerFlowDTO, false, "All"); + + logger.debug("refreshing stats data..."); + qaMonitoringAction.refreshStatsData(request, qaMonitoringForm, qaService, generalMonitoringDTO); + + logger.debug("end initialising monitoring data..."); + return true; + } + + /** + * validates request paramaters based on tool contract + * validateParameters(HttpServletRequest request, ActionMapping mapping) + * + * @param request + * @param mapping + * @return ActionForward + */ + protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping, + QaMonitoringForm qaMonitoringForm) { + logger.debug("start validating monitoring parameters..."); + + String strToolContentId = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentId: " + strToolContentId); + + if ((strToolContentId == null) || (strToolContentId.length() == 0)) { + QaUtils.cleanUpSessionAbsolute(request); + return (mapping.findForward(ERROR_LIST)); + } else { + try { + long toolContentId = new Long(strToolContentId).longValue(); + logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); + + qaMonitoringForm.setToolContentID(new Long(toolContentId).toString()); + } catch (NumberFormatException e) { + logger.debug("add error.contentId.numberFormatException to ActionMessages."); + QaUtils.cleanUpSessionAbsolute(request); + return (mapping.findForward(ERROR_LIST)); + } + } + return null; + } + + /** * persists error messages to request scope + * * @param request * @param message */ - public void persistError(HttpServletRequest request, String message) - { - ActionMessages errors= new ActionMessages(); - errors.add(Globals.ERROR_KEY, new ActionMessage(message)); - logger.debug("add " + message +" to ActionMessages:"); - saveErrors(request,errors); - } -} + public void persistError(HttpServletRequest request, String message) { + ActionMessages errors = new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message + " to ActionMessages:"); + saveErrors(request, errors); + } +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java,v diff -u -r1.69 -r1.70 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 4 Nov 2008 00:41:19 -0000 1.69 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 19 Feb 2009 04:25:02 -0000 1.70 @@ -524,7 +524,7 @@ qaAuthoringForm.setOfflineInstructions(qaContent.getOfflineInstructions()); sessionMap.put(QaAppConstants.ONLINE_INSTRUCTIONS_KEY, qaContent.getOnlineInstructions()); sessionMap.put(QaAppConstants.OFFLINE_INSTRUCTIONS_KEY, qaContent.getOfflineInstructions()); - + QaStarterAction.logger.debug("ACTIVITY_TITLE_KEY set to:" + sessionMap.get(QaAppConstants.ACTIVITY_TITLE_KEY)); qaAuthoringForm.resetUserAction();